我正在尝试使用pytest-repeat多次运行pytest方法,但我收到警告并且只运行一次
from page.to_run_login import RegisterLogin
from utilites.testStatus import TestStatus
import unittest
import pytest
@pytest.mark.usefixture("oneTimeSetUp","setUp")
class RegisterTest(unittest.TestCase):
@pytest.fixture(autouse=True)
def classSetup(self,oneTimeSetUp):
self.rg = RegisterLogin(self.driver)
self.ts = TestStatus(self.driver)
@pytest.mark.run(order=1)
def test_registerLink(self):
self.rg.register()
self.rg.select_state_name()
self.rg.select_city_name()
self.rg.select_ready_wait()
self.rg.select_ready_pay()
self.rg.select_submit()
在终端我正在使用此命令执行py.test -s -v test / to_test_login.py --count 2
答案 0 :(得分:0)
@pytest.mark.run(order=1)
def test_registerLink(self):
for i in range(100):
self.rg.register()
self.rg.select_state_name()
self.rg.select_city_name()
self.rg.select_ready_wait()
self.rg.select_ready_pay()
self.rg.select_submit()
self.rg.driver.back()
self.rg.driver.refresh()
我能够通过这样做来解决它