Skip to contents

Extract relevant information from a testthat_results object into a tidy tibble::tibble().

Usage

CompileTestResults(lTestResults)

Arguments

lTestResults

(testthat_results) A testthat test results object, typically obtained by running something like testthat::test_local() with stop_on_failure = FALSE and a reporter that doesn't cause issues in parallel testing, like reporter = "silent", and assigning it to a name.

Value

A qcthat_TestResults object, which is a tibble::tibble() with columns:

  • Test: The desc field of the test from testthat::test_that().

  • File: File where the test is defined.

  • Disposition: Factor with levels pass, fail, and skip indicating the overall outcome of the test.

  • Issues: List column containing integer vectors of associated GitHub issue numbers.

Examples

# Generate a test results object.

# lTestResults <- testthat::test_local(
#  stop_on_failure = FALSE,
#  reporter = "silent"
# )

lTestResults <- structure(
  list(
    list(
      file = "test-file1.R",
      test = "First test with one GH issue (#32)",
      results = list(
        structure(
          list(),
          class = c("expectation_success", "expectation", "condition")
        )
      )
    ),
    list(
      file = "test-file1.R",
      test = "Second test with two GH issues (#32, #45)",
      results = list(
        structure(
          list(),
          class = c("expectation_failure", "expectation", "error", "condition")
        )
      )
    )
  ),
  class = "testthat_results"
)
CompileTestResults(lTestResults)
#> # A tibble: 2 × 4
#>   Test                                      File         Disposition Issues   
#> * <chr>                                     <chr>        <fct>       <list>   
#> 1 First test with one GH issue (#32)        test-file1.R pass        <int [1]>
#> 2 Second test with two GH issues (#32, #45) test-file1.R fail        <int [2]>