0 votes
in Python by
What is Test Discovery in Python?

1 Answer

0 votes
by
Test Discovery is the process of finding all tests present in a project folder and executing them automatically.

Test Discovery plays a vital role in automating all tests.

You can achieve it by running the below command from Project1 folder.

python -m unittest discover

discover is the option used for performing test discovery.

By default, unittest starts finding all tests from the working directory.

Conventions for Test Discovery

In order to discover all the tests in test modules, you have to follow below conventions while writing the tests.

All files containing tests must be either modules or packages. In case of packages, they must be importable from top directory of the project.

By default, test discovery always searches for modules or packages starting with test pattern in their names. test pattern is case insensitive.

By default, the test discovery always starts from working directory and it is recursive.

Related questions

0 votes
asked Jul 14, 2020 in Python by GeorgeBell
0 votes
asked Jun 30, 2020 in Python by GeorgeBell
...