Add an attachment to a manual test script

The following flow demonstrates how to add an attachment to a manual test and how to associate the attachment with the manual test script.

Entity relationship diagram

We need to access the following entities for this flow, and understand the relationships between these entities.

Entity Relationships in this flow Description of relationship Reference / relationship fields
Tests   This aggregate resource collection represents types of tests, including manual, Gherkin, test suites, and automated. subtype
Manual Test Test

The manual test is a subtype of the tests aggregate resource collection.

The manual test can also be accessed in the manual_tests resource collection.

There is no field that relates back to the aggregate resource collection, tests.

 
Attachments Reference to an attachment. filename
Script The script associated with the manual test.  
Script Attachments Association to a script. filename
Attachments Test The test that contains the attachment. owner_test

Back to top

Flows

Let's create the REST API calls step-by-step.

Add the attachment to a Gherkin test

We start by POSTing the attachment to ALM Octane to Gherkin test 1001. In this flow, we add the file MyDocument.pdf.

POST /api/shared_spaces/1001/workspaces/1002/attachments


------WebKitFormBoundaryLvrkKRS4AuUYrFHZ
Content-Disposition: form-data; name="entity"; filename="blob"
Content-Type: application/json

{   "name":"MyDocument.pdf",
  "owner_test":{
      "type":"test",
      "id":"1001"  
  }
}

------WebKitFormBoundaryLvrkKRS4AuUYrFHZ
Content-Disposition: form-data; name="content"; filename="MyDocument.pdf"
Content-Type: application/pdf

Back to top

Update the script of the Gherkin test

Assuming the first part of this flow returns one Gherkin test that is ready for automation, we now use that ID to update the script. In this flow, the ID of 1005.

PUT /api/shared_spaces/1001/workspaces/1002/tests/1001/script

We PUT the following body, which contains an update to the script, the attachment.

We make sure the script conforms to Gherkin standards.

Note the use of the ! operator to indicate an attachment.

{ "script":"- step1 ![ MyDocument.pdf]",
  "comment":"",
  "revision_type":"Minor"
}

Back to top

See also: