rsspec 0.1.0

A Ginkgo/RSpec-inspired BDD testing framework for Rust.
Documentation

rsspec — A Ginkgo/RSpec-inspired BDD testing framework for Rust

Write expressive, structured tests using a familiar BDD syntax with describe, context, it, lifecycle hooks, table-driven tests, and more.

Three ways to run tests

  • [suite!] — generates #[test] functions, works with cargo test
  • [bdd!] — generates a main() with colored tree output (harness = false)
  • [bdd_suite!] — returns test nodes for combining multiple suites

Quick example

rsspec::suite! {
    describe "Calculator" {
        before_each {
            let a = 2;
            let b = 3;
        }

        subject { a + b }

        it "adds two numbers" {
            assert_eq!(subject, 5);
        }

        context "with negative numbers" {
            it "handles negatives" {
                assert_eq!(-1 + b, 2);
            }
        }
    }
}

Features

  • macros (default) — enables suite!, bdd!, bdd_suite! macros
  • googletest — re-exports googletest matchers via rsspec::matchers

See the [suite!] macro documentation for the full DSL reference.