Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HP-ALM Adding Test Cases With REST API

I'm looking to automate adding new test cases into HP-ALM using the REST API. I didn't find anything in the documentation to help me achieve this and I was wondering if anyone else had any success with it.

like image 369
redstapler Avatar asked Dec 15 '25 13:12

redstapler


1 Answers

The API documentation provided through ALM is very helpful.

1) authenticate session 2) capture Cookie 3) create test (See below - FROM ALM DOCUMENTATION)

use the entity type you want to create and specify the appropriate fields.

Example with XML

POST /qcbin/rest/domains/{domain}/projects/{project}/defects HTTP/1.1
Content-Type: application/xml
Accept: application/xml
Cookie: QCSession=xxx; LWSSO_COOKIE_KEY=xxx

Data

<Entity Type="defect">
<Fields>
<Field Name="detected-by">
<Value>henry_tilney</Value>
</Field>
<Field Name="creation-time">
<Value>2010-03-02</Value>
</Field>
<Field Name="severity">
<Value>2-Medium</Value>
</Field>
<Field Name="name">
<Value>Returned value not does not match value in database.</Value>
</Field>
</Fields>
</Entity>

Example with JSON

POST /qcbin/rest/domains/{domain}/projects/{project}/defects HTTP/1.1
Content-Type: application/json
Accept: application/json
Cookie: QCSession=xxx; LWSSO_COOKIE_KEY=xxx

Data

{"Fields":[{"Name":"detected-by","values":[{"value":"henry_tilney"}]},                {"Name":"creation-time","values":[{"value":"2010-03-02"}]},{"Name":"severity","values":[{"value":"2-Medium"}]},{"Name":"name","values":[{"value":"Returned value not does not match value in database.</ "}]}]}

Example XML I Have Used for Test Entity

<Entity Type="test">
<Fields>
<Field Name="name">
<Value>MY TEST CASE</Value>
</Field>
<Field Name="description">
<Value>Test created from api</Value>
</Field>
<Field Name="owner">
<Value>roglesby</Value>
</Field>
<Field Name = "subtype-id">
<Value>VAPI-XP-TEST</Value>
</Field>
<Field Name = "parent-id">
<Value>6209</Value>
</Field>     
</Fields>
</Entity>
like image 150
Roglesby Avatar answered Dec 19 '25 05:12

Roglesby