Suite files: How to make a suite read each csv named as test cases files?

Hello everyone!,

I’d like to ask you for help setting up a suite file for a group of about 50 inidvidual test cases that I have.

I know that the default behaviour of oxigen-cli is to automatically look for any csv or xlsx file named as the test case file and as such there are no problems when running directly each test case, i.e.:

oxygen-cli path/to/testCase.js

But when it comes to run those test cases by means of a suite file, I cannot find how to make oxigen-cli automatically look for a csv file named as each test case. Even when defining a single test case in a suite and declaring explicitly the parameter file for that test case inside the “parameter”: {file: ‘xxx’} section of the suite file, the suite runs without even reading the csv file contents.

I also tried to run:
oxygen oxygen.conf.js --pm=all -p path/to/testCase.csv
but same as before, the parameters values are not being read from csv files.

I’d like to ask you for a sample configuration file that cover this scenario. I know that the documentation site has an example but it seems to be covering the scenario of a single csv for a whole group of test cases within a given suite.

How can i configure a suite file so it can read each csv file with same name of each one of my test cases without having to explicitly write the path of the csv file for all of them?

Thanks.

I have been making a csv list of test cases and pointing the cli to the list. -p, --param=FILE, -i, --iter=COUNT(How many times to run against the list.)

Hi Mike, thanks for reply…

Well, my scenario is kinda different. While you are using a single csv file for a group of test cases, I have 1 csv file for each and every one of my test cases.
Each test case has different parameters so each test case might need to run a different number of times than other test case in the group, that’s why I am using --pm=all and not the --iter modifier.

Based on the documentation site, I wrote a suite config file like the following one:

const path = require('path');

module.exports = {
    //
    // ======
    // Suites
    // ======
    // Define your test suites here. 
    //
    suites: [{
        name: 'Unidad 1',
        cases: [{
            path: "./testCases/Some Directory 01/Caso123.js",
        },
        {
            path: "./testCases/Other Directory 01/Caso456.js",
        }]
    }],

    //
    // ============
    // Capabilities
    // ============
    // Define your capabilities here.
    // If "concurrency" value is greater than 1, tests with different capabilities will be executed in parallel.
    //
    concurrency: 1,
    capabilities: [{
        browserName: 'chrome',
    }],
 
    // ============
    // Parameters
    // ============
    //
    parameters : {
        mode: 'all'
    },

    // =======
    // 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 a list of available modules here: http://docs.oxygenhq.org/
    //
    modules: ['web', 'log', 'assert'],

    // =========
    // Reporting
    // =========
    // Define test reporter format and corresponding options. 
    // Multiple reporter formats can be specified.
    // Available reporters: json | html | junit | excel | pdf | xml
    //
    reporting: {
        outputDir: path.join(__dirname, 'reports'),
        reporters: ['html'],
    },

    //
    // =====
    // 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 via 'ox' global variable.
        //
        beforeTest: function(runId, options, caps) {
            console.log('Marco landed on beforeT');
        },
        beforeSuite: function(runId, suiteDef) {
            console.log('Marco landed on beforeS');
        },
        beforeCase: function(runId, caseDef) {
            web.init()
            log.info('Say hello before running this test case!')
            console.log('Marco landed on beforeC');
        },
        afterCase: async function(runId, caseResult, error) {
            console.log('Marco landed on afterC')
        },
        afterSuite: function(runId, suiteResult, error) {
            console.log('Marco landed on afterS')
        },
        afterTest: function(runId, testResult, error) {
            console.log('Marco landed on afterT')
        }
    }
};

When running each test case directly with oxygen-cli, the parameter file is read automatically, But when running a suite file they don’t get read. How can I specify that oxygen-cli looks for a csv file named as each test case that comprises the suite? without writing in the suite file the path to each one of my 50 csv filess??

Once again, thank you very much, I appreciate your helping me out.

You will need to use an older version I think. Check the changelog list in GitHub to determine which version this was removed in.

Short of that you can write a testrunner like I use. I use one js file to kickoff the list from the csv file.

Hi Marco and Mike,

In addition to the above, I believe that we have an unintended bug or defect and the dev team will get it fixed for using parameters with Suite test execution. I’ll keep you guys posted.
Marco, if you don’t mind - can you contact me by email - amos.feldman@cloudbeat.io
Thank you

1 Like

Any update on this issue? How do you pass parameters to individual test for the suite? The csv files would be diff for each testcase.

Hi Prasad,

Thank you for reaching out on this matter.

I’d like to discuss the requirement and solution further with you. Are you by chance based in the US? Would it be possible to setup a quick, 15 minute call to discuss your progress with Oxygen?

I am in San Diego, CA so my time zone is PST.

Thanks,

-Amos

646.372.9640

Any Update that you can share with the rest of us?

1 Like