Oxygen CLI

For Oxygen-CLI download instructions - please refer to download page: http://docs.oxygenhq.org/download-cli.html

Introduction

Oxygen CLI is a command-line application for running test cases and test suites. It's intended mainly for integration with CI and build systems, but can be used as well for running scripts manually from the command-line. The results are produced as a set of XML/HTML/Excel reports plus the screenshots in case of test failures.

Usage

oxygen [OPTIONS]... FILE

Oxygen CLI can execute two types of files - test scripts (refered to as test cases) and test suites. Test suite allows defining and running collection of test cases.

Example of test suite for desktop web applications (Selenium):

{
  "iterations": 2,
  "parallel": 1,
  "url": "http://localhost:4444/wd/hub",
  "cases": [
    {
      "name": "case1",
      "path": "./testcase1.js"
    },
    {
      "name": "case2",
      "path": "./testcase2.js"
    }
  ],
  "environment": {
    "some_parameter": "foo",
    "another_parameter": "bar"
  },
  "capabilities": [
    {
      "browserName": "ie"
    },
    {
      "browserName": "chrome"
    }
  ],
  "options": {
    "autoReopen": true
  }
}

Example of test suite for mobile applications (Appium):

{
  "iterations": 2,
  "parallel": 1,
  "server": {
    "host": "localhost",
    "port": 4723
  },
  "cases": [
    {
      "name": "case1",
      "path": "./testcase1.js"
    },
    {
      "name": "case2",
      "path": "./testcase2.js"
    }
  ],
  "environment": {
    "some_parameter": "foo",
    "another_parameter": "bar"
  },
  "capabilities": [
    {
      "platformName": "Android",
      "platformVersion": "4.2",
      "deviceName": "90a92348",
      "appPackage": "com.sec.android.app.popupcalculator",
      "appActivity": "com.sec.android.app.popupcalculator.Calculator"
    },
    {
      "platformName": "Android",
      "platformVersion": "5.0",
      "deviceName": "ef4718a9",
      "appPackage": "com.sec.android.app.popupcalculator",
      "appActivity": "com.sec.android.app.popupcalculator.Calculator"
    }
  ]
}


General Options

  • -m, --mode={web|mob}

    Test mode - Web application (using Selenium) or Mobile application (using Appium). Default is web.

  • --rf={html|xml|excel|pdf|junit}

    Format of the test reports. Default is html.
    Reports will be generated in the same directory where test script is located.

  • --ro=PATH

    Output path for the report file. If specified, the report file will be simply generated in the specified directory and will overwrite any previous reports. If omitted, then report will be generated using date-time folder structure. This the default behavior.

  • --rt=FILE

    Template to use for Excel reports. This option is relevant only if --rf=excel is specified. The template is specified using JSON format and allows configuring what data should be emitted into the Excel spreadsheet.
    Displayed below is the default template which will be used if --rt option is omitted. This template will produce all available details.

    [{
        "header": "Suite Iteration",
        "value": "${suite.iteration}"
    },
    {
        "header": "Suite Status",
        "value": "${suite.status}"
    },
    {
        "header": "Case Iteration",
        "value": "${case.iteration}"
    },
    {
        "header": "Case Name",
        "value": "${case.name}"
    },
    {
        "header": "Case Status",
        "value": "${case.status}"
    },
    {
        "header": "Failure Step",
        "value": "${failure.step}"
    },
    {
        "header": "Failure Type",
        "value": "${failure.type}"
    },
    {
        "header": "Failure Message",
        "value": "${failure.message}"
    },
    {
        "header": "Failure Line",
        "value": "${failure.line}"
    },
    {
        "header": "",
        "value": "${param.all}"
    },
    {
        "header": "",
        "value": "${var.all}"
    }]

    Each header-value pair defines column name and the row value respectively.
    Two special cases to note are param.all and var.all:
    param.all will automatically emit all parameters which were used during the test. To emit only a specific parameter param.PARAMETER_NAME can be used.
    var.all will automatically emit all defined script variables. To emit only a specific variable var.VARIABLE_NAME can be used.

  • -i, --iter=COUNT

    Number of times (iterations) to run the test. Default is 1.

  • -p, --param=FILE

    Parameters file. If not specified an attempt will be made to load parameters from a file named same as the test script, located in the same directory, and having extension - xlsx, xls, csv, or txt.

  • --pm={seq|random|all}

    Order in which to read the parameters - sequential, random, all. Default is seq. In seq and random modes test will run exact number of times specified with the -i option. In all mode, all available parameters will be read sequentially. This option is mutually exclusive with -i option.

Web Mode Options

  • -b, --browser={chrome|ie}

    Browser name. Default is chrome.

  • -s, --server=SERVER_URL

    Selenium hub URL. Default is http://localhost:4444/wd/hub.

  • --reopen={true|false}

    Reopen browser on each iteration. Default is false.

  • --init={true|false}

    Initialize WebDriver automatically. Default is true.

Mob Mode Options

  • --host=HOSTNAME

    Appium server hostname. Default is localhost.

  • --port=PORT

    Appium server port. Default is 4723.