-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweb_test_gen.py
58 lines (55 loc) · 1.54 KB
/
web_test_gen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from pandas import *
import csv
import time
import sys
import getopt
from random import randint
outputfile = str(sys.argv[1])
k = int(sys.argv[2])
with open(outputfile + '.csv', 'wb') as f:
testbotwriter = csv.writer(f)
#testbot_raw = list()
testbotwriter.writerow(['ssid','uid','lo','act','cat','pid','pcat','paypid','qty','unit_price','oid','amt','ERCAMP','ERAD'])
for k in range(k):
before_login = randint(2,5)
after_login = randint(2,5)
i = 0
while i < before_login:
ssid = "s%03d" %(k+1)
uid = "u%03d" %(k+1)
lo = "0"
act = "view"
last_cat = randint(0,9)
cat = "catA%1d,catB%1d,catC%1d" %(randint(0,9), randint(0,9), last_cat)
pid = "pC%1d_%02d" %(last_cat, randint(0,99))
pcat = ""
paypid = ""
qty = ""
unit_price = ""
oid = ""
amt = ""
campid = randint(0,9)
ERCAMP = "camp%02d" %(campid)
ERAD = "ad%02d_%02d" %(campid, randint(0,99))
testbotwriter.writerow([ssid,uid,lo,act,cat,pid,pcat,paypid,qty,unit_price,oid,amt,ERCAMP,ERAD])
i = i + 1
j = 0
while j < after_login:
ssid = "s%03d" %(k+1)
uid = "u%03d" %(k+1)
lo = "1"
act = "view"
last_cat = randint(0,9)
cat = "catA%1d,catB%1d,catC%1d" %(randint(0,9), randint(0,9), last_cat)
pid = "pC%1d_%02d" %(last_cat, randint(0,99))
pcat = ""
paypid = ""
qty = ""
unit_price = ""
oid = ""
amt = ""
campid = randint(0,9)
ERCAMP = "camp%02d" %(campid)
ERAD = "ad%02d_%02d" %(campid, randint(0,99))
testbotwriter.writerow([ssid,uid,lo,act,cat,pid,pcat,paypid,qty,unit_price,oid,amt,ERCAMP,ERAD])
j = j + 1