- Install Node.js v6.10.3 or greater.
- Create a new folder <AUTOMATED_TESTS> in your project to host your automated tests.
- Add a
package.jsonfile into <AUTOMATED_TESTS> based on the below model:
{
"name": "my-automated-tests",
"version": "1.0.0",
"dependencies": {
"ntaf": "X.X.X",
},
"scripts": {
"clean": "grunt clean",
"generate-local-conf": "grunt copy:generateLocalConf",
"prepare": "grunt prepare",
"test": "grunt test-functional",
"test-local": "grunt test-functional-local",
"test-debug": "grunt test-functional-debug",
"test-unit": "grunt test-unit",
"test-unit-with-coverage": "grunt test-unit-with-coverage"
},
...
}
- Install the project dependencies by running the following command from <AUTOMATED_TESTS>:
npm install. It creates anode_modulesdirectory containing all the dependencies needed to run the project. - From <AUTOMATED_TESTS>, run
./node_modules/.bin/ntaf installto generate the skeleton of your test project.
Set the configuration of your proxy by editing the .npmrc file in your home directory:
proxy=http://localhost:3128
https-proxy=http://localhost:3128
Run npm run test to launch the tests as they would be played remotely.
By default it runs all the tests tagged as @nrt.
Run command line npm run test-local to run the tests with your local configuration.
The global configuration is set in the wdio.conf.js file in the root folder of your project.
The local configuration is set in the wdio.local.conf.js. This local configuration can be reset by running npm run generate-local-conf.
To pass parameters to the command, add --: npm run test -- --parameter1=value1
Add command line parameter --baseUrl="https://base.url" or update the wdio configuration file accordingly.
Add command line parameter --tags='@tag'.
You can add several tags separated by commas such as --tags='@tag1,@tag2'. It will run tests with tags @tag1 and @tag2.
You can also add negation with ~ such as--tags='@tag1,~@tag2'. It will tests with tag @tag1 but not @tag2.
For example, to run NRT tests from the catalog domain on mywebsite.com:
npm run test -- --baseUrl="https://mywebsite.com" --tags='@nrt,@catalog'
- Install
node-inspector:npm install -g node-inspector
- Go to Run > Edit Configurations...
- Add New Configuration > Node.js Remote Debug and fill in details as follows:

- In a terminal, run
node-inspector. The following should be printed:Node Inspector v0.12.8 Visit http://127.0.0.1:8080/?port=5858 to start debugging. - In IntelliJ, Run > Debug 'My Node.js Remote Debug'
- In IntelliJ, add breakpoints to your code
- In a terminal, run
npm run test-debug(usually targeting a single test:npm run test-debug -- --tags='@mytest') - Once the first breakpoint is reached, use standard IntelliJ Debug window to move forward and debug.
Read detailed explanations in Framework.md.