GlaceJS Tests Generator
Annotation
Tests Generator creates manual or automated test scenarios from steps description.
Features
- Tests generating via graph traversal and rules management.
- Machine learning in tests building via Markov chains based approach.
Installation
npm i -g glace-testgenUtility test-gen will be available in console then.
Quick Start
Create file
steps.ymland fill with content:- name: open app income: null outcome: app: true - name: authenticate income: app: true outcome: app: auth: true - name: close app income: app: true outcome: nullLaunch console and execute command:
test-gen /path/to/steps.ymlIt will generate next scenarios:
Test case 1: - open app - authenticate - close app Test case 2: - open app - close appExample of glace-js steps description for autotests generating.
Example of glace-proxy steps description for autotests generating.
More details about steps description you may find here.
Console Options
Utility usage:
test-gen path/to/steps/file [options]Steps file may be .json or .yaml (.yml).
Arguments:
--config [path], -c- Path to JSON file with CLI arguments. Default iscwd/config.json(if it exists).
Log:
--stdout-log- Print log messages to stdout.--log [path]- Path to log file. Default iscwd/glace.log.--log-level [level]- Log level. Default isdebug.
Test-gen:
--gen-output-file <path>- Path to output file (yamlformat).--gen-steps-filter <chunk>- Chunk of step name to filter tests.--gen-steps-uniq [number]- Number of steps in unique sequence to filter tests. Default isunlimited.--gen-steps-limit [number]- Maximum amount of steps per test. Default isunlimited.--gen-steps-usage <number>- Number of steps usage in test case.--gen-steps-files <sequence>- Space-separated sequence of paths to steps file (yaml or json format). As alternate to specify path to steps file in plugin mode.--gen-tests-limit [number]- Maximum amount of generated tests per iteration. Default is1000000.--gen-tests-max <number>- Maximum amount of final tests.--gen-tests-reverse- Reverse order of final tests.--gen-tests-files <sequence>- Space-separated sequence of paths to files with pregenerated tests (yaml or json format).--gen-tests-only- Flag to exclude other found tests and launch only generated tests in plugin mode.--gen-tests-shuffle- Shuffle tests during generating. Provides more steps sequence randomization, but tests will be different in generating runs.--gen-train <path>- Load tests from path for training, launch generator in train mode and save result to file.--gen-train-result [path]- Path to file with training result. Default iscwd/train-result.json.--gen-load-train <path>- Path to file with pretrained model, which will be loaded before generating.--gen-train-before <path>- Path to file with tests for training before generating.--gen-names-only- Flag to print only step names.
Common:
--version- Show version number.-h, --help- Show help.
How To
How to generate tests quickly
If you have several dozens of steps, tests building with unlimited parameters may require a long time. Use options
--gen-steps-uniq, --gen-tests-limit, --gen-steps-limit for efficient optimisation of consumed time.
Download example with steps description.
Launch command
test-gen e2e.steps.yaml --gen-steps-uniq 2 --gen-tests-limit 150 --gen-output-file resultWait for finish
Generating tests from steps... 50 tests are generated during 419msOpen file
result.ymlto see generated tests.
How to train generator model
For training you need a file with test samples in yaml format.
Download example with steps description.
Generate 10 tests
test-gen e2e.steps.yaml --gen-steps-uniq 2 --gen-tests-limit 150 --gen-tests-max 10 --gen-output-file for_trainLaunch training
test-gen --gen-train for_train.ymlWait for finish
Training model... Model is trained during 18msTraining result is saved to
train-result.json.
How to use trained model for generating
Train model from example above.
Launch command
test-gen e2e.steps.yaml --gen-steps-uniq 2 --gen-tests-limit 150 --gen-load-train train-result.json --gen-output-file resultGenerated tests will be saved to file
result.yml.
How to train model on fly in generating
Prepare test samples for training from example above.
Launch command
test-gen e2e.steps.yaml --gen-steps-uniq 2 --gen-tests-limit 150 --gen-train-before for_train.yml --gen-output-file resultGenerated tests will be saved to file
result.yml.