CI/CD Integration
Thunder Client CLI can be used on build servers to run collections and save reports in XML, HTML, JSON, and CSV formats.
- VS Code Settings: If you are using any TC VS Code settings, set the scope to
workspaceso the settings are saved to the workspace directory. - Git Sync: The collection runner on a build server works only when you enable the Git Sync feature.
- Reports: The
tc --col "ColNameOrId" --report "xml,html"command will execute all requests and save reports in the thunder-reports folder.
GitHub Actions
- The sample YAML file can be used to integrate with GitHub Actions or other build pipelines.
Workspace Location
- [Optional]: The CLI uses the current working directory as the workspace directory, but if the data is in a different workspace directory, use
--ws 'fullpathToGitWorkspace'to specify the workspace path.
Stop Collection on Failure
- [Optional]: If you want to stop execution of the remaining requests when a request test fails, use the
--stop-on-failargument.
Sample YAML File
main.yaml
# This is a basic workflow to help you get started with Actions
name: TestBuild
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Install Node on the runner
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20
# Install Thunder Client CLI
- name: Install Thunder Client CLI
run: |
npm install -g @thunderclient/cli
- name: Make Directory for results
run: mkdir -p thunder-reports
# Run the Thunder Client collection
- name: Run Thunder Client collection
run: |
tc --col "ColNameOrId" --report cli,json,xml,html --log 8
# Upload the contents of the test results directory to workspace
- name: Output the run Details
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: RunReports
path: thunder-reports
Last updated on