MCPcopy Index your code
hub / github.com/enokson/laboratory

github.com/enokson/laboratory @2.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.0.0 ↗ · + Follow
179 symbols 624 edges 27 files 6 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

laboratory

A simple, expressive unit test framework for Rust

GitHub Workflow Status (branch) Crates.io Crates.io

Checkout the documentation and the extensive examples over on github.

Laboratory is layer 2 test runner solution that sits on top of the Rust test runner to provide unparalleled features and ease of use.

Features

  • before_all, before_each, after_all, after_each hooks
  • Different reporter options: spec, minimal, json, json-pretty, rust, dot, tap, list
  • Reports test durations in: nanoseconds, microseconds, milliseconds and seconds
  • The use of custom assertion libraries
  • Exclude tests
  • Nested test suites
  • Test retry support
  • The use of state
  • "should panic" testing
  • Console highlighting
  • Dynamic testing
  • Highlights slow tests
  • No weird macros to try to figure out or debug!
  • Human readable code and test results

Installation

In Cargo.toml:

[dev-dependencies]
laboratory = "*"

Then in your test files

#[cfg(test)]
mod tests {
    use laboratory::{describe, describe_skip, it, it_skip, it_only, expect};
}

Getting Started

Testing a simple function

// from examples/simple.rs
//###SIMPLE###//

Then run: ```shell script $ cargo test -- --nocapture


Result:  

//###SIMPLE-RESULT###// ```

Core symbols most depended-on inside this repo

expect
called by 46
src/assertion.rs
to_equal
called by 37
src/assertion.rs
describe
called by 22
src/suite.rs
run
called by 20
src/suite.rs
describe
called by 20
src/suite_context.rs
to_string
called by 19
src/reporter.rs
state
called by 18
src/suite.rs
to_string
called by 12
src/suite.rs

Shape

Function 95
Method 66
Class 13
Enum 5

Languages

Rust98%
TypeScript2%

Modules by API surface

src/suite.rs36 symbols
src/reporter.rs30 symbols
src/suite_context.rs19 symbols
src/assertion.rs11 symbols
src/spec.rs9 symbols
examples/nested-suites.rs6 symbols
examples/state.rs5 symbols
examples/importing-tests.rs5 symbols
examples/reporter_tap.rs4 symbols
examples/reporter_list.rs4 symbols
examples/reporter_json_pretty.rs4 symbols
examples/reporter_json.rs4 symbols

For agents

$ claude mcp add laboratory \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact