Jenkins Integration for Autotest.ing
Integrate autotest.ing into your Jenkins Declarative Pipelines or Freestyle Projects. Leverage the Credentials Plugin for secure API key management.
Prerequisites
Install the Credentials Browser Plugin (or equivalent) and store your API key:
- Navigate to Manage Jenkins → Credentials → (global) → Add Credentials.
- Kind: Secret text.
- Secret: Your API key.
- ID:
autotest-api-key.
Configuration Patterns
Pattern 1: Declarative Pipeline (Jenkinsfile)
pipeline { agent any tools { nodejs 'Node 20' } environment { AUTOTEST_API_KEY = credentials('autotest-api-key') } stages { stage('Build') { steps { sh 'npm install' sh 'npm run build' } } stage('AI Test') { steps { sh 'npm install -g @autotest/cli' sh ''' autotest run \ --project-id "proj_12345" \ --output junit \ --file results.xml ''' } post { always { junit 'results.xml' } } } } }
The junit post step integrates with Jenkins' "Test Results Trend" chart. Over time,
this provides a visual history of AI-detected regressions, allowing teams to correlate
deployments with quality trends.
Pattern 2: Freestyle Project
For teams using Jenkins Freestyle projects, configure a build step:
- Create a new Freestyle project.
- Under Build Environment, check "Use secret text(s)" and bind
AUTOTEST_API_KEY. - Add an Execute Shell build step:
#!/bin/bash npm install -g @autotest/cli autotest run --project-id "proj_12345" --wait
Troubleshooting
Ensure the "NodeJS" plugin is installed in Jenkins and a Node.js installation is
configured under Manage Jenkins → Tools. The
tools { nodejs 'Node 20' } directive in the Jenkinsfile references this
installation by name.
If using the global npm install (npm install -g), the Jenkins agent may need
elevated permissions. Use npx @autotest/cli instead to avoid global installs.
Ready to integrate?
Connect your Jenkins pipeline and run your first AI regression test in minutes.