testThat {biodb}R Documentation

Run a test.

Description

Run a test function, using testthat framework. In addition to calling testthat::test_that().

Usage

testThat(msg, fct, biodb = NULL, conn = NULL, opt = NULL)

Arguments

msg

The test message.

fct

The function to test.

biodb

A valid BiodbMain instance to be passed to the test function.

conn

A connector instance to be passed to the test function.

opt

A set of options to pass to the test function.

Value

No value returned.

Examples

# Define a context before running tests:
biodb::testContext("Test my database connector.")

# Instantiate a BiodbMain instance for testing
biodb <- biodb::createBiodbTestInstance()

# Define a test function
my_test_function <- function(biodb) {
  # Do my tests...
}

# Run test
biodb::testThat("My test works", my_test_function, biodb=biodb)

# Terminate the instance
biodb$terminate()

[Package biodb version 1.2.2 Index]