我在你登录的网站上,然后搜索课程,点击课程,然后登陆信用卡页面,因为它只有一个课程并且很常见,我只是想在CC部分运行DDT不是搜索部分这就是我所做的 1.登录是通过conftest.py中的conftest进行的。
@pytest.yield_fixture(scope="class")
def oneTimeSetUp(request, browser):
print("Running one time setUp")
wdf = WebDriverFactory(browser)
driver = wdf.getWebDriverInstance()
lp = LoginPage(driver)
lp.login("test@fake.com", "xxyyzz")
2.在测试页面上,这就是我的代码的样子
@pytest.mark.usefixtures("oneTimeSetUp","setUp")
@ddt
class SendformTest(unittest.TestCase):
@pytest.fixture(autouse=True)
def classSetup(self,oneTimeSetUp):
self.sf = SendForms(self.driver)
self.ts = TestStatus(self.driver)
def setUp(self): ############ I want this method to run just once after login, this method searches for course and then clicks and land on cc page
self.sf.navigateToCCForms("img")
'
@pytest.mark.run(order = 1)
@data(*getCSVData("testRegular.csv"))
@unpack
def test_cc_Form(self,ccNum, ccExp, ccCVV):
result = self.sf.verifyOnCCforms()
self.ts.mark(result,"On Send Form Page")
self.sf.ccdetails(ccNum, ccExp, ccCVV)
result1 = self.sf.sentSuccessMsg()
self.ts.markFinal("test_sending_Form", result1, "this is test")
现在这个运行一次很好然后只是坐在那里,它不会在CC页面上多次输入数据。 谢谢