Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

snaptest-cli

2.2.4 • Public • Published

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:

  1. nightwatch: Generates code in the popular nightwatchJS framework. generator repository, project harness
  2. csharp Generates 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.

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.

  1. Generate only folder: -f <folderId> - Generates only the specified folder.
  2. Output folder name: -o <test folder name> - Lets you name the test folder whatever you'd like. It defaults to snaptests.
  3. Framework type: -r <offical framework/language> - Generates tests in any of the offical frameworks. e.g. nightwatchjs or csharp.
  4. Style: -s <offical style> - Generates tests with specified style. e.g. for the csharp type, xunit or nunit are available.
  5. 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.
  6. 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.

  1. 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.
  2. Account type: -a <account type> - Specify the type of account you're accessing. Can be user, org, or project
  3. Account id: -a <account id> - Specify the id of the account.

Requirements:

  1. MacOS (Windows coming soon)
  2. Node 4+

Keywords

none

install

npm i snaptest-cli

Downloadsweekly downloads

110

version

2.2.4

license

MIT

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability