Get the total users executed XRay tests per day to find execution productivity

Hi,

I am trying to create a KPI measure for Xray Test Execution productivity, which has to be from a formula like number of tests executed per user per day. For this, i could count of users as below,

I used Calculated measure,

NonZero(Count(
  Filter(
    DescendantsSet([Xray Test Executed by].CurrentMember,[Xray Test Executed by].[User]),
    --related to time dimension by issue resolution date
    
     [Measures].[Xray Tests executed] > 0 AND
     [Xray Test Run Status].CurrentMember.Name = 'PASS'

)))

and similar one for FAIL TCs. But i am not able to get a total of PASS and FAIL to have unique user names across. Also, from this total value i have to divide Xray tests executed as per Time dimension like per day. I am not getting how to get the total number of users across Pass and Fail (only these two), and divide it by total xray tests.
I am looking for something like this as a result.

|Time|Number of Users|Number of Tests Executed|Productivity||
|Mar-23|5|21|3.75| <–Average of below two per day values
|15-Mar|5|10|2|
|16-Mar|2|11|5.5|

1 Like

Hi @DarshanK,

You have the right idea of building calculated measures to count users that executed tests. Here are a few improvements you might want to make.

  1. Update calculations for “Number of Users Pass/Fail Tests” and use a tuple to check on test run results. The expression for “Number of Users Pass Tests” might look like this.

    NonZero(Count(
      Filter(
        DescendantsSet([Xray Test Executed by].CurrentMember,[Xray Test Executed by].[User]),
        --has completed tests as PASS
        ([Measures].[Xray Tests executed],
        [Xray Test Run Status].[PASS])  > 0
    )))
    
  2. To get a count of unique users for several execution statuses, you might want to update filter criteria and specify that the user completed at least one test as PASS or as FAIL. Again, use a tuple expression to check each test run status.

    NonZero(Count(
      Filter(
        DescendantsSet([Xray Test Executed by].CurrentMember,[Xray Test Executed by].[User]),
         ( 
          --at least one test is PASS
          ([Measures].[Xray Tests executed],
          [Xray Test Run Status].[PASS]) 
          + 
          --or at least one test is FAIL
          ([Measures].[Xray Tests executed],
          [Xray Test Run Status].[FAIL]) 
        ) > 0
    )))
    
  3. Now, you can get the average number of PASS and FAIL tests per user daily. Advance the calculation even further like this:

    --total of PASS and FAIL tests per day
    ([Measures].[Xray Tests executed],
    [Xray Test Run Status].[PASS]) 
    + 
    ([Measures].[Xray Tests executed],
    [Xray Test Run Status].[FAIL]) 
    --divided by user count
    /
    NonZero(Count(
      Filter(
        DescendantsSet([Xray Test Executed by].CurrentMember,[Xray Test Executed by].[User]),
         ( 
          --at least one test is PASS
          ([Measures].[Xray Tests executed],
          [Xray Test Run Status].[PASS]) 
          + 
          --or at least one test is FAIL
          ([Measures].[Xray Tests executed],
          [Xray Test Run Status].[FAIL]) 
        ) > 0
    )))
    

All calculations use a tuple of measure “Xray Tests executed” and dimension “Xray Test Run Status” to get the count of tests in a particular status. Please see the documentation for more details on tuples: Tuple.

Best,
Zane / support@eazyBI.com

1 Like

Hi @zane.baranovska ,

in my case I had this first query, taken for from you in issue below:
Xray Test plan execution status - Questions & Answers - eazyBI Community

-- annotations. Group=Xray User defined
CASE WHEN
  [Xray Test Run 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 Run 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 Run Status].CurrentMember)
  )))  
ELSE --total count of tests with executions
  ([Measures].[Xray Tests with executions],
  [Xray Test Run Status].DefaultMember)
END

And your query from this post:

NonZero(Count(
  Filter(
    DescendantsSet([Xray Test Executed by].CurrentMember,[Xray Test Executed by].[User]),
    --has completed tests as PASS
    ([Measures].[Xray Tests executed],
    [Xray Test Run Status].[PASS])  > 0
)))

I would like to merge the second query in the first query, and retrieve the PASS count only in the first query, could you please support me on this I struggling on it?

This is needed to split the first measure into six measures (PASS, FAIL, TODO, ABORTED, EXECUTING, BLOCKED) to resolve the time out issue when we use the dimension “Xray Test Run Status” in columns (This dimension is causing a performance problem in the same time I couldn’t find a substitue for it only I found the dimension “TestRunStatus” that doesn’t cause a performance but it gives wrong values for us it gives an increment of the execution not the last execution count only as we need and like the other dimension mentioned before).

Thank you,
Seif