snaptest-cli
v2.6.2
Published
A command line tool for the SnapTest chrome extension
Downloads
19
Readme
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.
Install:
npm install -g snaptest-cli
Current official generators & styles:
nightwatch
: Generates code in the popular nightwatchJS framework. generator repository, project harnesscsharp
Generates code in C#. generator repository- NUnit style:
nunit
project scaffold/harness - XUnit style:
xunit
project scaffold/harness
- NUnit style:
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.
Quick usage:
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.
Reference
General flags:
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 tosnaptests
. - Framework type:
-r <offical framework/language>
- Generates tests in any of the offical frameworks. e.g.nightwatchjs
orcsharp
. - Style:
-s <offical style>
- Generates tests with specified style. e.g. for the csharp type,xunit
ornunit
are available. - 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 beuser
,org
, orproject
- Account id:
-a <account id>
- Specify the id of the account.
Requirements:
- MacOS (Windows coming soon)
- Node 4+