CI/CD integration requires a cloud test execution environment.
This article explains how to integrate Autify Nexus with Jenkins. Specifically, it helps you understand how to run a test plan via the Autify Nexus API from a Jenkins node.
Prerequisites
You will need the following information from Autify Nexus:
Nexus server URL
API Client Secret
Test plan name
You will also need to install the jq command on your Jenkins node to run the code example on this page.
More information about the prerequisite information can be found in the table below.
Nexus server URL | The URL you use to login to Autify Nexus, for example, |
API Client secret | The client secret for the API client you created in Autify Nexus. See API Documentation for more information. |
Test plan name | The case-sensitive name of the test plan you run in Jenkins. It must exactly match what is shown in Autify Nexus. |
Save the client secret as a credential
The client secret should be stored as a credential in Jenkins.
Click Manage Jenkins on the dashboard page

Click Credentials

Set the domain in which you want to add the secret

Click + Add Credentials

Under the Kind section, select the Secret text option
In the Secret field, enter the API client secret
Enter the credential name as ID (example: AUTIFY_CLIENT_SECRET)
Click Create

The credential that you have added can be seen on the credentials list.

Create a job
To define a new job, click + New Item on the dashboard.

Input the job name as the item name
Choose Freestyle project as the item type
Click OK

In the Build Environment section, select Use secret text(s) or file(s)
Enter the name of the client secret you added in the previous section as Variable
Select the credential for that client secret from the Credentials list

In the Build Steps section, select Execute shell as the build step

Enter the code in the code input field
For example, the following code runs the test plan found by name. The required information varies depending on your usage, so adjust it accordingly.

# ENV vars
SERVER_URL='https://<your-nexus-server>'
TEST_PLAN_NAME='<your-test-plan-name>'
# WORKSPACE_ID='<your-workspace-id>' # Optional: specify if you have multiple workspaces
# Set authorization header using API client secret directly
AUTH_HEADER="Authorization: Bearer ${AUTIFY_CLIENT_SECRET}"
ACCEPT_HEADER='Accept: application/json'
# Get workspace ID (use first workspace if not specified)
res=$(
curl \
--silent \
--show-error \
--url "${SERVER_URL}/nexus/api/workspaces" \
--header "$AUTH_HEADER" \
--header "$ACCEPT_HEADER"
)
if [ -z "${WORKSPACE_ID:-}" ]; then
WORKSPACE_ID=$(echo "$res" | jq -r '.[0].id')
fi
if [ -z "$WORKSPACE_ID" ] || [ "$WORKSPACE_ID" = "null" ]; then
echo "Workspace not found. Response: ${res}"
exit 1
fi
echo "Workspace ID: ${WORKSPACE_ID}"
# Get test plan ID
res=$(
curl \
--silent \
--show-error \
--url "${SERVER_URL}/nexus/api/workspaces/${WORKSPACE_ID}/testPlans" \
--header "$AUTH_HEADER" \
--header "$ACCEPT_HEADER"
)
TEST_PLAN_ID=$(echo "$res" | jq -r --arg NAME "$TEST_PLAN_NAME" '.[] | select(.name == $NAME) | .id')
if [ -z "$TEST_PLAN_ID" ]; then
echo "Test plan '${TEST_PLAN_NAME}' not found. Response: ${res}"
exit 1
fi
echo "Test plan ID for '${TEST_PLAN_NAME}': ${TEST_PLAN_ID}"
# Run the test plan
res=$(
curl \
--silent \
--show-error \
--request POST \
--url "${SERVER_URL}/nexus/api/workspaces/${WORKSPACE_ID}/testPlans/${TEST_PLAN_ID}/run" \
--header "$AUTH_HEADER" \
--header "$ACCEPT_HEADER"
)
RESULT_ID=$(echo "$res" | jq -r '.resultId')
if [ "$RESULT_ID" = "null" ]; then
echo "Failed to start test plan. Response: ${res}"
exit 1
fi
echo "Test started. Result ID: ${RESULT_ID}"
echo "Waiting for test to complete..."
# Polling for result status
STATUS="QUEUED"
while [ "$STATUS" = "QUEUED" ] || [ "$STATUS" = "RUNNING" ]; do
sleep 5
res=$(
curl \
--silent \
--show-error \
--url "${SERVER_URL}/nexus/api/workspaces/${WORKSPACE_ID}/testResults/${RESULT_ID}/status" \
--header "$AUTH_HEADER" \
--header "$ACCEPT_HEADER"
)
STATUS=$(echo "$res" | jq -r '.status')
if [ "$STATUS" = "null" ]; then
echo "Failed to fetch result status. Response: ${res}"
exit 1
fi
echo "Current status: $STATUS"
done
echo "Final status: $STATUS"
Click Save to register the job
Run the job and verify it works
After defining a job, make sure if it works as expected.
Click the job name on the dashboard

Click Build Now to start the job

The build status can be seen in the left side of the page.
Click the top item in the Builds pane

The output can be seen by clicking the Console Output.

The sample log "Final status: PASSED" indicates the test result in Autify Nexus. "PASSED" means the test succeeded. If the test fails, it is displayed as "FAILED".
The log "Finished: SUCCESS" appears on the last line of the log. This indicates the job finished without errors when communicating with the Autify Nexus API. Note that this status does not indicate whether the test result in Autify Nexus succeeded.
