CI/CD Integration
Thunder Client CLI can be used in build server to run collection and save reports in XML, HTML, JSON and CSV formats.
- VS Code Settings: If you are using any TC VS Code settings, you need to set the scope to
workspace
, so the settings will be saved to the workspace directory. - Git Sync: The collection runner in build server will work only when you enable git sync feature
- Reports:
tc --col "ColNameOrId" --report "xml,html"
command will execute all the requests and save reports in 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 will use the current working directory as workspace directory, but if the data is in different workspace directory then use the
--ws 'fullpathToGitWorkspace'
to specify the workspace path.
Stop Collection When Fail
- [Optional]: If you want to stop collection execution of other requests when a request test fails then use the argument
--stop-on-fail
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
# Isstall 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 Test Results directory to workspace
- name: Output the run Details
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: RunReports
path: thunder-reports