-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest_modules_in_serial.py
51 lines (48 loc) · 1.5 KB
/
test_modules_in_serial.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
import glob
import os
import traceback
import subprocess
import time
start = time.time()
count=0
lst = glob.glob("../path-traversal/*")
count=0
failed = 0
passed=0
failed_list=[]
for folder in lst:
index = folder.rfind("/")
main_folder_name = folder[index+1:]
# print(main_folder_name)
try:
test_file = glob.glob(folder+"/*.test.js")
# print(test_file)
if len(test_file)!=0:
# print(test_file[0])
test_file_full_path = test_file[0]
index = test_file_full_path.find("/",2)
test_file_name = test_file_full_path[index+1:]
print(test_file_name)
ping = subprocess.run(['jest', '--forceExit', test_file_name], stdout=None, check=True)
print(ping)
if ping.returncode==0:
print("TEST PASSED")
passed+=1
else:
print("TEST FAILED")
failed+=1
count+=1
except:
print("TEST FAILED")
failed+=1
failed_list.append(test_file_name)
# traceback.print_exc()
# if(count>=5):
# break
print("******************************************SUMMARY******************************************")
print("-------------------------------------------------------------------------------------------")
print(time.time() - start, "seconds")
print("TOTAL PASSED = ", passed,"/",(passed+failed))
print("TOTAL FAILED = ", failed)
print("Failed Tests=====================>")
print(failed_list)