概述

Nightwatch 使您可以将测试脚本组织成组,并在需要时运行它们。要将测试分组在一起,只需将它们放在同一个子文件夹中即可。文件夹名称即为组的名称。

示例

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

要仅运行 smoketests 组,您需要执行以下操作

nightwatch --group smoketests

此外,如果您想跳过运行 smoketests 组,您需要执行以下操作

nightwatch --skipgroup smoketests

要跳过多个组,只需将它们添加为用逗号分隔的列表即可

nightwatch --skipgroup addressbook,chat