I am trying to parametrize my tests like below
@pytest.mark.parametrize("a,b", test_data)
class TestClass():
def test_A(self,a,b):
# Some Code ..
pass
def test_B(self,a,b):
# Some Code ..
pass
def test_C(self,a,b):
# Some Code ..
pass
I want my test to be executed in Sequential order like test steps, e.g
test_A
test_B
test_C
test_A
test_B
test_C
....
The order in which they are getting executed is
test_A
test_A
...
test_B
test_B
...
test_C
test_C
The other option I have tried is by putting my tests in for loop like below
for data in test_data:
a,b = data
def test_A(a,b):
# Some Code ..
pass
def test_B(a,b):
# Some Code ..
pass
def test_C(a,b):
# Some Code ..
pass
This give me the desired order but test names remains same in all the iteration so it creates problem in reporting.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…