pub fn create_junit_report(
    doc: &mut Document,
    testsuites: &mut Node,
    reports: Vec<HurlResult>,
) -> Result<(), CliError> {
    let test_count: usize = testsuites
        .get_attribute("tests")
        .unwrap_or_else(|| "0".to_string())
        .parse()
        .unwrap_or(0);
    let count = test_count + reports.len();
    testsuites.set_attribute("tests", &count.to_string())?;
    testsuites.set_attribute("name", "Hurl")?;

    let mut failures: usize = 0;
    let mut time: u128 = 0;

    for report in reports {
        time += report.time_in_ms;
        failures += if report.success { 0 } else { 1 };

        let mut testsuite = create_test_suite(doc, &report)?;

        testsuites.add_child(&mut testsuite)?;

        append_report_to(doc, &mut testsuite, &report)?;
    }

    testsuites.set_attribute("time", &(time / 1000).to_string())?;
    testsuites.set_attribute("failures", &failures.to_string())?;
    Ok(())
}
/// Write a JUnit XML report to the specified `libxml::Document`, appending to the `testsuites`
/// node
Write a JUnit XML report to the specified `libxml::Document`, appending to the `testsuites`
node
Write a JUnit XML report to the specified ` libxml :: Document ` appending to the ` testsuites ` node
pub fn create_junit_report(
    doc: &mut Document,
    testsuites: &mut Node,
    reports: Vec<HurlResult>,
) -> Result<(), CliError> {
    let test_count: usize = testsuites
        .get_attribute("tests")
        .unwrap_or_else(|| "0".to_string())
        .parse()
        .unwrap_or(0);
    let count = test_count + reports.len();
    testsuites.set_attribute("tests", &count.to_string())?;
    testsuites.set_attribute("name", "Hurl")?;
    let mut failures: usize = 0;
    let mut time: u128 = 0;
    for report in reports {
        time += report.time_in_ms;
        failures += if report.success { 0 } else { 1 };
        let mut testsuite = create_test_suite(doc, &report)?;
        testsuites.add_child(&mut testsuite)?;
        append_report_to(doc, &mut testsuite, &report)?;
    }
    testsuites.set_attribute("time", &(time / 1000).to_string())?;
    testsuites.set_attribute("failures", &failures.to_string())?;
    Ok(())
}
pub fn create_junit_report ( doc : & mut Document , testsuites : & mut Node , reports : Vec < HurlResult > , ) -> Result < ( ) , CliError > { let test_count : usize = testsuites . get_attribute ( " " ) . unwrap_or_else ( | | " " . to_string ( ) ) . parse ( ) . unwrap_or ( 0 ) ; let count = test_count + reports . len ( ) ; testsuites . set_attribute ( " " , & count . to_string ( ) ) ? ; testsuites . set_attribute ( " " , " " ) ? ; let mut failures : usize = 0 ; let mut time : u128 = 0 ; for report in reports { time += report . time_in_ms ; failures += if report . success { 0 } else { 1 } ; let mut testsuite = create_test_suite ( doc , & report ) ? ; testsuites . add_child ( & mut testsuite ) ? ; append_report_to ( doc , & mut testsuite , & report ) ? ; } testsuites . set_attribute ( " " , & ( time / 1000 ) . to_string ( ) ) ? ; testsuites . set_attribute ( " " , & failures . to_string ( ) ) ? ; Ok ( ( ) ) }
Write a JUnit XML report to the specified `libxml::Document`, appending to the `testsuites`
node
Write a JUnit XML report to the specified ` libxml :: Document ` appending to the ` testsuites ` node
doc
&mut Document
testsuites
&mut Node
reports
Vec<HurlResult>
doc
&mut Document
testsuites
&mut Node
reports
Vec<HurlResult>