Steer attachment Module Attributes

Once you have created Module Attributes for your API message attachments, you can steer them in your API TestCase. For example, you can verify the content of an attachment.

If you want to verify the number of attachments in your message, you can use result count. For more information on how to do so, see chapter "Set an index, notation or result count ".

To steer your attachment Module Attributes, follow the steps below:

  1. In Tosca Commander, go to the XTestStep that contains your attachments.

  2. Select the attachment that you want to steer.

  3. Add the ActionProperty File and the file path in the Value column.

    • File ensures that the file path is resolved correctly and not as a normal value.

    • Use the file path of the file that you want to insert, save to, or verify against.

    • Optionally, use an index or wildcard in the file path. For example, if the name of the attachment changes with every request.

Edit attachments

  1. Set an ActionMode.

    • To insert the content of the file into the Module Attribute, use Insert.

    • To save the content of the Module Attribute to the file, use Select.

    • To verify that the content of the file equals the value of the Module Attribute, use Verify.

In this example, you want to verify an attachment in your response message. This means that you want Tosca to verify that the content of a file equals the value of the attachment Module Attribute.

To do so, you create an attachment Module Attribute.

Then you navigate to the respective XTestStep. You select the attachment and add the ActionProperty File and the file path in the Value column.

To verify that the content of the file equals the value of the Module Attribute, you set the ActionMode to Verify.

Verify Attachment_1

You can now run your TestCase.

In this example, you want to save the attachment in a response message to file. The attachment name is dynamic; it changes with every request.

First, you create an attachment Module Attribute.

Then you navigate to the XTestStep. You select the attachment and add the ActionProperty File and the file path in the Value column. Since you don't know the exact name of the file, you use a wildcard (*) in the file path.

To save the file, you set the ActionMode to Select.

Save attachment with a dynamic name

You can now run your TestCase.