擅长:python、mysql、java
<pre><code>## This will execute the tests we need to run
import sys, glob, os, time
def run_all_tests():
sys.path.append('/com/inthinc/python/tiwiPro/usedbyall/run files')
run_all_tests = glob.glob('/com/inthinc/python/tiwipro/usedbyall/run files/*.py')
for i in range( len(run_all_tests) ):
replaceme = run_all_tests[i]
withoutpy = replaceme.replace( '.py', '')
withouttree = withoutpy.replace( '/com/inthinc/python/tiwipro/usedbyall/run files\\', '' )
exec("import " + withouttree)
exec( withouttree + ".run_test()" )
if __name__ == '__main__':
os.system( "taskkill /im java.exe" )
if __name__ == '__main__':
os.startfile( "C:/com/inthinc/python/tiwiPro/usedbyall/start_selenium.bat" )
time.sleep( 10 )
run_all_tests()
</code></pre>
<p>我最后用的就是这个。我只需将run_test()方法添加到每个测试中,这样就可以像普通方法一样在外部调用它们。这很好的工作,让我能更好地控制测试。我还添加了一条短线,它将打开selenium RC服务器,然后关闭它。在</p>