`testthat` unit tests for R Programming Coursera course Assignment 3.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


PA3-test: testthat

##Unit Tests for Programming Assignment 3

This project is an implementation of testthat unit tests for the Coursera R Programming course Assignment 3. The testthat package was written by Hadley Wickham to enable unit testing of the 'stringr' string manipulation package during development. The unit tests implement the examples given in the Instructions for Programming Assignment 3.

| Function Name | Description | testthat Script

---|--------------------|------------------------------|--------------------------------------------- 1 | best | Finding the best hospital in a state | test-best.r 2 | rankhospital | Ranking hospitals by outcome in a state | test-rankhospital.r 3 | rankall | Ranking hospitals in all states | test-rankall.r

Running the testthat Scripts

  1. source the script for the assignment into your R working environment.
  • E.g., > source("best.R")
  1. source the matching testthat script into your environment.
  • > source("test-best.r")
  • >
  1. Notice how unobtrusive testthat is, if there is no error.

You can also run scripts using the test_file function.

> test_file("test-best.r")
Finding the best hospital in a state : .....


A little more verbose, but still pretty quiet.

More Information

For more information on the testthat package see,