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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

<%begintestresultdetail%> is not returning test result items

srahamedhulla
7-Bedrock

<%begintestresultdetail%> is not returning test result items

Hi,

I am new to the integrity and could you please suggest what went wrong in my code.

Test Plan

     |--- Test Objective

               |--- Test Sessions

                       |--- Test Results

I have written a html code to retrieve Test Objectives details and also I am able to retrieve Active Test Sessions and Completed Test Sessions. I am stuck-up at getting Test Results from "Active Test Sessions" and "Completed Test Sessions"

<%beginrelationshipsdetailL2 Active Test Sessions%>

  <%begintestresultdetail%>

  <%iteratetestresultitemfields%>

  <&testresultitemdisplayname

  &testresultitemfieldname

  <%/iteratetestresultitemfields%>

  <%endtestresultdetail%>

  <%endrelationshipsdetailL2%>

I have tried lot of combinations.

I am able to get the "Test Result" from "Test Sessions" Report(Report run for Test Session").

But somehow I am not able to get it from "Test Plan".

Could you please help me to achieve this?

Thanks,

Sithik

3 REPLIES 3

Hello Sithik Rahamedhulla‌,

Test Results are tied to a combination of a Test Session and a Test Document (e.g. a Test Suite or a Test Group--the "Test" segment document types).  This is because the same tests can be run multiple times from a given segment.  Each time it is run, it is run in a different test session.

Test Plans have no direct relationship to a Test Result, so you can't unambiguously get Test Results from a Test Plan.

Given the difference between Test Plans and Test Results, I wouldn't expect any useful Test Results output from a Test Session report run against a Test Plan item.

Regards,
Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager

Hi Kael,

I am not saying "Test plan" will have direct relationship with "Test Result".

Test Plan will have relationship with Test Objectives and Test Objectives will have relationship with "Test Session" from Test session we can get the test result.

Finally I have written the code for my requirement

<%beginrelationshipsdetailL2 Completed Test Sessions%>

  <tr><td width="100%" colspan="2" style="display:none;"><%RelationshipL2 Tests As Of Date%></td></tr>

  <%beginrelationshipsdetailL3 Query[(walktestsession[<%RelationshipL2 ID%>])]%>

  <script>

  if(!testSessionIds.contains("<%RelationshipL3 ID%>"))

  {

  testSessionIds[testSessionInd++]="<%RelationshipL3 ID%>";

  testCaseDupl=0;

  }

  else

  {

  testCaseDupl=1;

  }

  </script>

  <%begintestresultdetailL3%>

  <script>

  count=0;

  if(testCaseDupl==0)

  {

  for(var k=0;k<testSessionsDetails.length;k++)

  {

  if("<%testresult Session ID%>".match(testSessionsDetails[k]))

  {

  count=1;

  }

  }

  if(count==1)

  {

  testSessionDetails[testSessDeIndex++]="<%testresult Session ID%>";

  testSessionDetails[testSessDeIndex++]="<%testresult Test ID%>";

  testSessionDetails[testSessDeIndex++]="<%testresult Verdict%>";

  }

  }

  var relatedCount=0;

  </script>

  <%begintestresultitemdetailL3%>

  <script>

  if(count==1 )

  {

  if(relatedCount==0&&!((typeof "<%testresultitem ID%>").match("undefined"))&&("<%testresultitem Type%>".match("Defect")))

  {

  testSessionDetails[testSessDeIndex]="<%testresultitem ID%>";

  relatedCount++;

  noDefect=1;

  }

  else if(!((typeof "<%testresultitem ID%>").match("undefined"))&&("<%testresultitem Type%>".match("Defect")))

  {

  testSessionDetails[testSessDeIndex]=testSessionDetails[testSessDeIndex]+",<%testresultitem ID%>";

  noDefect=1;

  }

  }

  </script>

  <%endtestresultitemdetailL3%>

  <script>

  if(count==1)

  {

  if(noDefect==0)

  {

  testSessionDetails[testSessDeIndex]="No Defect Logged";

  ++testSessDeIndex;

  }

  else{

  ++testSessDeIndex;

  }

  }

  noDefect=0;

  </script>

  <%endtestresultdetailL3%>

  <script>

  if(testSessionDetails.length>2)

  {

  if(testSessionDetails[testSessionDetails.length-2]=="Failed" && testSessionDetails.length>0)

  {

  var defectArr=new Array();

  if(!testSessionDetails[testSessionDetails.length-1].match("No Defect Logged"))

  {

  defectArr=testSessionDetails[testSessionDetails.length-1].split(",");

  defectCount=defectCount+defectArr.length;

  }

  document.write("<tr><td>"+testSessionDetails[testSessionDetails.length-4]+"</td>");

  document.write("<td><a href='<%integrityurl%>im/viewissue?selection="+testSessionDetails[testSessionDetails.length-3]+"'>"+testSessionDetails[testSessionDetails.length-3]+"</a></td>");

  document.write("<td style='background-color:#d699ad'>"+testSessionDetails[testSessionDetails.length-2]+"</td>");

  document.write("<td>"+testSessionDetails[testSessionDetails.length-1]+"</td></tr>");

  }

  }

  testSessionDetails.length=0;

  testSessDeIndex=0;

  </script>

  <%endrelationshipsdetailL3%>

  <%endrelationshipsdetailL2%>

Thanks,

Sithik

Hello Sithik Rahamedhulla‌,

Sure.  What I was trying to say was that the relationship between a Test Plan and a Test Session is 1:N, so how are you going to specify which Test Session to use for the Test Results in your report?  It works with a Test Session, because the Test Results to be obtained are unambiguous.

-Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
Announcements


Top Tags