It's all about the answers!

Ask a question

Persisting nestled artifacts using RQM Copy Utility code


Leonardo Marzo (24954852) | asked Jun 10 '14, 5:04 p.m.
 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,

One answer



permanent link
Leonardo Marzo (24954852) | answered Jun 10 '14, 5:36 p.m.
 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);

Your answer


Register or to post your answer.