SnapTest CLI Tool:
SnapTest's cli tool to generate a test code folder. Digests SnapTest JSON and outputs a folder of tests that can be run in a variety of languages/frameworks.
npm install -g snaptest-cli
Current official generators & styles:
nightwatch: Generates code in the popular nightwatchJS framework. generator repository, project harness
csharpGenerates code in C#. generator repository
Each generator is accompanied by a project harness repository that will help you get setup with configuring/running your tests.
Want another language/framework generator? Let us know in the github issues section here.
Cloud vs Local mode.
- If you're utilizing SnapTest cloud, the cli will pull your test JSON directly from your cloud account via your access token and account flags.
- If you're only using "local" only, You can specify your test json via the
-i <path to test JSON file>flag.
From the SnapTest extensions dashboard, find the "code" icon/button next to the corresponding test folder. Follow the on-screen commands to copy a command into your terminal which will generate the folder and tests with your specifications.
These are most easily obtained by clicking on the "generate code" icons above tests or folders and copying/pasting the generated command.
- Generate only folder:
-f <folderId>- Generates only the specified folder.
- Output folder name:
-o <test folder name>- Lets you name the test folder whatever you'd like. It defaults to
- Framework type:
-r <offical framework/language>- Generates tests in any of the offical frameworks. e.g.
-s <offical style>- Generates tests with specified style. e.g. for the csharp type,
- Local JSON resource:
-i <path to test JSON file>- Specify a path to a local json file that you have exported via the SnapTest extension.
- Custom generator:
-c <path to custom generator index.js>- Specify a path to the index.js file of your custom generator. for more information, see custom generator docs.
Cloud access flags:
These are only required if you're utilizing the SnapTest cloud. Not required if you're generating from a local .json tests file.
These are most easily obtained by clicking on the "generate code" icons above tests or folders.
- Access token:
-t <access token>- Used to access your resources on the SnapTest Cloud. Not required if you're generating from a local .json file.
- Account type:
-a <account type>- Specify the type of account you're accessing. Can be
- Account id:
-a <account id>- Specify the id of the account.
- MacOS (Windows coming soon)
- Node 4+