-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
34 lines (33 loc) · 1.05 KB
/
run.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
from exceptions import Exception
import yaml
with open('config.yaml','r') as content:
data = yaml.load(content)
Req_Test_Per = data["servers"]["testenv"]
lines=[]
total=0
fail=0
#Req_Test_Per = 50
with open ('TEST-TestEnvTestCases.txt','rt') as in_file:
for line in in_file:
lines.append(line.rstrip('\n'))
index = 0
for element in lines:
substr = "Tests run:"
index = element.find(substr, index)
if index>=0:
total_start = element.find(':',index)
total_end = element.find(',',total_start)
fail_start=element.find(':',total_end)
fail_end = element.find(',',fail_start)
total=int(element[total_start+2:total_end])
fail=int(element[fail_start+2:fail_end])
break
index=0
print("TestCases Run :" +str(total))
print("Failures :" +str(fail))
Out_Per = (float(total-fail)/total)*100
print("Percentage :"+str(Out_Per)+"%")
if Out_Per >= Req_Test_Per:
print ("Passed for deploying in testenv")
else:
raise Exception("build failed because of Required Percentage "+str(Req_Test_Per)+"%")