Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Count NA-PASSED test steps using Jira Automation (Xray API)

Naresh Sampath
December 22, 2025

I am using a Jira Cloud Automation rule with Send web request to call the Xray GraphQL API getTestRunById, and the response is returned correctly.

I have added new Test Step statuses in Xray:

  • NA-PASSED

  • NORUN

  • PASSWSCRIPTERROR

I want to count how many test steps have the status NA-PASSED.

I created a variable using this smart value:
{{#webResponse.body.data.getTestRunById.steps}}
{{#if(equals(status.name, "NA-PASSED"))}}
{{status.name}}
{{/}}
{{/webResponse.body.data.getTestRunById.steps}}

The log output shows:
NA-PASSED NA-PASSED NA-PASSED NA-PASSED

Instead of listing the values, I need the count (for example: 4).
Using size did not work.

How can I get the count of NA-PASSED test steps using Jira Automation smart values?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 22, 2025

Hi @Naresh Sampath 

When using conditional, list filtering this way, you may combine it with a math expression to get the result needed.  For example:

{{#=}}
0
{{#myList}}
{{#if(myCondition)}}
+ 1
{{/}}
{{/}}
{{/}}

There is a 0 at the front for a default and each found value adds a + 1.  When you want to sum another field, replace the 1 with that smart value.

 

For your scenario, please try this:

{{#=}}
0
{{#webResponse.body.data.getTestRunById.steps}}

{{#if(equals(status.name, "NA-PASSED"))}}
+ 1
{{/}}
{{/}}
{{/}}

 

Another way to do this for your existing result is to split() or match() on the text string and then use the list size function:

{{varMyVariableText.split(" ").trim.size|0}}

 

Kind regards,
Bill

Naresh Sampath
December 23, 2025

Hi @Bill Sheboy 

Thanks, Now I can get Count of NA-PASSED ):

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 24, 2025

Hi @Naresh Sampath 

I am confused by your follow-up question as I already described how to find the count for the "NA-PASSED" test steps.

Did you mean some other status?  If so, just change the value in the filter.

Naresh Sampath
January 27, 2026

Hi @Bill Sheboy 

When I try to Check Count of Approved Status
{{#webResponse.body.data.getTestPlan.tests.results}} {{#if(equals(jira.status.name, "Approved"))}} {{jira.status.name}} {{/}} {{/webResponse.body.data.getTestPlan.tests.results}}

It shows - Approved Approved

As per Your Suggestion, I change the Content and log it shows empty

{{#=}}
0
{{#webResponse.body.data.getTestPlan.tests.results}}

{{#if(equals(jira.status.name, "Approved"))}}
+ 1
{{/}}
{{/}}
{{/}}

Could you please help me out to solve this??

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 27, 2026

Hi @Naresh Sampath 

That expression should only show a number, not the text "Approved".  Thus, something else is outputting that value.

Please post the following for more context to help diagnose this symptom:

  • an image of your complete rule in one single image for continuity
  • an image of the rule action where you are using that smart value expression
  • an image of the audit log details showing the rule execution

Thanks!

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events