XRay Test Type progression on a timeline

We have xray tests that are initially created as manual tests (and sometimes as automated tests) using “Test Type” field in Test.
We are trying to build a report that shows how many types of tests were present each day on a timeline view to show that we are incrementally automating our tests, and that automated test types are increasing and manual test types are decreasing.
Can you please help?

1 Like

Following up to see if there is a solution to see how many tests are present each day (not created that day) against a timeline grouped by test type.

Hi @cidoni,

Test Type is an issue custom field created and maintained by the Xray app and imported in eazyBI as Xray specific dimension “Xray Test Type”.

On Jira Cloud, the eazyBI does not see the issue changelog from the “Xray History” tab. I added this use case to the eazyBI backlog for further consideration.

The situation is slightly different and more hopeful on the Jira Data Center, and eazyBI can still access the change history of the “Test Type” field. The challenge is that there are no Xray specific measures that could represent the “Xray Test Type” changes in reports.

Here is a workaround for Jira Data Center. :warning: It won’t work on Jira Cloud.

  1. Enable change history import for field “Test Type” (Import issue change history).
    The eazyBI advanced settings might look like below. Here and further in my example, the custom field ID for the Test Type is 10700. Please update it to match your Jira settings.

    [jira.customfield_10700]
    separate_table = true
    changes = true
    

    When parameters are added, perform double data import for the field “Test Type”. For the first import, deselect the field; On the second import, select all three options (dimension, property, and value change) to import it as dimension, property, and value changes.

  2. Now, you can create JavaScript-calculated measure that would check the issue change history and count how many times there were changes for the Test Type field. This JavaScript calcauted field should be defined in eazyBI Advanced settings (JavaScript calculated custom fields).

    JavaScript calcauted field for advanced settings

    In my example, the custom field ID for the Test Type is 10700. Please update it to match your Jira settings.

    [jira.customfield_10700_from]
    name = "TestTypeFrom"
    data_type = "string"
    dimension = true
    separate_table = true
    
    [jira.customfield_10700_to]
    name = "TestTypeTo"
    data_type = "string"
    dimension = true
    separate_table = true
    
    [jira.customfield_10700_change]
    name = "Test Type changes" 
    data_type = "integer"
    measure = true
    multiple_dimensions = ["Time","TestTypeFrom","TestTypeTo"]
    javascript_code = '''
    //perform code only for Test issues
    if (issue.fields.issuetype.name == "Test") {
      var changedate = null;
      var testtypeto = null;
      var testtypefrom = null;
      var changes = [];
    
      //get field changes from change history
      issue.changelog.histories.forEach(function(history){
        history.items.forEach(function(historyItem){
          if (historyItem.field == "Test Type") {
            testtypeto = historyItem.toString;
            testtypefrom = historyItem.fromString;
            changedate = history.created;
            changes.push(changedate.substr(0,10)+","+testtypefrom+","+testtypeto+","+1);
          }
        })
      });
    
      //find initial test type value on issue creation
      if (changes.length > 0) {
        // Access the first record from the changes array
        var firstChangeParts = changes[0].split(",");
        var firstchangedate = issue.fields.created;
        var firsttesttypefrom = null;
        var firsttesttypeto = firstChangeParts[1];
        changes.push(firstchangedate.substr(0,10)+","+firsttesttypefrom+","+firsttesttypeto+","+1);
      }
    
      //if no changes then get current test type value and creation date
      else {
        if (issue.fields.customfield_10700) {
          changes.push(issue.fields.created.substr(0,10)+",none,"+issue.fields.customfield_10700.value+","+1);
        }
      }
      
      //print out result array of inital and changesd value
      if (changes) {
        //get the array of changelogs and comments
        issue.fields.customfield_10700_change = changes.join("\n");
      }
    }
    '''
    
  3. Go to import options, tab Custom fields, and select three custom fields for data import:

    • measure “Test Type changes” for data import as measure and property to see all transitions fro field “Test Type”
    • dimension “TestTypeFrom” for data import as dimension and property to see test type values issue moved from. This dimension is needed for further calculations.
    • dimension “TestTypeTo” for data import as dimension and property to see test type values issue moved to. This dimension will be used in further calculations and in the report for data representation.
  4. Now you can build a report from newly imported fields to see test type progression on a timeline.

  5. “Test Type changes” shows individual transitions. To see the progression on the timeline, define a new calculated measure in Measures. The logic for the calculation would be similar to the “Issue history” measure; I will name it “Test Type history”.

    --an accumulated value of all transitions to selected test type
    Sum(
      {PreviousPeriods([Time].CurrentHierarchyMember),[Time].CurrentHierarchyMember}, 
      ([Measures].[Test Type changes],
      [TestTypeTo].CurrentHierarchyMember,
      [TestTypeFrom].DefaultMember)
    )
    -
    --subtract an accumulated value of all transitions from the selected test type
    Sum(
      {PreviousPeriods([Time].CurrentHierarchyMember),[Time].CurrentHierarchyMember}, 
      ([Measures].[Test Type changes],
      [TestTypeFrom].[TestTypeFrom].GetMemberByKey(
          [TestTypeTo].CurrentHierarchyMember.KEY),
      [TestTypeTo].DefaultMember)
    )
    
  6. On report rows, set the “Time” dimension to represent the timeline. On columns, select new calculated measure “Test Type history” and dimension “TestTypeTo”.
    The report might look like this:

Best,
Zane / support@eazyBI.com

1 Like