How to use Multiple auth certificates in a single API test with multiple requests


Article ID: 197849


Updated On:




Is there a way to change the auth client certificate in an API test so that a different certificate is used for different requests an API test that contains multiple requests?  For example:

Step 1 requires auth certificate 1
Subtest 2 requires auth certificate 2

It is only possible to define a single auth certificate in the API test environment.


Release : SAAS




This can be done, but only by using subtests for additional auth client certificates required for additional steps in a single API test.

Here is how is can be done:

1.  Create multiple shared environments - one for each additional auth certificate that must be used for additional requests made in the the API test.  Set the client certificate in the Authentication section of the shared environments created.

2.  For each set of request that require a client certificate different from the one set in the API test, create a new API test that contains these requests

3.  The client certificate defined in the Authentication section of the Environment defined in the final API test will be used by any Request step in the test.  It will also be used for any Subtest step added, if the environment of the subtest is not overridden with a shared environment.  Add Subtests to the final test and select the appropriate shared environment that contains the auth client certificate for the requests in the subtest.

4.  If it is necessary to pass variables created in the full test to any of the subtests, then these must be passed in as parameters to the subtest.  This is explained in the Subtest Steps of the Test Steps article.