0

I would like to know how I could provide an array of variables and let Jasmine run all the tests using each time one of those values.

For the story :

  • I am using jasmine and webdriver to test our website. Webdriver is an automation tool to open a chosen browser and drive it to make tests.
  • I do have a bank of tests which for now a hardcoded browser goes along
  • I would like to have a list of supported browsers ["safari", "chrome",…] and run the same test for all of those browsers without changing anything to the code.

An option could be to run jasmine through a shell script and pass the browser global variable before every invocation but I do not like much this idea.

PS: This questions could be related to this one

Community
  • 1
  • 1
Flavien Volken
  • 19,196
  • 12
  • 100
  • 133
  • Typically that would be done through a test runner (karma, chutzpah, etc). Most of which have config options to support multiple, user configurable, browsers. – ktharsis Oct 14 '15 at 19:29

1 Answers1

0

With karma you can pass an array of browsers you want to test.

module.exports = function (config) {
    config.set({

        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '..',


        // frameworks to use
        frameworks: [
            'jasmine'
        ],

        // Here the rest of the config


        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['Chrome', 'Safari'],    
    })
};
Nicolas Hefti
  • 303
  • 2
  • 9