python code:
MultiRun DEF ():
# Name List all use cases, convenient cmd window Copy
the try:
f_casesname = Open (r'E: \ Test \ scrips \ nameoftestcases.txt ')
Print U' test automation (case methods) are: '
for Line in f_casesname.readlines ():
IF (line.startswith ( "#")):
the Continue
Line = line.strip ()
Cases = line.split ( "=")
IF (! len (Cases) = 2) :
Continue
the else:
Print cases [. 1]
the finally:
f_casesname.close ()
number # input name to be tested use cases, need to test
print '\ n', u 'enter a test name test_case_name:'
test_case the raw_input = ()
print '\ n', u 'Please Enter the number of performed tests test_count:'
test_count = the raw_input ()
# according to the input requirements, a test is performed
for I in Range (int (test_count)):
print '\ n', u 'execution of ', i + 1, u' test: ', test_case
TestUnit = unittest.TestSuite ()
testunit.addTest (called testHelloWorld that (test_case))
Runner = unittest.TextTestRunner ()
runner.run (TestUnit)
Call the method:
appium + python The results:
Summary: The above may be selected to achieve a particular test case execution times for using the test case execution in accordance with unittest operation.
unittest embodiment performs a variety of ways using, for example to start all test modules unittest.main (), is performed by TestSuit test cases, a plurality of through testLoader the like may be tested, using the conventional method can refer to the article http: // www .51testing.com / html / 10 / 448910-3648852.html (python unittest performed using test performed in several ways)