1

How to create data driven test using Nightwatch.js? I am using data.js file as global. The content is:

module.exports={
    username:'xyz@gmail.com',
    password:'12345',
    urls: {
        login: 'http://www.asdf.com'
    }
};
Pang
  • 9,564
  • 146
  • 81
  • 122
  • Mentioned link solution might be helpful for you. http://stackoverflow.com/questions/27617463/global-variable-in-nightwatch-issue-in-for-loop-for-node-js/30210672#30210672 – newbie May 13 '15 at 09:32

1 Answers1

3

By giving the your file path value in key "globals_path" of your nightwatch.json file like below, you don't need to rename your js file , you can use data.js file as global file:

"globals_path" : "path/to/data.js",

and in your test file you can call variable like this :

browser.globals.username etc

Juhi Saxena
  • 1,197
  • 11
  • 17