I'm using pytest for this test I am doing.
I want to do the same test multiple of times, while altering the seed input. This randomises the test variables, which i thought was a good idea. That way, if the test fails, i can easily recreate the same test in a different environment to see what failed, using the same seed input:
def test_foo():
for i in range(0, 10):
foo = random_foo('something', seed = i)
assert subject_value(foo) == expected_value(foo)
However, if the test fails, Pytest won't tell me the value of i
for when the AssertionError occurred, which makes debugging close to impossible. Any way to successfully do this? Or is this bad test code structuring, which in that case, any better methods?
Aucun commentaire:
Enregistrer un commentaire