OXYGEN
HomeGitHubReleasesCommunity
  • Welcome to Oxygen
  • About
    • What is Oxygen?
    • Getting Started (Videos)
      • Oxygen IDE Controls Overview
      • Recording a Web Test
      • Oxygen Commands Explained
    • Getting help
  • Download and work with Oxygen
    • Download & Installation
      • Oxygen IDE Installation
      • Oxygen for Mobile Installation
      • Oxygen for Windows Desktop Automation Setup
      • Oxygen for Mac Installation
        • Mac Installation Troubleshooting
      • Oxygen CLI Installation
      • Java Installation Instructions
      • Recording Troubleshooting
    • Start working with Oxygen
      • Getting Started - Web
        • Introduction - Web Testing
        • Recording a Web Test
        • Creating a Web Test
        • Sample Project - Web Test
      • Getting Started - Mobile
        • Introduction - Mobile Testing
        • Recording a Test on Mobile
        • Creating a Test - Mobile
        • Sample Project - Mobile
      • Getting Started - Oxygen for Windows Desktop Automation
      • Getting Started- Oxyge CLI
        • Running a Test Script on Windows
        • Running Multiple Tests (Suites) on Windows
    • Oxygen Modules
      • assert
      • date
      • db
      • email
      • eyes
      • http
      • log
      • mailinator
      • mob
      • pdf
      • proxy
      • serial
      • shell
      • soap
      • twilio
      • utils
      • web
      • win
    • Test Parameters
  • Cloud Providers
    • Sauce Labs
    • Lambda Test
    • TestObject
  • Advanced programming in Oxygen
    • Project Configuration
    • Locating Elements
    • Page Objects
    • Environments
    • Code Components
Powered by GitBook
On this page

Was this helpful?

  1. Advanced programming in Oxygen

Project Configuration

Project-level configuration files - oxygen.conf.js

Starting from version 1.0, oxygen-cli no longer supports suite definitions using JSON files, and instead supports only project level configuration via a file named oxygen.conf.js . An example configuration file is listed below. Please note, that the file should be named exactly oxygen.conf.js and located in the project directory along with all the test scripts, in order for oxygen-cli to recognize it.

To launch a project using configuration file, execute: oxygen oxygen.conf.js Pass full path to the configuration file if necessary.

module.exports = {

    // ============
    // Suites
    // ============
    //
    // For example, here we have two suites defined, with first suite having two cases
    // and second suite having only a single case.
    //
    suites: [
        {
            name: 'Selenium',    // suite name
            cases: [             // cases inside this suite
                {
                    path: './tests/selenium-with-po.js'
                },
                {
                    path: './tests/pdf.js'
                }
            ]        
        },{
            name: 'Visual',
            cases: [
                {
                    path: './tests/visual.js'
                }
            ]        
        }
    ],
    
    // ============
    // Capabilities
    // ============
    //
    // If "concurrency" value is greater than 1, 
    // tests with different capabilities will be executed in parallel.
    //
    concurrency: 1,
    capabilities: [
        {
            browserName: 'chrome',    // execute on Chrome
        },
        {
            browserName: 'firefox',   // execute on Firefox
        }
    ],
    
    // ============
    // Parameters
    // ============
    //
    parameters : {
        file: '<excel or csv file path>',
        mode: 'seq', // can be 'random' or 'all' as well
    },
    
    // ============
    // Iterations
    // ============
    //
    // Tests will run only once if iterations number is not explicitly specified.
    //
    iterations: 1,
    
    // ============
    // Selenium & Appium server URLs
    // ============
    //
    // If not specified, the default URLs will be used
    //
    seleniumUrl: 'http://localhost:4444/wd/hub',
    appiumUrl: 'http://localhost:4723/wd/hub',

    // ============
    // Services
    // ============
    //
    // List services you want to enable during the test execution.
    // Available services: selenium-standalone | devtools
    // selenium-standalone needs to be installed with `npm i @wdio/selenium-standalone-service` first. 
    //
    services: ['selenium-standalone', 'devtools'],   
    
    // ============
    // Modules
    // ============
    // List modules you want to enable during the test execution.
    // Loading unnecessary modules might slow down your test execution, 
    // so only load modules that are used in the test.
    // See here https://docs.oxygenhq.org for a list of available modules.
    //
    modules: ['web', 'db', 'log', 'assert', 'pdf', 'http', 'email'],

    // ============
    // Framework
    // ============
    // Define a testing framework for this project. 
    // Available frameworks: oxygen | cucumber
    //
    framework: 'oxygen',

    // ============
    // Reporting
    // ============
    // Define test reporter format and corresponding options. 
    // Multiple reporter formats can be specified.
    // Available reporters: json | html | junit | excel | pdf | xml
    //
    reporting: {
        reporters: ['json'],
    },
    
    // ==========
    // Applitools
    // ==========
    // Define your Applitools service API key.
    // This is only for when using the `eyes` module.
    //
    applitoolsOpts: {
        key: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    },
    
    // ==========
    // Hooks
    // ==========
    // Oxygen provides several hooks that can be used to interfere with the test
    // execution process. 
    //
    hooks: {
        //
        // Hook that gets executed before the test starts.
        // At this point, Oxygen has been already initialized, so you
        // can access Oxygen functionality via relevant modules. 
        //
        beforeTest: function(runId, options, caps) {
        },
        beforeSuite: function(suiteDef) {
        },
        beforeCase: function(caseDef) {
            log.info('Hey there! Case is about to start.');
        },
        beforeCommand: function(cmdDef) {
        },
        afterCommand: function(cmdResult) {
        },
        afterCase: function(caseDef, caseResult) {
        },
        afterSuite: function(suiteDef, suiteResult) {
        },
        afterTest: function(runId, testResult) {
        }
    }
};
PreviousTestObjectNextLocating Elements

Last updated 4 years ago

Was this helpful?

Please see the for an example of a project configuration file.

Sample Project