Skip to main content

CLI Tool to Export XML-Full-Reports from TestBench

Project description

testbench-cli-reporter

testbench-cli-reporter is a cli tool to export XML reports from an TestBench instance and import test results back into it.

This can be used for automated test execution with e.g. RobotFramework, triggered by a CI/CD pipeline.

Supported Actions

  • Export XML Report from TestBench project
  • Import test execution results into TestBench project
  • Export actions: Create a JSON file which can be used in automatic mode to repeat your previous actions automatically
  • Change connection: Change TestBench server and/or user

Installation

Python 3.6 is required!

pip install testbench-cli-reporter

Manual mode

Just execute in command line testbench-cli-reporter or TestBenchCliReporter

Connect to TestBench instance

  1. Enter TestBench Server
PS C:\Users\falka> testbench-cli-reporter
No config file given
Starting manual mode
? Enter the TestBench server address and port <host:port>:

In here enter the testbench server you want to interact with. If you don't enter a port, the default TestBench port 9443 is used.

If you don't know the server adress of your testbench instance you can find it inside your iTBClient intallation folder: bin/application.conf

  1. Enter Credential

Next Step is providing login data the testbench-cli-reporter should use to connect with the TestBench.

Make sure the user has rights to access the test project you want to work with.

? Enter your login name: testbench-user
? Enter your password: ****************

Select Action

? What do you want to do? (Use arrow keys)
» Export XML Report
  Import execution results
  Write history to config file
  Change connection
  Quit

You can select the action you want to do using the arrow keys.

Export XML Report

Export an XML Report for test execution from the TestBench.

  1. Select a test project, test object version and test cycle you want.
? What do you want to do? Export XML Report
? Select a project. TestBench Demo Agil
? Select a test object version. Version 3.0
? Select a test cycle. 3.0.1
  Selection:
    TestBench Demo Agil                             projectKey:         7917307
      Version 3.0                                   tovKey:             8678256
        3.0.1                                       cycleKey:           8684351

hint: You can later use projectKey, tovKey and cycleKey in the config.json file to access the data without needing to know the name of the respective element. Elements names can change inside TestBench, Keys will remain the same. This approach can reduce maintenance effort and will increase robustness.

  1. select test theme to be used as root of report ..you can also go back if you accidently selected a wrong test theme
? Please select an element to be used as the root of the report. TT: 1 TestBench
? Please select an element to be used as the root of the report. (Use arrow keys)
 » <SELECT> 1 TestBench [iTB-TT-299]
   TT: 1.1 Beispiele
   TT: 1.2 Regression
   TT: 1.3 Sprints V1.0
   TT: 1.4 Sprints V2.0
   <BACK>
  1. activate filters
? Activate Filters: (Use arrow keys)
   No
 » Yes

 ? Provide a set of filters. (Use arrow keys to move, <space> to select, <a> to toggle, <i> to invert)
 » ○ automatisiert bdf
   ○ automatisiert keyword
   ○ Mir zugewiesen
  1. Select report configuration
? Select Report Configuration: (Use arrow keys)
 » Itep Export
   iTorx Export (execution)
   iTorx Export (continue|view)
   <CUSTOM>

Itep Export, iTorx Export (execution) and iTorx Export(continue|view) are pre-configured exports. With Custom you can configure the report by yourself.

In each case you must provide the path the export should be saved in.

TODO: add explanations of each option

Custom configuration possibilities

  • exportAttachments (True | False) : definition

  • exportDesignData (True | False) : definition

  • characterEncoding (UTF-16 | UTF-8) : definition

  • suppressFilteredData (True | False) : definition

  • exportExpandedData (True | False) : definition

  • exportDescriptionFields (True | False) : definition

  • exportExecutionProtocols (True | False) : definition

Import execution results

Import test results into the TestBench.

? Provide the input path [report.zip]:

Write history to config file

Writes a config.json file containing the inputs given in the current session using the testbench-cli-reporter.

This config file can later be used to execute the testbench-cli-reporter in automatic mode.

If you didn't export nor import anything in the current session yet, at least the connection properties are written.

{
  "configuration": [
    {
      "server_url": "https://localhost:9445/api/",
      "verify": false,
      "basicAuth": "XXXXXXXXXXXX=",
      "actions": []
    },
  ]
}

