table of contents
other versions
- wheezy-backports 0.12-1~bpo70+1
- jessie 0.12-1
- jessie-backports 0.27-1~bpo8+1
- testing 0.27-1
- unstable 0.27-1
YARN(1) | General Commands Manual | YARN(1) |
NAME¶
yarn - scenario testing of Unix command line toolsSYNOPSIS¶
yarn [--allow-missing-steps] [--config=FILE] [--dump-config] [--dump-memory-profile=METHOD] [--dump-setting-names] [--env=NAME=VALUE] [--generate-manpage= TEMPLATE] [-h] [--help] [--list-config-files] [--log=FILE] [--log-keep=N] [--log-level=LEVEL] [--log-max=SIZE] [--log-mode=MODE] [-n] [--no-act] [--dry-run] [--pretend] [--no-default-configs] [--output=FILE] [-q] [--quiet] [-r=SCENARIO] [--run=SCENARIO] [-s=SHELL-LIBRARY] [--shell-library=SHELL-LIBRARY] [--snapshot] [--tempdir= DIR] [--timings] [-v] [--verbose] [--version] [FILE]...DESCRIPTION¶
yarn is a scenario testing tool: you write a scenario describing how a user uses your software and what should happen, and express, using very lightweight syntax, the scenario in such a way that it can be tested automatically. The scenario has a simple, but strict structure:-
GIVEN some setup for the test WHEN thing that is to be tested happens THEN the post-conditions must be true
-
SCENARIO backups can be restored GIVEN some live data in a directory AND an empty backup repository WHEN a backup is made THEN the data case be restored FINALLY cleanup
-
IMPLEMENTS GIVEN some live data in a directory rm -rf "$TESTDIR/data" mkdir "$TESTDIR/data" echo foo > "$TESTDIR/data/foo"
-
IMPLEMENTS GIVEN an empty backup repository rm -rf "$TESTDIR/repo" mkdir "$TESTDIR/repo"
-
IMPLEMENTS WHEN a backup is made backup-program -r "$TESTDIR/repo" "$TESTDIR/data"
-
IMPLEMENTS THEN the data can be restored mkdir "$TESTDIR/restored" restore-program -r "$TESTDIR/repo" "$TESTDIR/restored" diff -rq "$TESTDIR/data" "$TESTDIR/restored"
-
IMPLEMENTS FINALLY cleanup echo nothing to do, actually
OPTIONS¶
- --allow-missing-steps
- allow scenarios to reference steps that do not exist, by warning about them, but otherwise ignoring the scenarios
- --config=FILE
- add FILE to config files
- --dump-config
- write out the entire current configuration
- --dump-memory-profile=METHOD
- make memory profiling dumps using METHOD, which is one of: none, simple, meliae, or heapy (default: simple)
- --dump-setting-names
- write out all names of settings and quit
- --env=NAME=VALUE
- add NAME=VALUE to the environment when tests are run
- --generate-manpage=TEMPLATE
- fill in manual page TEMPLATE
- -h, --help
- show this help message and exit
- --list-config-files
- list all possible config files
- --log=FILE
- write log entries to FILE (default is to not write log files at all); use "syslog" to log to system log, or "none" to disable logging
- --log-keep=N
- keep last N logs (10)
- --log-level=LEVEL
- log at LEVEL, one of debug, info, warning, error, critical, fatal (default: debug)
- --log-max=SIZE
- rotate logs larger than SIZE, zero for never (default: 0)
- --log-mode=MODE
- set permissions of new log files to MODE (octal; default 0600)
- -n, --no-act, --dry-run, --pretend
- do not actually run any tests, merely print what would be run
- --no-default-configs
- clear list of configuration files to read
- --output=FILE
- write output to FILE, instead of standard output
- -q, --quiet
- be quiet, avoid progress reporting, only show errors
- -r, --run=SCENARIO
- run only SCENARIO (this option can be repeated)
- -s, --shell-library=SHELL-LIBRARY
- include a shell library for the IMPLEMENTS sections to use
- --snapshot
- make snapshots of test working directory after each scenario step; you probably want to use this with --tempdir
- --tempdir=DIR
- use DIR as the temporary directory for tests; it should be empty or not exist
- --timings
- report wall clock time for each scenario and step
- -v, --verbose
- make progress reporting be more verbose ("wall of text"), instead of a one-line status info; this is turned automatically if there is not terminal
- --version
- show program's version number and exit
ENVIRONMENT¶
- DATADIR
- Fully qualified pathname to a temporary directory, in which the tests can use files. The temporary directory is removed at the end of the test execution, unless the user specifies otherwise with --snapshot.
- SRCDIR
- Fully qualitifed pathname to the directory in which the user ran yarn. This is useful when the tests want to change the directory.
EXAMPLE¶
To run yarn on all the scenarios in your current directory:-
yarn *.scenario
-
yarn --shell-library mylib.sh *.scenario