Forum Discussion

shanepark's avatar
Frequent Visitor
2 years ago

Zephyr Squad API executeSearch returning incorrect results with zqlquery or filterID attributes set

I have been using the Zephyr squad API to return test execution results for reporting test executes accumulative rates over time instead of using the export CSV and importing the data into Excel. this appears to work correctly until I started comparing the numbers of results being returned when making the rest API call.

The execution query is for filterid=197 is the following which returns 4266 test executions, the api rest request, executeserach?zqlquery= is also shown below


  • project = SSH AND FixVersion in (SIT-PI-DROP-1,SIT-PI-DROP-2,SIT-PI-DROP-3,SIT-PI-DROP-4, SIT-A-DROP-1, SIT-A-DROP-2, SIT-A-DROP-3, SIT-A-DROP-4, SIT-C-DROP-1, SIT-C-DROP-2, SIT-C-DROP-3, SIT-C-DROP-4, SIT-C-DROP-5) and executionStatus not in ("NOT APPLICABLE") 
  • zql/executeSearch?zqlQuery=project%20=%20"SRD"%20AND%20fixVersion%20in%20(%20SIT-A-DROP-4,%20SIT-A-DROP-3,%20SIT-A-DROP-2,%20SIT-A-DROP-1,%20SIT-PI-DROP-1,SIT-PI-DROP-2,%20SIT-PI-DROP-3,%20SIT-PI-DROP-4,%20SIT-C-DROP-1,%20SIT-C-DROP-2,%20SIT-C-DROP-3,%20SIT-C-DROP-4,%20SIT-C-DROP-5)%20%20and%20executionstatus%20not%20in%20("NOT%20APPLICABLE")&os_authType=cookie&maxRecords=1000


Here as the issues I'm getting when using the API rest end points executesearch?zqlquery= and executesearch?zqlquery=&filterid=197, which I have no explanation:

  • Using the filterid=197 (or similar filter ID value) returned incorrect number of results compared to when running the execution query in the browser and on further investigation it contains completely the wrong fixversions in the results. The same query in the browser when exported contained all the correct fixversions
  • when requesting a maxRecord value of 1000 I would frequently get 922 but the totalcount value in the returned JSON would be in the thousands e.g. 2467 and it didn't match the the total record count displayed in the browser when yo ran the same Test Execution query

I run a pivot table across the results from the Rest API request and that produced by the Export->CSV for the same query in the Manage Test Executions


The results from the Export Test Execution Filter from the Browser

Grand Total5611353827122394180

The results from the executesearch?zqlquery=

Grand Total6111373888136434266


my code iterates through multiple request with a maxRecord=1000 per request. I use the offset the work through the entire record set until the number of records returned is equal to the totalcount value returned by the first request JSON and each subsequent request. The total number of records received is determined by 

count of the number of executions in the "executions" array object. when the accumulated responses for execution objects = totalcount, no further requests are made. 


The logic works fine, but the results returned are wrong.

The results are so wrong when using the filterid= attribute, I don't use it.

The zqlQuery= attribute always returns results but these frequently don't match the record numbers for the same query executed in the Manage test Executions



Can anyone give me pointers on why I getting incorrect results and how I can fix it to be consistent in it's behaviour?

No RepliesBe the first to reply