6 releases
new 0.1.5 | Jan 7, 2025 |
---|---|
0.1.4 | Jan 2, 2025 |
0.1.3 | Dec 30, 2024 |
#286 in Command line utilities
571 downloads per month
54KB
252 lines
Catch bugs and performance regressions through automated system testing
What is this?
Many CLI applications take an input file and generate an output file and/or write some value(s) to standard out, with various options set by the user. predate
is a simple example of how to test that the application is producing correct output given the arguments specified on the command line. Whilst there are libraries that can be used to test CLI applications, predate
is a simple example of how to do this without the need for additional dependencies, and where the commands and expected output are conveniently specified in a YAML file.
predate
is used to test the output of grepq
(https://crates.io/crates/grepq), and record the execution time of grepq
commands to avoid performance regression. Whilst predate
is specific to testing of grepq
, the code should be easily adapted for testing other CLI applications.
Requirements
predate
has been tested on Linux and macOS. It might work on Windows, but it has not been tested- Ensure that Rust is installed on your system (https://www.rust-lang.org/tools/install)
- If the build fails, make sure you have the latest version of the Rust compiler by running
rustup update
Installation
-
From crates.io
cargo install predate
-
From source
- Clone the repository and
cd
into thepredate
directory - Run
cargo build --release
- Relative to the cloned parent directory, the executable will be located in
./target/release
- Make sure the executable is in your
PATH
or use the full path to the executable
- Clone the repository and
How to use
[!NOTE]
predate
is specifically used to testgrepq
cd /path/to/grepq/examples
predate [OPTIONS] <PATH_TO_TESTS_YAML>
Usage: predate [OPTIONS] <PATH_TO_TESTS_YAML>
Arguments:
<PATH_TO_TESTS_YAML> Path to the tests YAML file
Options:
-j, --json-out Write test output to a JSON file
-c, --control Set the control
-h, --help Print help
Update changes
see CHANGELOG
License
MIT
Dependencies
~10–22MB
~321K SLoC