Skip to content

Hypersequent/qas-cli

Repository files navigation

QAS CLI

Description

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.

Installation

Requirements

Node.js version 18.0.0 or higher.

Via NPM

npm install -g qas-cli

Via source code

  1. Install NodeJS
  2. Download, build, and link repositiory:
git clone https://github.com/Hypersequent/qas-cli.git
cd qas-cli
npm install
npm run build
npm link
  1. Verify installation
qasphere --version

Environment

  • The CLI requires following variables to be defined, absence of which will result in error
    • QAS_TOKEN - QASphere API token
  • These should either be exported 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

Command: junit-upload

Options

  • -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)

JUnit XML File Requirements

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.

Test Case Naming Convention

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

Examples

Make sure that the required variables, as mentioned in Environment, are defined before running the commands.

  1. 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
  1. 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

How to Test

  1. Build the code with npm run build.
  2. Create a project with test cases using local QASphere build or by registering on qasphere.com
  3. 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.
  4. Define required variables as mentioned in Environment.
  5. 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
  6. You may pass the -h flag to show help: node ./build/bin/qasphere junit-upload -h

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published