tesults-test 1.0.0

Rust test integration for Tesults — enhanced test reporting with #[tesults_test::test]
Documentation
  • Coverage
  • 50%
    4 out of 8 items documented0 out of 6 items with examples
  • Size
  • Source code size: 30.37 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 495.39 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ajeetd

tesults-test

A Rust integration for Tesults that replaces #[test] with #[tesults_test::test] to add enhanced test reporting — timing, descriptions, steps, custom fields, and file attachments — with no changes to how you run tests.

Installation

Add to [dev-dependencies] in Cargo.toml:

[dev-dependencies]
tesults-test = "1"

Usage

Replace #[test] with #[tesults_test::test]:

#[cfg(test)]
mod tests {
    #[tesults_test::test]
    fn it_adds() {
        assert_eq!(2 + 2, 4);
    }
}

Set TESULTS_TARGET and run tests as usual:

TESULTS_TARGET=token cargo test

Results are uploaded to Tesults once after all tests complete. If TESULTS_TARGET is not set, nothing is uploaded.

Enhanced reporting

Call these helpers inside a test body to enrich the result:

#[tesults_test::test]
fn checkout_flow() {
    tesults_test::description("Verifies the full checkout flow end to end");
    tesults_test::custom("env", "staging");
    tesults_test::custom("build", "1.4.2");

    tesults_test::step("open cart", "pass", "Cart page loads", "");
    tesults_test::step("enter address", "pass", "Address form submits", "");

    tesults_test::file("/tmp/screenshot.png");

    assert!(place_order());
}
Helper Purpose
tesults_test::description(text) Free-text description shown in Tesults
tesults_test::custom(key, value) Custom key-value field
tesults_test::step(name, result, desc, reason) Named step with pass/fail
tesults_test::file(path) File path to upload (screenshot, log, etc.)

#[should_panic]

Works as normal — #[should_panic] stays on the function and #[tesults_test::test] records the correct pass/fail:

#[tesults_test::test]
#[should_panic(expected = "overflow")]
fn panics_on_overflow() {
    let _: u8 = 200u8 + 200u8;
}

Config file (optional)

Keep tokens out of scripts with a key name and a config file:

TESULTS_TARGET=my-target TESULTS_CONFIG=/path/to/tesults.cfg cargo test

tesults.cfg format:

# Tesults target tokens
my-target = eyJ0eXAiOiJ...
staging   = eyJ0eXAiOiK...

Suite names

The suite for each test is derived from its Rust module path. A test in my_crate::tests is reported under suite tests. Tests in integration test files (tests/my_test.rs) use the file stem as the suite name.

Documentation

https://www.tesults.com/docs/rust-test