The QAS CLI is a command line tool to submit your test automation results to QA Sphere. It is the best way to collect and report your test results from your test automation workflow, CI/CD pipeline and build servers.
The QAS CLI tool can upload test case results from a JUnit XML file to QASphere test run by matching the testsuite name and test case name to QA Sphere's project folder and test case respectively.
Node.js version 18.0.0 or higher.
npm install -g qas-cli
- Install NodeJS
- Download, build, and link repositiory:
git clone https://github.com/Hypersequent/qas-cli.git
cd qas-cli
npm install
npm run build
npm link
- Verify installation
qasphere --version
- The CLI requires following variables to be defined, absence of which will result in error
QAS_TOKEN
- QASphere API token
- These should either be
export
ed as environment variables while running the command or defined in a.qaspherecli
configuration file in the directory where the command is being run or one of its parent directories .qaspherecli
follows the simple syntax of.env
files# Comment QAS_TOKEN=token QAS_TOKEN=token # comment export QAS_TOKEN=token
-r, --run-url
- URL of the Run (from QASphere) for uploading results, eg. https://qas.eu1.qasphere.com/project/P1/run/23 (string)--attachments
- Try to detect any attachments and upload it with the test result (boolean)--force
- Ignore API request errors, invalid test cases, or attachments (boolean)-h, --help
- Show help (boolean)
The qas-cli tool requires JUnit XML files to have test case names that match the test case codes on QASphere. If your XML file doesn't contain any matching test cases, the tool will display an error message.
To ensure proper matching between your JUnit XML file and QASphere test cases, follow this naming convention:
Test case names in your JUnit XML file should include the QASphere test case code. The format for test case names should be: PROJECT-SEQUENCE: Your test name
- PROJECT is your QASphere project code
- SEQUENCE is at least three-digit test case sequence number in QASphere test case URL
- Your test name is a descriptive name for your test
For example, if your QASphere project code is "P1" and you have a test case with sequence number 1024, your JUnit test case name might look like: P1-1024: Login with valid credentials
Make sure that the required variables, as mentioned in Environment, are defined before running the commands.
- Upload JUnit XML file to Run ID 23 of Project P1
qasphere junit-upload -r https://qas.eu1.qasphere.com/project/P1/run/23 ./path/to/junit.xml
- To upload all (JUnit) XML files from the current directory to Run ID 23 of Project P1
qasphere junit-upload --run-url https://qas.eu1.qasphere.com/project/P1/run/23 ./*.xml
- Build the code with
npm run build
. - Create a project with test cases using local QASphere build or by registering on qasphere.com
- Get a JUnit XML file. If you want to test the test cases from the CSV file above, use the JUnit XML file generated from this repository.
- Define required variables as mentioned in Environment.
- Run the CLI with:
node ./build/bin/qasphere.js junit-upload -r QAS_URL/project/PROJECT_CODE/run/RUN_ID ./JUnit.xml
. If you get permission errors, please retry after running:chmod +x ./build/bin/qasphere.js
- You may pass the
-h
flag to show help:node ./build/bin/qasphere junit-upload -h