Giter VIP home page Giter VIP logo

junit-report-rs's Introduction

JUnit Report in Rust

Generate JUnit compatible XML reports in Rust.

Example

    extern crate junit_report;

    use junit_report::{Report, TestCase, TestSuite, Duration, TimeZone, Utc};
    use std::str;


    let timestamp = Utc.ymd(1970, 1, 1).and_hms(0, 1, 1);

    let mut r = Report::new();
    let mut ts1 = TestSuite::new("ts1");
    ts1.set_timestamp(timestamp);
    let mut ts2 = TestSuite::new("ts2");
    ts2.set_timestamp(timestamp);

    let test_success = TestCase::success("good test", Duration::seconds(15), Some("MyClass".to_string()));
    let test_error = TestCase::error(
        "error test",
        Duration::seconds(5),
        "git error",
        "unable to fetch",
        None,
    );
    let test_failure = TestCase::failure(
        "failure test",
        Duration::seconds(10),
        "assert_eq",
        "not equal",
        None,
    );

    ts2.add_testcase(test_success);
    ts2.add_testcase(test_error);
    ts2.add_testcase(test_failure);

    r.add_testsuite(ts1);
    r.add_testsuite(ts2);

    let mut out: Vec<u8> = Vec::new();

    r.write_xml(&mut out).unwrap();

junit-report-rs's People

Contributors

andoriyu avatar bachp avatar johnterickson avatar malteschledjewski avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.