All Failed Tests in an Execution Folder

Problem

Typically all execution plans are structured in a folder hierarchy which identifies the different areas or purposes to which the execution plans and their tests are related. The execution plans are triggered on a regular basis in a continuous integration environment, or occasionally over the release time frame, resulting in nice execution statistics – unfortunately for each single execution plan only.

However, sometimes you need an overall information to know how all your tests perform for a specific area or purpose to identify where the weaknesses are.

Solution

Use the data mart view RV_LatestTestStatus to create a report that returns a list of all failed tests for a specific execution planning hierarchy level.

The following query selects failed tests within an execution planning folder with context information like execution plan name and build name:

SELECT TestID, TestName, ExecutionPlanID, ExecutionPlanName, BuildName
FROM RV_LatestTestStatus lts
INNER JOIN TM_ExecTreePaths ON lts.ExecutionPlanID = TM_ExecTreePaths.NodeID_pk_fk
WHERE TM_ExecTreePaths.ParentNodeID_pk_fk = ${executionFolderID|2179|Execution Folder ID}
  AND StatusID = 2
ORDER BY TestName
The query does the following:
  • Uses the view RV_LatestTestStatus for retrieving the latest test run result.
  • Includes the execution tree hierarchy (TM_ExecTreePaths) to be able to query all tests from all the execution plans within the hierarchy.
  • Uses the top level folder ID from where the analysis should be started as ParentNodeID_pk_fk.
  • Includes only failed tests (StatusID = 2).

The StatusID can be looked up in the table TM_TestDefStatusNames.

The result of the SQL query are all tests in the selected execution folder for which the last run failed.
TestID TestName ExecutionPlanID ExecutionPlanName BuildName
14073 JUnitTestPackage 2184 CI Testing 352
14107 Volatile Tests 2191 Volatile Test 352