1# assert_cmd
2
3> **Assert `process::Command`** - Easy command initialization and assertions.
4
5[![Build Status](https://dev.azure.com/assert-rs/assert-rs/_apis/build/status/assert_cmd?branchName=master)](https://dev.azure.com/assert-rs/assert-rs/_build/latest?definitionId=3&branchName=master)
6[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
7![License](https://img.shields.io/crates/l/assert_cmd.svg)
8[![Crates Status](https://img.shields.io/crates/v/assert_cmd.svg)](https://crates.io/crates/assert_cmd)
9
10`assert_cmd` aims to simplify the process for doing integration testing of CLIs, including:
11- Finding your crate's binary to test
12- Assert on the result of your program's run.
13
14## Example
15
16Here's a trivial example:
17
18```rust,no_run
19use assert_cmd::Command;
20
21let mut cmd = Command::cargo_bin("bin_fixture").unwrap();
22cmd.assert().success();
23```
24
25See the [docs](http://docs.rs/assert_cmd) for more.
26
27## Relevant crates
28
29Other crates that might be useful in testing command line programs.
30* [escargot][escargot] for more control over configuring the crate's binary.
31* [duct][duct] for orchestrating multiple processes.
32  * or [commandspec] for easier writing of commands
33* [rexpect][rexpect] for testing interactive programs.
34* [`assert_fs`][assert_fs] for filesystem fixtures and assertions.
35  * or [tempfile][tempfile] for scratchpad directories.
36* [dir-diff][dir-diff] for testing file side-effects.
37
38[escargot]: http://docs.rs/escargot
39[rexpect]: https://crates.io/crates/rexpect
40[dir-diff]: https://crates.io/crates/dir-diff
41[tempfile]: https://crates.io/crates/tempfile
42[duct]: https://crates.io/crates/duct
43[assert_fs]: https://crates.io/crates/assert_fs
44[commandspec]: https://crates.io/crates/commandspec
45
46## License
47
48Licensed under either of
49
50 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
51 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
52
53at your option.
54
55### Testimonials
56
57fitzgen
58> assert_cmd is just such a pleasure to use every single time, I fall in love all over again
59>
60> bravo bravo WG-cli
61
62passcod
63> Running commands and dealing with output can be complex in many many ways, so assert_cmd smoothing that is excellent, very much welcome, and improves ergonomics significantly.
64
65volks73
66>  I have used [assert_cmd] in other projects and I am extremely pleased with it
67
68coreyja
69> [assert_cmd] pretty much IS my testing strategy so far, though my app under test is pretty small.
70>
71> This library has made it really easy to add some test coverage to my project, even when I am just learning how to write Rust!
72
73### Contribution
74
75Unless you explicitly state otherwise, any contribution intentionally
76submitted for inclusion in the work by you, as defined in the Apache-2.0
77license, shall be dual licensed as above, without any additional terms or
78conditions.
79
80[Crates.io]: https://crates.io/crates/assert_cmd
81[Documentation]: https://docs.rs/assert_cmd
82