Skip to content

`testthat` unit tests for R Programming Coursera course Assignment 3.

Notifications You must be signed in to change notification settings

cbryant1000/pa3test

Repository files navigation

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,


About

`testthat` unit tests for R Programming Coursera course Assignment 3.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages