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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to get last test results on test case .

YW_10142311
5-Regular Member

How to get last test results on test case .

How can we get last test results in test case via api or compute fields?
ACCEPTED SOLUTION

Accepted Solutions

@alfonso_c Thank you so much.

This is very helpful. We want show the Last Run Result in Test Case Tracker , Due to your inspiration we add a custom Text field with 

   first(1,downstreamReferences(this).trackerTypes("testrun").{item| item.resolutions[0].name})  formula and it works!

juwang_0-1715752531454.png

 

View solution in original post

3 REPLIES 3
alfonso_c
14-Alexandrite
(To:YW_10142311)

Hi, @YW_10142311 , I assume this is related to a Test Run. If so, to which part do you refer, is it the below?

alfonso_c_1-1715323236415.png

alfonso_c
14-Alexandrite
(To:alfonso_c)

@YW_10142311, you gave "Kudos" to my previous question, so I assume you are indeed interested in getting that field with REST API or computation.

 

To get the Test Result of a Test Case's Test Run, you can chain 2 REST API calls:

 

1) Assuming the Main Test Run has ID 2094 as in my screenshot above, get its child items with GET /v3/items/2094/children:

{
  "page": 1,
  "pageSize": 25,
  "total": 1,
  "itemRefs": [
    {
      "id": 2095,
      "name": "Run of tc1",
      "type": "TrackerItemReference"
    }
  ]
}

 

2) Once you have the child item ID (2095), you can query its fields with GET /v3/items/2095/fields, the JSON will contain a part about the result:

    {
      "fieldId": 15,
      "name": "Result",
      "values": [
        {
          "id": 1,
          "name": "Passed",
          "type": "ChoiceOptionReference"
        }
      ],
      "sharedFieldNames": [],
      "type": "ChoiceFieldValue"
    }

 

With computation, you can e.g. add a custom Text field with the resolutions[0].name formula:

alfonso_c_1-1715667167091.png

 

alfonso_c_0-1715667127011.png

 

Does this help you?

@alfonso_c Thank you so much.

This is very helpful. We want show the Last Run Result in Test Case Tracker , Due to your inspiration we add a custom Text field with 

   first(1,downstreamReferences(this).trackerTypes("testrun").{item| item.resolutions[0].name})  formula and it works!

juwang_0-1715752531454.png

 

Announcements



Top Tags