Reputation: 3
I added a coverage percentage after my auomated tests execution :
but my manager asked me how is it calculated based on the code only or the user interface ? Some websites mentioned that it's calculated based on code and black box testing ? How is that ? could someone explain to me how the test coverage via gitlab is calculated ?
PS : I'm using robot framework
Upvotes: 0
Views: 1003
Reputation: 3547
Since robot framework is python gitlab-uses the very common coverage.py: https://docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html#python-example
coverage.py computes the percentage of touched vs untouched lines for each python program file the test touches. https://coverage.readthedocs.io
But if it touches test-code you only use to test external apis/interfaces/web-pages/code not in the same repository, etc there is little point.
A solution is to use a BDD driven language like behave/cocumber/cherkin (https://pypi.org/project/behave/) to map the business logic to tests with project stakeholders.
I have used it for very complex business logic like automatic payments, subscriptions etc things that should not fail and I'm not completely sure of the logic. The project leader has written BDD schemas in simple business logic which can be translated automatically to tests.
Upvotes: 1