Test Results Comparator
Introduction
Test Environment allows to create structured test harnesses with parametrized test packages and scripts.
Behaviour of tests and testing results may differ for different conditions: versions of tested product, operating system or NUTs. Usually it is not an option to adapt a test to different conditions, since it will significantly complicate the test and may lead to endless updates of the tests to newly arising conditions.
However, to track regressions in the tested product and find out differences in product behaviour in different conditions, it is necessary to know which test verdicts are expected for specified version/conditions and which are not.
Testing Results Comparator (TRC) tool provides an interface to a database of the expected test results for the product. It allows to:
update the database according to obtained test results;
obtain the report with the list of unexpected results;
associate addtional information (like bug IDs) with the test record in the DB.
Tool execution
TRC is invoked automatically at the end of dispatcher.sh execution or manually with the trc.sh script located in the test suite.
In both cases it will produce report like below:
Run (total) 2616
Passed, as expected 2456
Failed, as expected 97
Passed unexpectedly 45
Failed unexpectedly 18
Aborted (no useful result) 0
New (expected result is not known) 0
Not Run (total) 13725
Skipped, as expected 0
Skipped unexpectedly 0
Result explanation
Run(total) Total number of iterations executed. Passed, as expected Number of tests which were expected to pass and passed Failed, as expected Number of tests which were expected to pass and passed Passed unexpectedly Number of tests which were not expected to pass but passed. For instance because the bug got fixed and TRC was not udpated. Or because certain SW version has a known problem. Failed unexpectedly Number of tests which were not expected to fail but failed. The usual failures Aborted Will appear if test was kiled with Ctrl-C or by a signal; tests which died of SEGFAULT signal are also considered as aborted. Not Run (total) Total number of iterations which were not executed. This one makes sence only if TRC DB contains Skipped as expected The tests were skipped as we expected. In the below example TRC is not filled properly so Not Run is not a sum of expected and unexpected counters. Skipped unexpectedly The test was expected to execute in given conditions but it did not. ==================== ==============================================================================================================================================================================
The skipped section
Runtime results comparison
If te_tester is built without (–without-trc) flag (default behaviour) then it will perform run-time results comparison.
To disable te_tester integration with TRC add
TE_APP_PARMS([tester], [--without-trc])
into builder.conf, see TE_APP_PARMS for details.
When running te_tester which was built with enabled runtime TRC support the usual output:
Starting package arp
Starting test prologue PASSED
Starting test arp_remove PASSED
Starting test arp_change PASSED
Starting test stale_entry PASSED
Starting test stale_entry FAILED
Done package arp PASSED
is replaced with:
Starting package arp
Starting test prologue pass
Starting test arp_remove PASSED?
Starting test arp_change pass
Starting test stale_entry pass
Starting test stale_entry fail
Done package arp pass
where
pass means that test expectedly passed;
PASSED? and FAILED? mean that test passed or failed but there is no expectation for it in the TRC database;
fail means that test expectedly failed.
And in the text log after test completion Tester will add Obtained and Expected resutls.
RING Tester Run 23:13:39 743 ms
Obtained result is:
FAILED
Expected results are:
PASSED
TRC Database
Syntax
TRC database is an XML file with pretty simple syntax. XSD for it can be found at doc/xsd/trc_db.xsd.
The file is usually located in the conf/ directory in the suite. You can explicitly pass the path to the database with the –db option.
Below are some examples of the syntax features.
Simple entry
<test name="mytest" type="script"> <objective>Check this freaking functionality.</objective> <iter result="PASSED"> <notes/> <arg name="env">VAR.iut_only</arg> </iter> </test>
Verdicts
Imagine that the test foobar is expected to fail because of socket creation failure. Then one can write:
<iter result="PASSED"> <arg name="arg">foobar</arg> <notes/> <results tags="mytag"> <result value="FAILED"> <verdict>Failed to create a socket, errno=EPERM</verdict> </result> </results> </iter>
Verdict is a special message which test produces during it’s execution. It can be just before failure or at the middle. It’s produced with TEST_VERDICT() call.
Keys
<iter result="PASSED"> <arg name="arg">foobar</arg> <notes/> <results tags="mytag&some_other_tag" key="OL 239"> <result value="FAILED"> <verdict>Failed to do something at certain step</verdict> </result> </results> </iter>
If during test behaviour investigation or development a bug to track the failure was created - it should be added as a ‘key’ to the TRC database result. Each project has it’s own agreement on keys syntax and semantics; from the TRC point of view it’s an arbitrary string.
Notes
<iter result="PASSED"> <arg name="arg">foobar</arg> <notes/> <results tags="mytag&some_other_tag" key="WONTFIX" notes="This is a known system behaviour"> <result value="FAILED"> <verdict>Failed to do something at certain step</verdict> </result> </results> </iter>
Notes attribute provides a way to describe the reasons or aspects of the result. This is extremely useful when you’re dealing with so-called features of the product which often have WONTFIX key. It’s also worth noting if the result is unstable.
Wildcards
TRC database supports wildcard entries. If parameter value is ommited:
<iter result="PASSED"> <arg name="sock_type"/> <results tags="linux" notes="Test fails because of a known system bug" key="WONTFIX"> <result value="FAILED"/> </results> </iter>
then the entry describes expected results for all iterations of the test with particular parameter. In the above example for all types of socket the test will fail because of a known system bug.
Database update
Todo Add information about trc_update utility.