selenium webdriver python _test suite

上一篇 / 下一篇  2014-02-26 10:10:27 / 个人分类:selenium+pythhon

 
if __name__ == "__main__":
suite = unittest.TestSuite()
suite.addTest(类名("类中的方法名1"))
suite.addTest(类名("类中的方法名2"))
。。。。。
unittest.TextTestRunner().run(suite)
可以加N个方法。。。
我们对代码进行一下分析:
class login实现一个继承unittest.Testcase的类,
unittest.main()来测试该类中以test开头的测试用例
setUp初始化程序:可以看到存放是启动wedbdriver程序
tearDowni清整程序:只要setup启动成功,不管以test开头的case程序是否执行成功,teardown程序都将被执行。
is_element_present这个函数是用来查找页面元素是否存在,在这里用处不大,通常删除。因为判断页面元素是否
存在一般都加在testcase中.


TAG:

 

评分:0

我来说两句

Open Toolbar