Measure the code coverage of an executable shell script with kcov / shunit2

Is it possible to measure the code coverage of an executable shell script instead of a source?

I have a shell script with several switches, options. I have added some tests and want to measure the scope of the test suite.

Sources:

script.

And his tests.

As you can see, it tests.shexecutes a shell script instead of calling its functions in the same shell. Thus, I could not get kcovto measure coverage on the script. I was able to measure coverage only in the file tests.sh.

Is it possible to somehow force the kcovmain scope of the script to be measured?

This team was the best I could achieve:

/usr/local/bin/kcov --debug=31 coverage/ test/tests.sh

shunit2 tests.sh, misspell_fixer.sh. , .

+4

Source: https://habr.com/ru/post/1568223/


All Articles