Tests Generator creates manual or automated test scenarios from steps description.
- Tests generating via graph traversal and rules management.
- Machine learning in tests building via Markov chains based approach.
npm i -g glace-testgen
Utility test-gen
will be available in console then.
-
Create file
steps.yml
and 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: null
-
Launch console and execute command:
test-gen /path/to/steps.yml
-
It will generate next scenarios:
Test case 1: - open app - authenticate - close app Test case 2: - open app - close app
-
Example 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.
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 (yaml
format).--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.
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 result
- Wait for finish
Generating tests from steps...
50 tests are generated during 419ms
- Open file
result.yml
to see generated tests.
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_train
- Launch training
test-gen --gen-train for_train.yml
- Wait for finish
Training model...
Model is trained during 18ms
- Training result is saved to
train-result.json
.
-
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 result
- Generated tests will be saved to file
result.yml
.
-
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 result
- Generated tests will be saved to file
result.yml
.