【发布时间】:2011-07-15 03:00:55
【问题描述】:
我必须测试几个销售相同商品的网站,但他们有另一个模板。
所以我想运行每个 MainTestClass 并提供一些输入参数,比如说:
java -jar SeleniumServerStandalone-2.0b2.jar -port 5555 (template_id=5)
有可能吗?
class MainTestCases(unittest.TestCase):
def setUp(self):
#self.template_id=template_id I want something like that
self.verificationErrors = []
self.selenium = selenium("localhost", 5555, "*chrome", "http://www.google.com/")
time.sleep(5)
self.selenium.start()
def test_test1(self):
if self.template_id==1:
...
elif self.template_id==2:
...
def test_test2(self):
if self.template_id==1:
...
elif self.template_id==2:
...
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
【问题讨论】:
-
我没有在 Python 上工作过,但你可以使用 TestNG 中提供的数据提供者之类的东西 - testng.org/doc/documentation-main.html#parameters-dataproviders
标签: python selenium selenium-rc testcase