Share this page

# 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.

In this topic:

## Entity relationship diagram

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

The following shows the relations in the flow.

Entity | Relationships in this flow | Description of relationship | Reference / relationship fields
--- | --- | --- | ---
Tests | None | 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. | None
Manual Test | Attachments | Reference to an attachment. | filename
Manual Test | Script | The script associated with the manual test. | None
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 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

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:

- REST API calls
- Common flows and ER diagrams
- Attachments
- POST: Create an attachment

https://admhelp.microfocus.com Software Delivery Management 8942
Tips to improve your search results... OpenText™ Software Delivery Management Help Center OpenText™ Software Delivery Management Help 26.1 All View Local Help Center View Online Help Center Version: