I have written one python script for each test case. Now I want to have another script that runs all the test cases one by one, and output the result of each test case to a file. How should I start?
pythononmac
0
Newbie Poster
Recommended Answers
Jump to Poststart here:
http://docs.python.org/3.0/tutorial/
Jump to PostAssuming each script has a function called run_test:
import os, sys folder = os.path.abs("pathtoscriptsfolder") sys.path.append(folder) for script in os.listdir(folder): if script.endswith(".py"): mod = __import__(script) res = mod.run_test() fh = open("tests.res", "a") fh.writeline(str(res))
All 7 Replies
Stefano Mtangoo
455
Senior Poster
scru
909
Posting Virtuoso
Featured Poster
pythononmac
0
Newbie Poster
scru
909
Posting Virtuoso
Featured Poster
pythononmac
0
Newbie Poster
pythononmac
0
Newbie Poster
lllllIllIlllI
178
Veteran Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.