Overview

Nightwatch makes it possible to organize your test scripts into groups and run them as needed. To group tests together just place them in the same sub-folder. The folder name is the name of the group.

Example

lib/
  β”œβ”€β”€ selenium-server-standalone.jar
custom-commands/
  β”œβ”€β”€ loginUser.js
  β”œβ”€β”€ attachPicture.js
tests/
  β”œβ”€β”€ logingroup
  |   β”œβ”€β”€ login_test.js
  |   └── otherlogin_test.js
  β”œβ”€β”€ addressbook
  |   β”œβ”€β”€ addressbook_test.js
  |   └── contact_test.js
  β”œβ”€β”€ chat
  |   β”œβ”€β”€ chatwindow_test.js
  |   β”œβ”€β”€ chatmessage_test.js
  |   └── otherchat_test.js
  └── smoketests
      β”œβ”€β”€ smoke_test.js
      └── othersmoke_test.js

To run only the smoketests group you would do the following:

nightwatch --group smoketests

Also, if you would want to skip running the smoketests group you would do the following:

nightwatch --skipgroup smoketests

To skip multiple groups, just add them as comma-separated:

nightwatch --skipgroup addressbook,chat
Improve this article