Set the run-time files

Not much to say. . . . .

. 1  Import SYS, OS, Time, the unittest
 2  from BSTestRunner Import BSTestRunner
 . 3  from In Email Import SendEmail
 . 4  
. 5 base_dir = The os.getcwd ()
 . 6  
. 7 sys.path.append (base_dir + ' \\ public ' )
 . 8  
. 9  '' ' execution path test report '' ' 
10 run_dir = the os.path.join (base_dir + ' \\ \\ the TestProject ' )
 . 11  
12 is  '' ' stored test report path ' '' 
13 is report_dir = the os.path.join(base_dir + '\\TestReport\\testresult\\')
14 now_date = time.strftime("%Y-%m-%d %H_%M_%S")
15 
16 reportNAME = report_dir + now_date + 'htmlResult.html'
17 
18 discover = unittest.defaultTestLoader.discover(run_dir, pattern='test_url.py')
19 
20 if __name__ == "__main__":
21     with open(reportNAME, 'wb') as fp:
22         runner = BSTestRunner(stream=FP,
 23 is                                the verbosity = 2 ,
 24                                title = ' automated test report ' ,
 25                                Description = ' the BBS Test the Login ' )
 26 is  
27          runner.run (Discover)
 28      fp.close ()
 29      '' ' E-mail ' '' 
30      SendEmail ()
View Code

 

Guess you like

Origin www.cnblogs.com/97xiaolai/p/11738865.html