Add TestCase to TestRun via Webservice

Description
Maria Floruß
Posts: 8
Joined: Thu Sep 12, 2013 10:47 am

Add TestCase to TestRun via Webservice

Postby Maria Floruß » Thu Sep 26, 2013 7:43 am

Hey,

i want to create a new TestRun via webservice.
This worked perfectly fine:

Code: Select all

String testRunURI = testManagementService.createTestRun(projectId, "AnotherNewTestrun", template);


I created a new TestRecord:

Code: Select all

TestRecord testRecord = new TestRecord(comment, defectURI, duration, executed, executedByURI, result, testCaseURI, testCaseRevision, testStepResults);


and added it to the TestRun:

Code: Select all

testManagementService.addTestRecordToTestRun(testRunURI, testRecord);


Everything worked fine, but I couldn't fine a possibility to add TestCases to the new TestRun (exept for the "testCaseURI" parameter in the constructor of TestRecord). I search for a method like "addTestCaseToTestRun()" or something.
Is there a way to do this via webservice?

Sandro_F
Posts: 19
Joined: Wed Jan 19, 2011 8:40 am

Re: Add TestCase to TestRun via Webservice

Postby Sandro_F » Fri Sep 27, 2013 12:34 pm

Whats the problem to use this function of a TestRecord object to set corresponding test case work item?

Code: Select all

setTestCaseURI(java.lang.String testCaseURI)

Maria Floruß
Posts: 8
Joined: Thu Sep 12, 2013 10:47 am

Re: Add TestCase to TestRun via Webservice

Postby Maria Floruß » Fri Sep 27, 2013 1:08 pm

Hi Sandro_F,

thanks for the answer!!

As I see it,I could do that if i just wanted to have one TestCase per TestRun, but I want multiple ones.
You can add multiple TestCases if you choose the "Select TestCases" action manually in the TestRun view. I want to do exactly the same but remotely.
Also the method "setTestCaseURI()" is just provided for TestRecords.
But maybe I want to create a TestRun without TestRecord.

I found the method

Code: Select all

testRun.setSelectTestCasesBy(selectTestCasesBy)

But neither am I sure how this works nor do I know if this will help me with my problem.

best regards,
Maria

Sandro_F
Posts: 19
Joined: Wed Jan 19, 2011 8:40 am

Re: Add TestCase to TestRun via Webservice

Postby Sandro_F » Fri Sep 27, 2013 1:17 pm

You have to create a test record for each test case that you want to add to the testrun.

Maria Floruß
Posts: 8
Joined: Thu Sep 12, 2013 10:47 am

Re: Add TestCase to TestRun via Webservice

Postby Maria Floruß » Fri Sep 27, 2013 1:36 pm

I just figured out how testRun.setSelectTestCasesBy(selectTestCasesBy) works and i think it fits my needs.

I used it like this:
If necessary i create all TestCases needed.
They need to be selectable with a query.

then i use the following code

Code: Select all

testRun.setSelectTestCasesBy(new EnumOptionId("By Query on Create"));     //or "By Query on Execute" if needed
testRun.setQuery("severity:basic");                                       //or some other query
testManagementService.updateTestRun(testRun);


i think this or something like this will work fine enough.

thank you nevertheless! :)

best regards,
Maria


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 10 guests