pytest execution cases: obviously wrote only five test cases, how to collect 33! ?

pytest order to collect test cases:

The same project search function tests all files that start with test_ test, test test_ beginning of class, the beginning of the test_

The execution order of test cases:

In accordance with the first data (0 to 9) "then the letter (a ~ z) rules (test functions are English test at the beginning, you want to specify which particular can test_1, so easy to debug, generally do not write, ha ha ha)

Implementation of test cases found:

Two test classes, write five test functions, according to their own thinking should be expected to collect five test cases; As a result, the implementation of a collection to 33, and the remaining 28 come from? ?

Solve the problem:

1, check the recently modified pre-conditions, no problem

2, view the test reports, we found the same test carried out more than once, then went to test this function to find the problem

3, the final positioning is due to the use pytest Parameters of the error results in an entire data, respectively, the 28 data taken separately]

solution:

Remove parameterization, direct access to data, running the correct number of test cases collected up.

 

to sum up:

Collected from the test case, there is more than the number of projects related to the function test, the same test with a need to use several sets of test data related; for example: a login function test, a total of three groups of array is collected is the number of test cases 3 more

 

Guess you like

Origin www.cnblogs.com/cuitang/p/11413692.html