Closed DiFerMa closed 1 month ago
We could reproduce the issue, but currently it is not a bug. It works as designed. The current solution is to call lobster-python
only on directories which do not contain tests.
However, we can talk about improving the behavior, and make it more intuitive. In general, we want to support the following scenarios:
test
(example: test_user_input
could be a function that validates some user input, and is not a unit test)This scenario is simple and currently supported. No switch case is needed, since unit tests don't exist.
The assumption is that, all tests functions start with test
, and hence can be identified through their names. Utility functions used by the unit tests are ignored, unless they start with test
as well.
--activity
flag has been introduced for exactly this use case to extract the test cases.lobster-codebeamer
must be executed twice, once for tests and once for production code, and it is necessary to clearly separate code and tests into different folders.test
in function namesThis is the same as "Only Code". It is supported as long as no unit tests exist.
A possible update shall
So a possible feature could be to add a new argument called --implementation-only
which ignores every function that starts with test
.
I used lobster-demo to test, I added to
software.py
:I then in root folder created a
unittests.py
:Current html report's output with these commands:
lobster-python . --out="python.lobster"
andlobster-python . --out="unittests.lobster" --activity
. This makes that the two test functions inunittests.py
count as "code" making a total of four.If file is specified, then it works better. The html report's output with these commands:
lobster-python software.py --out="python.lobster"
andlobster-python . --out="unittests.lobster" --activity
looks as it should, with correct number of functions:For documentation purposes I will paste also the contents of the other configuration files:
lobster.config
main.rsl
main.trlc
lobster-trlc.conf