Currently, Clarity only supports running all test suites at once. However, it would be useful to be able to run a single test suite or a single test case from the command line.
Expected Behavior
Users should be able to specify a single test suite or a single test case to run from the command line. For example, the following command should run the my_suite
test suite:
And the following command should run the my_test
test case within the my_suite
test suite:
./out --suite my_suite --case my_test
Proposed Solution
To implement this feature, we will add support for specifying a test suite or a test case as a command line argument. If a test suite is specified, we will run all the tests in that suite. If a test case is specified, we will only run that test case.
To specify a test suite or a test case, users can provide the name of the suite or case as a command line argument. To avoid conflicts with other command line arguments, we will use a special syntax for specifying test suites and test cases. Here are the proposed syntaxes:
- To specify a test suite:
-s <suite_name> or --suite <suite_name>
- To specify a test case:
-c <case_name> or --case <case_name>
If no suite or case is specified, we will run all test suites as usual.
Additional Notes
- If a suite or case is specified and it is not found, Clarity should print an error message and exit.
- If both a suite and a case are specified, we will ignore the case and only run the suite.
- If a case is specified, but not the suite it belongs to, Clarity should search for the suite that contains the case and run only that suite with the specified case. If there is a conflict, ie. two suites have a test case with the exact same name, both will be run.
- We should add support for these new options to the Clarity documentation and help message.