Skip to content
Advertisement

Specify specific testcases in Python unit test TestLoader

I have the following folder structure.

JavaScript

Both the test files have two test cases each.

File smoke.py contains

JavaScript

The above code runs four test cases which is expected.

Is there a way to run some specific test cases from file test1.py and test2.py where I can explicitly add those testcases to the suite1 and suite 2 in the above code.

If Test1.py contains a testcase name test_system in the class Test1, how can TestLoader load that specific test case instead of running all the testcases in that module.

Advertisement

Answer

You can configure your test loader to run only tests with a certain prefix:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement