The code coverage tool Squish Coco does not only work with unit tests. It can also be used to analyze the coverage of GUI tests. It's easily possible to run tools alongside each other. That will give the C/C++ code coverage of the whole test suite. A more in-depth analysis will be possible when correlating each test case (and its results) with the respective coverage information. Especially since Squish Coco features the comparisons of individual executions including the calculation of an optimal order.
The approach depicted below is based on the possibility to apply information about the name, the result and a free-form comment to each execution (stored in a *.csexe files). See the documentation section Execution Comment, Name And Status for more details.
- First we'll initialize the execution data with the name of the Squish test case that is being run:
- Insert the main test script at this point
- After the main test script we'll log the result of the test for the coverage tool:
When you execute scripts containing these steps, the Squish Coco Execution Report loads with the test case name, status and execution summary in the execution details and comments.
- Create a file called squishCocoLogging.js in Test Suite Resources with the following functions:
- Add the following function calls after startApplication() in the main test script:
- At the end of your script, after closing the AUT (for example with steps clicking File > Exit), call the following function:
- In the event your AUT closes unexpectedly, or a script error occurs, incorporating a try, catch, finally ensures your results still output to the Coco report file
Your main test script should appear similar to the following: