testthat 0.11.0

October 15, 2015
By

(This article was first published on RStudio Blog, and kindly contributed to R-bloggers)

testthat 0.11.0 is now available on CRAN. Testthat makes it easy to turn your existing informal tests into formal automated tests that you can rerun quickly and easily. Learn more at http://r-pkgs.had.co.nz/tests.html. Install the latest version with:

install.packages("testthat")

In this version:

  • New expect_silent() ensures that code produces no output, messages, or warnings. expect_output(), expect_message(), expect_warning(), and expect_error() now accept NA as the second argument to indicate that there shouldn’t be any output, messages, warnings, or errors (i.e. they should be missing)
    f <- function() {
      print(1)
      message(2)
      warning(3)
    }
    expect_silent(f())
    #> Error: f() produced output, warnings, messages
    
    expect_warning(log(-1), NA)
    #> Error: log(-1) expected no warnings:
    #> *  NaNs produced
  • Praise gets more diverse thanks to Gabor Csardi’s praise package, and you now also get random encouragment if your tests don’t pass.
  • testthat no longer muffles warning messages. This was a bug in the previous version, as warning messages are usually important and should be dealt with explicitly, either by resolving the problem or explicitly capturing them with expect_warning().
  • Two new skip functions make it easier to skip tests that don’t work in certain environments: skip_on_os() skips tests on the specified operating system, and skip_on_appveyor() skips tests on Appveyor.

There were a number of other minor improvements and bug fixes. See the release notes for a complete list.

A big thanks goes out to all the contributors who made this release happen. There’s no way I could be as productive without the fantastic commmunity of R developers who come up with thoughtful new features, and who discover and fix my bugs!

To leave a comment for the author, please follow the link and comment on their blog: RStudio Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)