writeJUnit {tinytest2JUnit}R Documentation

Write the results of a tinytests-object into JUnit xml report.

Description

Write the tinytests-object to a JUnit XML reporting file.

Usage

writeJUnit(tinytests, file, overwrite = TRUE)

Arguments

tinytests

tinytests-object to convert to JUnit xml.

file

character(1): Full file path to the .xml file to write the JUnit xml to. Example: "/home/user/documents/results.xml".

overwrite

logical(1): should the file be overwritten if it already exist? By default TRUE.

Value

invisible: TRUE.

Side-effects

Side effects are registered as a tests in the JUnit output and have been given a status "SIDE-EFFECT". The call and diff is also returned in the standard-output of the testcase tag.

They are however not considered as failures and would thus not stop a pipeline.

Errors

In case of overwrite = FALSE and the file already exists an error is thrown.

See Also

The JUnit XML report format: https://llg.cubic.org/docs/junit/

Examples

# Run tests with `tinytest`
dirWithTests <- system.file("example_tests/multiple_files",package = "tinytest2JUnit")
testresults <- tinytest::run_test_dir(dirWithTests, verbose = FALSE)
# temporary output file to save JUnit XML to
tmpFile <- tempfile(fileext = ".xml")
writeJUnit(tinytests = testresults, file = tmpFile)

[Package tinytest2JUnit version 1.0.3 Index]