How to Set Up CI/CD Pipelines with AegisRunner
Automated tests are only valuable when they run automatically. The most thorough test suite in the world is useless if your team forgets to run it before deploying. CI/CD integration helps make sure code changes are tested before they reach production.
This guide shows how to run your reviewed AegisRunner tests from a CI/CD pipeline and get pass/fail plus a JUnit file.
Why CI/CD Integration Matters
Without CI/CD integration, testing is a manual step that gets skipped under deadline pressure. With integration:
- Changes get tested: Your pipeline runs the tests whenever you configure it to, such as when code is pushed.
- Deployment gates: Your pipeline can stop a release when tests fail.
- Faster feedback: Developers see test results in the pipeline while the changes are still fresh in their minds.
- Historical tracking: CI/CD logs provide a history of test results, making it easy to identify when regressions were introduced.
Setting Up the AegisRunner CI/CD Token
Before integrating with any CI/CD platform, you need a CI token (available on the Pro and Business plans):
- Open your project in AegisRunner.
- Go to Manage → CI/CD.
- Create a CI token.
- Copy the token and store it as a secret named
AEGIS_TOKENin your CI/CD platform.
This token authenticates CI/CD requests to AegisRunner without exposing user credentials.
Install the CLI
The AegisRunner command-line tool needs Node 18 or later:
npm install -g @aegisrunner/cli
Then run your tests and write a JUnit file with one command:
aegis run --format junit --output aegis-results/junit.xml
You get pass/fail plus a JUnit file. Add --suite <id> to run a specific suite; without it the command runs the suites from your latest scan. Every option is listed in the CLI guide.
GitHub Actions
GitHub Actions is the most common CI/CD platform for modern teams. Here is a workflow that runs AegisRunner tests on pull requests and keeps the JUnit file as a build artifact:
name: AegisRunner Tests
on:
pull_request:
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm install -g @aegisrunner/cli
- run: aegis run --format junit --output aegis-results/junit.xml
env:
AEGIS_TOKEN: ${{ secrets.AEGIS_TOKEN }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: aegis-results
path: aegis-results/junit.xml
GitLab CI
For GitLab CI, add the following to your .gitlab-ci.yml and set AEGIS_TOKEN as a masked CI/CD variable:
aegisrunner-tests:
stage: test
image: node:20-alpine
script:
- npm install -g @aegisrunner/cli
- aegis run --format junit --output aegis-results/junit.xml
artifacts:
when: always
reports:
junit: aegis-results/junit.xml
Jenkins and other CI tools
Any CI tool that can run a command works the same way: install the CLI, set AEGIS_TOKEN as a secret, run aegis run --format junit, and point the tool’s JUnit reader at aegis-results/junit.xml.
Using the API directly
If your tool cannot run the CLI, the CI trigger endpoint accepts the same token. See the CI/CD guide for the request format.
Best Practices for CI/CD Testing
1. Use Separate Test Environments
Run tests against a staging environment that mirrors production. This avoids polluting production data with test interactions.
2. Parallelize Test Suites
If you have multiple test suites, trigger them in parallel to reduce total pipeline time. AegisRunner supports concurrent suite execution.
3. Set Appropriate Timeouts
Visual regression tests may take longer than unit tests. Set timeouts that account for page load times, screenshot capture, and comparison processing.
4. Handle Flaky Tests
Network issues or timing-dependent tests can cause intermittent failures. Configure retries for flaky tests and track flakiness rates over time.
5. Archive Test Artifacts
Store screenshots, diff images, and test reports as CI/CD artifacts for debugging. AegisRunner provides downloadable reports for every run.
Ready to add automated testing to your pipeline? Set up AegisRunner CI/CD integration and catch bugs before they ship.