[Mesure Problem] Xray Test Count by Last Execution Status in Test Plan

Hi ,
I already select noempty and a single test plan but i cant get the number by status

Please Help

1 Like

Measure Script:

CASE WHEN
[Xray Test Execution Status].CurrentMember.Level.Name = “Status”
THEN --count tests by last execution status
Cache(NonZero(Count(
Filter(
–iterate throug all Tests
Descendants([Xray Test].CurrentMember, [Xray Test].[Test]),
[Measures].[Xray Tests with executions] > 0 AND
Order(
–iterate through execution statuses for a selected Test
Filter([Xray Test Execution Status].[Status].Members,
[Measures].[Xray Tests with executions] > 0),
–order statuses by execution date descending
DateParse(
Generate(
Tail(
–iterate through all dates when a Test was executed
Filter([Time].[Day].Members,
[Measures].[Xray Tests with executions] > 0
)).Item(0),
Format([Time].CurrentHierarchyMember.StartDate, ‘yyyy-mm-dd’),
“,”)),
BDESC
–name of the last execution matches status in columns
).item(0) IS [Xray Test Execution Status].CurrentMember)
)))
ELSE --total count of tests with executions
([Measures].[Xray Tests with executions],
[Xray Test Execution Status].DefaultMember)
END

no one to help ?
Is really critical

Any newwwwwwwwwwwwwwws ???

Hi @nour,

The calculation for the last execution status within the report context (selected test plan, environment, fix version, or some other criteria) is complex. It takes a lot of resources to run through all tests and execution results and compare them. Unfortunately, for more significant data amounts, this might end with a timeout.

Here is another version (a somewhat faster) of how to calculate the last execution within a selected Test Plan, Environment, or some other criteria:

    CASE WHEN
      [Xray Test Run Status].CurrentMember.Level.Name = "Status"
    THEN
      Cache(NonZero(Count(
        Filter(
          --iterate through Tests
          Descendants([Xray Test].CurrentMember, [Xray Test].[Test]),
          [Measures].[Xray Tests with executions] > 0 AND
          Order(
            --iterate through execution statuses for a selected Test
            Filter([Xray Test Run Status].[Status].Members,
              [Measures].[Xray Tests with executions] > 0),
            --order statuses by execution date descending
            [Measures].[Xray Tests executed last date],
            BDESC
            --name of the last execution matches status in columns
          ).item(0) IS [Xray Test Run Status].CurrentMember
      ))))   
    ELSE --total count of tests with executions
      ([Measures].[Xray Tests with executions],
      [Xray Test Run Status].DefaultMember)
    END

Related Community topic:

An alternative is to import the last execution status for each Test and Test Plan combination using additional data import. The structure for additional data source might look like this:

  • Test - key of each test case to map additional data to the “Xray Test” dimension. Mark advanced options “Key column” and “Skip missing”.

  • Test plan - key of the test plan to map additional data to the “Issue” dimension (“Xray Test Plan” dimension is not available for additional data import, and the workaround is to use the “Issue” dimension that also holds Test Plan issues). Mark advanced options “Key column” and “Skip missing”.

  • Test execution status - the last execution status in a test plan to map additional data to the “Xray Test Execution Status” dimension. Mark advanced options “Key column” and “Skip missing”.

  • Time - the date when the test was executed for the last time for a Test Plan to map additional data to the Time dimension. This column is optional if you use the “Time” dimension in the report.

  • Counter - number 1 to count unique test and test plan and status combinations. Import this column as a new measure “Tests by last execution status in a Test Plan.”

More details on additional data import: Additional data import into Jira Issues cube

Best,
Zane / support@eazyBI.com

Hello ,
Thanks for the new script. It takes time also but at least at the end it shows values.

But it gives me wrong values:

and xray gives me :

When i investigate , i found that for the tests added to more than one test execution .They will have many last test execution status.

For example : if a test is :
-blocked in the first test execution

  • blocked in the seconde test execution

At the end we will have 2 Blocked instead of 1.

Can we take the last execution status from the last execution status?

OR, we just use a JQL like that issue in testPlanTests(‘id_test_plan’,‘Execution_status’) in eazybi as a measure ?

For the alternative you propose , i will study the feasibility in our case but now i should give something correct to the customer

Thank so much , you really helping me :slight_smile:

NOUr

@nour,

eazyBI does not duplicate Xray built-in reports or overview fields but pulls in data on all test runs from which eazyBI users could build custom analytics and reports suited for their quality assurance processes and key performance indicators. As a result, there might be slight differences between eazyBI and Xray reports at the Requirement or Test Plan level.

I believe the biggest concern is scheduled tests is status TO DO. The new tests do not have the last execution date (as it is only scheduled). And tests that have already failed and are scheduled again might have the latest execution data for status FAIL.

With additional data import, you may import a new measure that says how many tests are in each status for each test plan (a simpler version than a suggested solution). It will work. A drawback of a simple solution, it doesn’t give more details about which tests were failing and which were passed. For this solution, you might want at least 3 columns of data:

  • Test Plan - key of the test plan to map additional data to the “Issue” dimension. Mark advanced options “Key column” and “Skip missing.”

  • Execution status - the last execution status in a test plan to map additional data to the “Xray Test Execution Status” dimension. Mark advanced options “Key column” and “Skip missing”.

  • Count of tests with status - import this column as a new “Measure”.

Best,
Zane / support@eazyBI.com

Best,

1 Like

hi,

if i want to present the last execution of certain Xray Test: Test Functionality = ‘regression’
what adjustments need to be done in the measure above ?

regards,
Tomer

Hi @Tomer,

You may adjust the given calculation and add more criteria by test issues properties to the filter part. You might want to use the expression [Xray Test].CurrentMember.Get() and autocomplete to see which properties are available for Xray Test issues.

The update code might look like this:

  Cache(NonZero(Count(
    Filter(
      --iterate through Tests
      Descendants([Xray Test].CurrentMember, [Xray Test].[Test]),
      --add filtering criteria by properties here
      [Xray Test].CurrentMember.Get('Test Functionality') = "Regression" AND
      [Measures].[Xray Tests with executions] > 0 AND
      Order(
        --iterate through execution statuses for a selected Test
        Filter([Xray Test Execution Status].[Status].Members,
          [Measures].[Xray Tests with executions] > 0),
        --order statuses by execution date descending
        [Measures].[Xray Tests executed last date],
        BDESC
        --name of the last execution matches status in columns
      ).item(0) IS [Xray Test Run Status].CurrentMember
  )))) 

Note the condition CASE WHEN is removed as property value could be verified at individual test level.

Best,
Zane / support@eazyBI.com