Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Persisting nestled artifacts using RQM Copy Utility code

 Hi, 

I need to create a RQM java client that creates Test Plan and Test Cases, and associates those test cases to the test plan. 

I´m using part of the RQM Copy Utility code. However, I can't make it work. The tests cases are created twice and they are not referenced to the Test Plan This is how my code looks like:

String newIdTC = processor.getNewId();
String newIdTP = processor.getNewId();
Testcase tc = new Testcase();
tc.setTitle("TC_Hello_World");
Testplan tp = new Testplan();
tp.setTitle("Test Plan Hello World");
Testplan.Testcase testPlanTC = new Testplan.Testcase();
testPlanTC.setId(newIdTC);
String hrefTest = rqmRestClient.putArtifact(ArtifactType.testcase.name(), newIdTC, tc);
testPlanTC.setHref(hrefTest);

ArtifactProcessor processor = new ArtifactProcessor(rqmRestClient, rqmRestClient);
processor.setIsRecursive(true);
rqmRestClient.putArtifact(ArtifactType.testplan.name(), newIdTP, tp);

tp.getTestcase().add(testPlanTC);

TestPlanArtifactHandler tcah = new TestPlanArtifactHandler(newIdTP, processor);
tcah.followReferences(tp);

Could you tell me what I´m doing wrong? 

I´ll appreciate your help!


Thanks,

0 votes



One answer

Permanent link
 I figured it out. It was simpler than expected. This is the code:

String newIdTC = processor.getNewId();
String newIdTP = processor.getNewId();

Testplan tp = new Testplan();
tp.setTitle("Test Plan " + string);
Testplan.Testcase testPlanTC = new Testplan.Testcase();

String hrefTest = rqmRestClient.putArtifact(ArtifactType.testcase.name(), newIdTC, tc);
testPlanTC.setHref(hrefTest);
tp.getTestcase().add(testPlanTC);

rqmRestClient.putArtifact(ArtifactType.testplan.name(), newIdTP, tp);

0 votes

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
× 10,927
× 478
× 411

Question asked: Jun 10 '14, 5:04 p.m.

Question was seen: 5,083 times

Last updated: Jun 10 '14, 5:36 p.m.

Confirmation Cancel Confirm