#performance #cli-applications #testing #cli #yaml #system-testing

app predate

Catch bugs and performance regressions through automated system testing

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

Download history 129/week @ 2024-11-30 28/week @ 2024-12-07 2/week @ 2024-12-14 446/week @ 2024-12-28 122/week @ 2025-01-04

571 downloads per month

MIT license

54KB
252 lines

Catch bugs and performance regressions through automated system testing

Crates.io License

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 the predate 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

How to use

[!NOTE] predate is specifically used to test grepq

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