-
Notifications
You must be signed in to change notification settings - Fork 29
Code Coverage
With version 2.0.0 of the Conformance Tools we introduced the required functionality for deriving the code coverage for a whole set of testvectors.
The starting point for deriving the code coverage for one or multiple test vectors is phpunit.functional-coverage.xml
in the root folder of the project. It defines the required parameters for running phpunit
with code coverage support.
The Conformance tools ship with predefined configurations for deriving the code coverage of the DASH-IF and CTA-WAVE database. The target test folder can be specified in the <testsuites>
field. In the example below it links to the CTA-WAVE folder:
<testsuites>
<testsuite name="default">
<directory>functional-tests/cta</directory>
</testsuite>
</testsuites>
The code coverage results are written to a target folder in xml
and html
format. The target folders can be defined in the <report>
element:
<report>
<html outputDirectory="functional-test-results/html-reports-functional-tests" lowUpperBound="50" highLowerBound="90"/>
<xml outputDirectory="functional-test-results/xml-reports-functional-tests" lowUpperBound="50" highLowerBound="90"/>
</report>
The functionalTest.php
file is the entry point for the test suite. It defines a function streamProvider()
that reads and parses JSON representation of the respective testvector database and supports blacklisting of specific testvectors. The testThis()
function uses the output of the streamProvider()
function and performs the conformance validation for each of the provided test vectors.
The JSON file that the streamProvider()
function uses can be defined directly in the function itself:
$content = file_get_contents("functional-tests/cta/wave.json");
The code coverage script can be executed directly from the terminal:
/bin/php phpunit --configuration phpunit.functional-coverage.xml
By default, the output files are located in the functional-test-results
folder. The html
output should look the following: