Skip to content

Commit

Permalink
Update README and docs
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <heinz@licenser.net>
  • Loading branch information
Licenser committed Jul 18, 2022
1 parent a3a3440 commit 746d370
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -53,3 +53,19 @@ extern crate serial_test;
for earlier versions.

You can then either add `#[serial]` or `#[serial(some_text)]` to tests as required.

For each test, a timeout can be specified with the `timeout_ms` parameter to the [serial](macro@serial) attribute. Note that
the timeout is counted from the first invocation of the test, not from the time the previous test was completed. This can
lead to some unpredictable behavior based on the number of parallel tests run on the system.
```rust
#[test]
#[serial(timeout_ms = 1000)]
fn test_serial_one() {
// Do things
}
#[test]
#[serial(test_name, timeout_ms = 1000)]
fn test_serial_another() {
// Do things
}
```
19 changes: 19 additions & 0 deletions serial_test_derive/src/lib.rs
Expand Up @@ -33,6 +33,7 @@ use std::ops::Deref;
/// If you want different subsets of tests to be serialised with each
/// other, but not depend on other subsets, you can add an argument to [serial](macro@serial), and all calls
/// with identical arguments will be called in serial. e.g.
///
/// ````
/// #[test]
/// #[serial(something)]
Expand Down Expand Up @@ -61,6 +62,24 @@ use std::ops::Deref;
/// `test_serial_one` and `test_serial_another` will be executed in serial, as will `test_serial_third` and `test_serial_fourth`
/// but neither sequence will be blocked by the other
///
/// For each test, a timeout can be specified with the `timeout_ms` parameter to the [serial](macro@serial) attribute. Note that
/// the timeout is counted from the first invocation of the test, not from the time the previous test was completed. This can
/// lead to some unpredictable behavior based on the number of parallel tests run on the system.
///
/// ````
/// #[test]
/// #[serial(timeout_ms = 1000)]
/// fn test_serial_one() {
/// // Do things
/// }
///
/// #[test]
/// #[serial(timeout_ms = 1000)]
/// fn test_serial_another() {
/// // Do things
/// }
/// ````
///
/// Nested serialised tests (i.e. a [serial](macro@serial) tagged test calling another) are supported
#[proc_macro_attribute]
#[proc_macro_error]
Expand Down

0 comments on commit 746d370

Please sign in to comment.