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