Skip to content

@hadley hadley released this Sep 23, 2014 · 1059 commits to master since this release

testthat 0.9

New features

  • BDD: testhat now comes with an initial behaviour driven development (BDD)
    interface. The language is similiar to RSpec for Ruby or Mocha for JavaScript.
    BDD tests read like sentences, so they should make it easier to understand
    the specification of a function. See ?describe() for further information
    and examples.
  • It's now possible to skip() a test with an informative message - this is
    useful when tests are only available under certain conditions, as when
    not on CRAN, or when an internet connection is available (#141).
  • skip_on_cran() allows you to skip tests when run on CRAN. To take advantage
    of this code, you'll need either to use devtools, or run
    Sys.setenv(NOT_CRAN = "true"))
  • Simple mocking: with_mock() makes it easy to temporarily replace
    functions defined in packages. This is useful for testing code that relies
    on functions that are slow, have unintended side effects or access resources
    that may not be available when testing (#159, @krlmlr).
  • A new expectation, expect_equal_to_reference() has been added. It
    tests for equality to a reference value stored in a file (#148, @jonclayden).

Minor improvements and bug fixes

  • auto_test_package() works once more, and now uses devtools::load_all()
    for higher fidelity loading (#138, #151).
  • Bug in compare.character() fixed, as reported by Georgi Boshnakov.
  • colourise() now uses option testthat.use_colours (default: TRUE). If it
    is FALSE, output is not colourised (#153, @mbojan).
  • is_identical_to() only calls all.equal() to generate an informative
    error message if the two objects are not identical (#165).
  • safe_digest() uses a better strategy, and returns NA for directories
    (#138, #146).
  • Random praise is renabled by default (again!) (#164).
  • Teamcity reporter now correctly escapes output messages (#150, @windelinckx).
    It also uses nested suites to include test names.

Deprecated functions

  • library_if_available() has been deprecated.
Assets 2
You can’t perform that action at this time.