TestingBot for AWS CodePipeline and CodeBuild
Run TestingBot Selenium and Appium tests from AWS CodePipeline, see the results in CodeBuild test reports, and stop a deploy when TestingBot tests fail.
This repository has two parts. Use either one, or both:
| Part | Where it runs | What it does |
|---|---|---|
testingbot-codebuild CLI |
your CodeBuild buildspec | Starts and stops TestingBot Tunnel, names the TestingBot build after the CodeBuild run, and writes the TestingBot results as a JUnit report for a CodeBuild report group. |
| CodePipeline gate (Lambda) | a CodePipeline Invoke action | Passes or fails the pipeline on the TestingBot build result, with links to every failing test. |
Both use only the Python standard library. A stock CodeBuild image and the Lambda Python runtime need nothing extra.
Credentials
Store your TestingBot key and secret, from the member area, in AWS Secrets
Manager as one secret, for example named testingbot:
{"key": "YOUR_KEY", "secret": "YOUR_SECRET"}
CodeBuild: tunnel and test reports
version: 0.2
env:
secrets-manager:
TESTINGBOT_KEY: testingbot:key
TESTINGBOT_SECRET: testingbot:secret
exported-variables:
- TESTINGBOT_BUILD
phases:
install:
commands:
- pip install --quiet testingbot-codepipeline
pre_build:
commands:
- eval "$(testingbot-codebuild env)"
- testingbot-codebuild tunnel start
build:
commands:
- npm run test:e2e
post_build:
commands:
- testingbot-codebuild tunnel stop
- testingbot-codebuild report
reports:
testingbot:
files:
- testingbot-reports/testingbot.xml
file-format: JUNITXML
Your tests must send the TestingBot build and tunnel-identifier capabilities, read from the environment:
'tb:options': {
build: process.env.TESTINGBOT_BUILD,
'tunnel-identifier': process.env.TESTINGBOT_TUNNEL_IDENTIFIER
}
A full example is in examples/buildspec.yml.
Commands
| Command | Description |
|---|---|
testingbot-codebuild env |
Prints export TESTINGBOT_BUILD=… TESTINGBOT_TUNNEL_IDENTIFIER=… for eval. The default is codebuild-<project>-<build number>. Set TESTINGBOT_BUILD yourself to override it. |
testingbot-codebuild tunnel start |
Downloads the self-contained tunnel for the build's architecture (x64 or arm64, no Java needed) and verifies its SHA-256. Then it starts the tunnel in the background and blocks until /readyz reports it is forwarding. Pass extra tunnel flags after --, e.g. tunnel start -- --nobump. Options: --identifier, --tunnel-version (default 5.0), --metrics-port (default 8003), --timeout (default 180), --logfile, --install-dir (default ~/.testingbot-tunnel, cacheable). |
testingbot-codebuild tunnel stop |
Stops the tunnel with SIGTERM, so it closes gracefully. Put it in post_build, which also runs when the tests fail. |
testingbot-codebuild report |
Fetches every test in the TestingBot build and writes JUnit XML, one suite per browser and OS. Each test links to its TestingBot video and logs. Options: --build, --output (default testingbot-reports/testingbot.xml), --fail-on-failed-tests, --fail-on-empty, --wait (seconds to wait for tests still running, default 60). |
Tests that never reported a pass/fail status to TestingBot appear as skipped, not failed.
The tunnel reads the key and secret from the environment, so they never appear on a command line or in the build log.
CodePipeline: gate a deploy on TestingBot results
-
Deploy the gate. From this repository, run
sam deploy --guided. It asks forTestingBotSecretArn, the ARN of the secret above. -
In the CodeBuild action that runs your tests, set the variable namespace to
TestVariablesand keepTESTINGBOT_BUILDunderenv.exported-variablesin the buildspec. -
Add an action after it: provider AWS Lambda, function
GateFunctionNamefrom the stack outputs, and user parameters:{"build": "#{TestVariables.TESTINGBOT_BUILD}"}
-
Allow the pipeline role
lambda:InvokeFunctionon the gate.
CloudFormation for steps 2-4 is in examples/pipeline.yml.
| User parameter | Default | Meaning |
|---|---|---|
build |
required | TestingBot build identifier. A bare string instead of JSON is read as this. |
max_failed |
0 |
Failed tests tolerated before the gate fails. |
allow_unknown |
true |
Whether tests without a reported pass/fail status are acceptable. |
allow_empty |
false |
Whether a build with no tests passes. The default catches tests that forgot the build capability. |
max_wait |
300 |
Seconds to wait for tests still running. The gate waits through CodePipeline continuation tokens, so no Lambda stays open. |
The gate always reports a result to CodePipeline, also on bad parameters or credentials, so the pipeline never waits for the action to time out.
Development
PYTHONPATH=src:tests python3 -m unittest discover -s tests -v
License
MIT
Metadata
Release files for testingbot-codepipeline 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| testingbot_codepipeline-0.1.0.tar.gz | 21.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| testingbot_codepipeline-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.1 kB
Release files / testingbot_codepipeline-0.1.0.tar.gz
| Download URL | testingbot_codepipeline-0.1.0.tar.gz |
|---|---|
| Size | 21.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80a99cbeac769ca254bbf4b715f22c1798c3fd951cd84d144bd2066873713309
|
|
BLAKE2b-256 checksum How to use checksums |
7661a42203fa2b1ea1d14e58699ffd47602c1cd5d56c83f4befa0c30f6a11912
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / testingbot_codepipeline-0.1.0-py3-none-any.whl
| Download URL | testingbot_codepipeline-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
355d7041456ae794da44dd5c421ae55416859725a6aa86bc60755e70235b98d3
|
|
BLAKE2b-256 checksum How to use checksums |
3255dd937d67abd93dc31028badd1477a95bba1082f6a079c87cf9cbb03154f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for testingbot-codepipeline 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for testingbot_codepipeline-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.