How to Sort RQM Category in RPE Template ?
Hi,.
I have imported testcases into RQM, the created test case id are in random, while generating the report through rpe i m getting the random id in the report. I can able to sort the testcase according to the id and title. But in my case i want to sort according to the category field. I'm not able to do that.
I have created the category filed named "TC No." and given numbers in order. So i want to generate the report in the sequence of "TC No.". while i have searched in the internet i got an information that this can be done through Java scripting .
Any one can help me to resolve the issue by providing the javascript or any other solution to generate the test case in sequence order?
Thanks in Advance..
Regards,
Sunil
|
Accepted answer
Yes, you cannot sort on category/value (which is child attribute). You can store the testcase data (that you want to print) in an array along with feed/entry/content/testcase/category/value in an array. Perform sort on the array and then print the elements from the array. A sample RPE template will look like this:
Use the following JavaScript Code within $6:
if (term == "TC No.") {
_tcNo = value;
}
if (term == "Module") {
_module += "," + value;
}
Use the following JavaScript Code outside $6: //Store testcase data in array
if ( _tcdata == ""){
_tcdata = [];
}
var obj = new Object();
obj[ "webId"] = webId;
obj[ "title"] = title;
obj[ "tcNo"] = _tcNo;
obj[ "module"] = _module;
_tcdata.push( obj);
//reset the category values
_tcNo = "";
_module = "";
You can then perform sorting. The sort() method will use the compare function to determine the orders of elements.
After this, you can use Iteration element to print the testcases (from the array) into the Cell.
if ( _tcdata != "")
{
var obj = _tcdata[_i1];
obj["webId"]; // similarly print obj[ "title"]; / obj[ "tcNo"]; / obj["module"].replace(/(^\s,)|(,\s*$)/g, ''); in other Cells
}
sunil kumar selected this answer as the correct answer
Comments
Hi,
Thanks for your Response.
I have tried the steps but i got the blank report.
In the Iteration script :
while _i*1 < _tcdata.length;
other than this we need to add anything on the iteration script.
Regards,
Sunil
Subramanya Prasad Pilar
commented Jan 01 '21, 5:27 a.m.
_i*1 < _tcdata.length is "Do while condition" for the Iteration element. Please check if the data is stored in the array first. You can refer the sample template here. You should use https://<server>:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<projectAlias>testcase?abbreviate=false as URI for Testcase Feed data source.
Hi,
Thank you subramanya it's really worked for me.
Thanks a lot
.
I do have one more query
i m having another category named modules with values M1,M2
i need to print these module content to the generating content of the test case.
like
TC.no Module Title
TCB1001 M1 Login page
TCB1002 M2 Home Page
TCB1003 M1 Payment page
Is there any way to generate like the above one.
|
One other answer
Hi,
I have tried the script that you have shared, It was creating duplicate testcases in the report as shown below..
Here 1st Column is Test case Id.
Comments
Subramanya Prasad Pilar
commented Jan 03 '21, 8:34 a.m.
I have modified the original answer so as not to include duplicate testcases.
sunil kumar
commented Jan 04 '21, 1:26 a.m.
Hi,
Thanks For the Response..
I didn't get the Modified script. If you have updated in the same link, i m not able to acces the link as it was expired.
Regards,
Sunil
sunil kumar
commented Jan 04 '21, 11:03 a.m.
Hi,
It's was working well and fine as i want .
The issue got resolved.
Thanks for providing the solution.
Regards,
Sunil
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.