Skip to content

qurity/qutonium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

qutonium

github crates.io docs.rs Crates.io


simplify unit testing with a minimal testing framework πŸ“ˆ

DISCLAIMER

qutonium is takes is inspiration from the rust-testing-microframework. the goal is to provide a minimal testing framework for assertions (see the list of features here). the project is still in work in progress so.. DO NOT USE IN PRODUCTION. DO NOT USE IN PRODUCTION. DO NOT USE IN PRODUCTION. feedbacks appreciated!

Examples

more examples here

basic syntax

fn main () {}

#[cfg(test)]
mod tests {
  extern crate qutonium;
  use qutonium::prelude::*;

  #[test]
  fn from_test () {
    suite!("the suite case name ~basic", {
      "compare integer" || {
        expect!(2 + 2).to(be_equal(4));
      }
    });
  }
}

sugar syntax

fn main () {}

#[cfg(test)]
mod tests {
  extern crate qutonium;
  use qutonium::prelude::*;

  #[test]
  fn from_test () {
    suite!("the suite case name ~sugar", {
      "compare integer" || {
        must!(2 + 2; be 4);
      }
    });
  }
}

Overview

stdout

The output format follow the syntax from crystal | ruby. s/o Siegfried Ehret

SUITE the suite case name
  TEST compare integer (0ms)
    ERROR
       πŸ‘Ž received: <0> expected: <1>
       πŸ“ src/main.rs:7:7
    END
  END
  TEST compare boolean (0ms)
    SUCCESS
       πŸ‘ ok
       πŸ“ src/main.rs:12:7
    END
  END
  TEST testing should panic (0ms)
    SUCCESS
       πŸ‘ ok
       πŸ“ src/main.rs:16:7
    END
  END
END

DIAGNOSTIC
  πŸ‘Ž failed: 1   πŸ‘ passed: 2   πŸ“ˆ total: 3
END

Usage

Add the following to your Cargo.toml:

[dependencies]
qutonium = "0.1.3"

Goals

  • describe suite case | suite!
  • test function |
  • assertions | expect
  • marker | not & to
  • matchers | see the complete list here
  • extended matchers
  • custom matchers
  • diagnostics
  • error location
  • helpful error messages
  • sugar syntax
  • no nested suites
  • inline stdout
  • colorized terminal output | using qute crate
  • snapshot diff | using differences crate
  • extended matchers
  • hooks | before:all, before:each, after:all and after:each
  • export json, xml | generic execution format for sonar (xml only)
  • Exclude test cases | skip and only
  • store | state container
  • should panic can be testing
  • writing unit testing
  • documentation

API

Exports

json

handler snippet
to_json see more informations about the export here

Markers

marker snippet
to expect!(expr).to(matcher)
not expect!(expr).not(matcher)

Matchers

boolean

matcher snippet
be_false expect!(expr).to(be_false())
be_true expect!(expr).to(be_true())

common

matcher snippet
be_equal expect!(expr).to(be_equal(expr))

License

Copyright ©️ 2020 Qurity

Released under the MIT license

About

simplify unit testing with a testing framework πŸ“ˆ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages