Jazz Register Log in
Jazz Forum Welcome to the Jazz Community Forum

Welcome to the Jazz Community Forum

Connect and collaborate with IBM Engineering experts and users

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

0 votes


Accepted answer

Permanent link

 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

0 votes

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



_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

Permanent link

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.

9

Payment page

 

M2

6

Login Page

 

 

6

Login Page

 

M1

9

Payment page

 

 

8

Profile Page

 

 

7

Home page

 

M1

8

Profile Page

 

M2

7

Home page

 

 

7

Home page

TCB10001

 

6

Login Page

TCB10002

 

8

Profile Page

TCB10003

 

9

Payment page

TCB10004

 

0 votes

Comments

I have modified the original answer so as not to include duplicate testcases.

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


Hi,

It's was working well and fine as i want .

The issue got resolved.

Thanks for providing the solution.

Regards,
Sunil


Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,060
× 7,538
× 1,368

Question asked: Dec 30 '20, 2:00 a.m.

Question was seen: 2,251 times

Last updated: Jan 06 '21, 8:25 a.m.

Confirmation Cancel Confirm