UnitTesting icon indicating copy to clipboard operation
UnitTesting copied to clipboard

How to run selected tests?

Open evandrocoan opened this issue 7 years ago • 3 comments

For example:

.
|__ tests/
    |___a_tests.py
    |___b_tests.py

a_tests.py

class Tests():
     def test_a_test():
          print("a")

     def test_b_test():
          print("b")

b_tests.py

class Tests():
     def test_c_test():
          print("a")

     def test_d_test():
          print("b")

Can I set a setting like:

{
    "tests_dir" : "package_manager",
    "pattern" : "*tests.py",
    "async": false,
    "deferred": true,
    "verbosity": 1,
    "capture_console": false,
    "reload_package_on_testing": true,
    "show_reload_progress": true,
    "output": null,
    "selected_test": 
    [
         "test_b_test",
         "test_c_test",
    ]
}

If selected_tests is empty or non existent, then all tests are run. Otherwise, only the listed tests are run.

evandrocoan avatar Jan 06 '18 10:01 evandrocoan

There are no options to run only a specific testcase or specific test in a testcase, but here is a#n option to run only a selected file.

randy3k avatar Jan 06 '18 12:01 randy3k

This option would be setting the "pattern" : "test*.py", to the path of the desired file?

evandrocoan avatar Jan 06 '18 15:01 evandrocoan

Yap, you could use that option or the command UnitTesting: Test Current File.

randy3k avatar Jan 06 '18 16:01 randy3k