Create and configure a second stage in your pipeline to launch your API tests.
Procedure
- In your release pipeline, go to the Pipeline tab and click the + icon below Deploy to Staging.
- Click Empty job and name the stage, Launch API Tests, for example.
- Click Tasks > Launch API Tests to configure the stage.
- Click the + icon to add a task, select Download secure file and click Add.
- Name the task, Download pom.xml for example.
- Select the pom.xml file and enter pom in Output Variables > Reference name.
- Add a Bash task to fetch your API test project using the Talend Cloud API Tester Management API.
-
In the task configuration panel, select Inline as the
type and enter the following script:
Replacecurl -X GET 'https://apit.eu.cloud.talend.com/api/v1/api-tests/<api_project_id>' \ -H 'Authorization: Bearer $(talend_personal_access_token)' \ --output ./api-test.json
<api_project_id>
with your test project's ID. You can find it in the Test Automation box when opening your project in Talend Cloud API Tester. - Create a Maven Authenticate task and select the feed and credentials that you added in a previous step.
-
Create a Maven task and configure it as follows:
Field Value Display name Enter a name for your task, Launch API Tests for example. Maven POM file $(pom.secureFilePath) Goal(s) surefire-report:report Options -Dapi.test.filepath=./api-test.json -Dtalend.account.id=$(talend_account_id) -Dtalend.instance=<your_talend_instance>
in which you should replace<your_talend_instance>
with eitherus
,eu
orap
depending on your data center.Example
- Click Save.