Change connection

Connect to a different TestBench instance so you do not have to exit the testbench-cli-reporter completely.

? What do you want to do? Change connection
? Enter the TestBench server address and port <host:port>:
? Enter your login name: testbench-user
? Enter your password: ****************

Quit

Exits the testbench-cli-reporter


Automatic mode

Run in automatic mode: testbench-cli-reporter --config /path/to/config/file.json

Config file structure

The attribute projectPath is not mandatory though. Only using projectKey, tovKey, cycleKey is also more error prone, as they will not change within TestBench.

{
  "configuration": [
    {
      "server_url": "https://localhost:9445/api/",
      "verify": false,
      "basicAuth": "XXXXXXXXXXXXX=",
      "actions": [
        {
          "type": "ExportXMLReport",
          "parameters": {
            "tovKey": "8689447",
            "projectPath": [
              "TestBench Demo Agil",
              "Version 3.0",
              "3.0.1"
            ],
            "cycleKey": "8689450",
            "reportRootUID": "itb-TT-8161",
            "filters": [],
            "report_config": {
              "exportAttachments": true,
              "exportDesignData": true,
              "characterEncoding": "utf-16",
              "suppressFilteredData": true,
              "exportExpandedData": true,
              "exportDescriptionFields": true,
              "outputFormattedText": false,
              "exportExecutionProtocols": false,
              "reportRootUID": "itb-TT-8161"
            },
            "outputPath": "report.zip"
          }
        },
        {
          "type": "ImportExecutionResults",
          "parameters": {
            "inputPath": "report.zip",
            "cycleKey": "8689450",
            "reportRootUID": "ROOT",
            "defaultTester": false,
            "filters": [],
            "importConfig": {
              "ignoreNonExecutedTestCases": true,
              "checkPaths": true,
              "discardTesterInformation": true,
              "useExistingDefect": true,
              "filters": []
            }
          }
        }
      ]
    }
  ]
}

Optional arguments

TODO

You can access a list of optional arguments using testbench-cli-reporter --help

usage: testbench-cli-reporter [-h] [-c CONFIG] [-s SERVER] [--login LOGIN] [--password PASSWORD] [-p PROJECT]
                              [-v VERSION] [-y CYCLE] [-u UID] [-t {e,i}]
                              [path]

positional arguments:
  path                  Input- and Output-Path for xml reports <OPTIONAL, Default = report.zip>.

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Path to a config json file to execute pre-set actions based on the given configuration.
  -s SERVER, --server SERVER
                        TestBench Server address (hostname:port).
  --login LOGIN         Users Login.
  --password PASSWORD   Users Password.
  -p PROJECT, --project PROJECT
                        Project name to be exported <OPTIONAL if --type is 'i'>.
  -v VERSION, --version VERSION
                        Test Object Version name to be exported <OPTIONAL if --type is 'i'>.
  -y CYCLE, --cycle CYCLE
                        Test Cycle name to be exported <OPTIONAL>
  -u UID, --uid UID     Root UID to be exported <OPTIONAL, Default = ROOT>
  -t {e,i}, --type {e,i}
                        'e' for Export <default>, 'i' for Import

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testbench_cli_reporter-2.0.0a3.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

testbench_cli_reporter-2.0.0a3-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file testbench_cli_reporter-2.0.0a3.tar.gz.

File metadata

File hashes

Hashes for testbench_cli_reporter-2.0.0a3.tar.gz
Algorithm Hash digest
SHA256 eefabced1f8f4e360543449a761382ce7d5ebe554ebc508f6d0c1a86ccd92abc
MD5 ccb3f743b1eb194507f03049d6883a9f
BLAKE2b-256 ce68eb34ad47016f8d3a25b948dc071bd62ba02294960995fc7519f27f48d376

See more details on using hashes here.

File details

Details for the file testbench_cli_reporter-2.0.0a3-py3-none-any.whl.

File metadata

File hashes

Hashes for testbench_cli_reporter-2.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 7eb608ac0790acb20e41b2945c174f1b5a7e62d14e1a955be45c85def10458d8
MD5 b54f3326c8d461620c78e2de9d363190
BLAKE2b-256 49ad341b64418840ae5720ebea86559106c8b8923a7be80158dc8bd5f86beb41

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page