Difference between revisions of "RPR-Unit testing"
m |
m |
||
Line 1: | Line 1: | ||
<div id="ABC"> | <div id="ABC"> | ||
− | <div style="padding:5px; border:1px solid #000000; background-color:# | + | <div style="padding:5px; border:1px solid #000000; background-color:#f4d7b7; font-size:300%; font-weight:400; color: #000000; width:100%;"> |
Testing R code | Testing R code | ||
− | <div style="padding:5px; margin-top:20px; margin-bottom:10px; background-color:# | + | <div style="padding:5px; margin-top:20px; margin-bottom:10px; background-color:#f4d7b7; font-size:30%; font-weight:200; color: #000000; "> |
(Code testing in R with the testthat package) | (Code testing in R with the testthat package) | ||
</div> | </div> | ||
Line 10: | Line 10: | ||
− | <div style="padding:5px; border:1px solid #000000; background-color:# | + | <div style="padding:5px; border:1px solid #000000; background-color:#f4d7b733; font-size:85%;"> |
<div style="font-size:118%;"> | <div style="font-size:118%;"> | ||
<b>Abstract:</b><br /> | <b>Abstract:</b><br /> | ||
Line 41: | Line 41: | ||
<section begin=deliverables /> | <section begin=deliverables /> | ||
<!-- included from "./data/ABC-unit_components.txt", section: "deliverables-time_management" --> | <!-- included from "./data/ABC-unit_components.txt", section: "deliverables-time_management" --> | ||
− | + | <li><b>Time management</b>: Before you begin, estimate how long it will take you to complete this unit. Then, record in your course journal: the number of hours you estimated, the number of hours you worked on the unit, and the amount of time that passed between start and completion of this unit.</li> | |
<!-- included from "./data/ABC-unit_components.txt", section: "deliverables-journal" --> | <!-- included from "./data/ABC-unit_components.txt", section: "deliverables-journal" --> | ||
− | + | <li><b>Journal</b>: Document your progress in your [[FND-Journal|Course Journal]]. Some tasks may ask you to include specific items in your journal. Don't overlook these.</li> | |
<!-- included from "./data/ABC-unit_components.txt", section: "deliverables-insights" --> | <!-- included from "./data/ABC-unit_components.txt", section: "deliverables-insights" --> | ||
− | + | <li><b>Insights</b>: If you find something particularly noteworthy about this unit, make a note in your [[ABC-Insights|'''insights!''' page]].</li> | |
<section end=deliverables /> | <section end=deliverables /> | ||
<!-- ============================ --> | <!-- ============================ --> | ||
Line 52: | Line 52: | ||
<b>Prerequisites:</b><br /> | <b>Prerequisites:</b><br /> | ||
<!-- included from "./data/ABC-unit_components.txt", section: "notes-prerequisites" --> | <!-- included from "./data/ABC-unit_components.txt", section: "notes-prerequisites" --> | ||
− | This unit builds on material covered in the following prerequisite units: | + | This unit builds on material covered in the following prerequisite units:<br /> |
*[[FND-CSC-Test_driven_development|FND-CSC-Test_driven_development (Test Driven Development)]] | *[[FND-CSC-Test_driven_development|FND-CSC-Test_driven_development (Test Driven Development)]] | ||
<section end=prerequisites /> | <section end=prerequisites /> | ||
Line 61: | Line 61: | ||
+ | {{REVISE}} | ||
{{Smallvspace}} | {{Smallvspace}} |
Revision as of 12:40, 16 September 2020
Testing R code
(Code testing in R with the testthat package)
Abstract:
This unit discusses how to put tests in R into practice with the testthat package.
Objectives:
|
Outcomes:
|
Deliverables:
Prerequisites:
This unit builds on material covered in the following prerequisite units:
Contents
Task:
- Open RStudio and load the
ABC-units
R project. If you have loaded it before, choose File → Recent projects → ABC-Units. If you have not loaded it before, follow the instructions in the RPR-Introduction unit. - Choose Tools → Version Control → Pull Branches to fetch the most recent version of the project from its GitHub repository with all changes and bug fixes included.
- Type
init()
if requested. - Open the file
RPR-Unit_testing.R
and follow the instructions.
Note: take care that you understand all of the code in the script. Evaluation in this course is cumulative and you may be asked to explain any part of code.
Self-evaluation
Notes
Further reading, links and resources
If in doubt, ask! If anything about this learning unit is not clear to you, do not proceed blindly but ask for clarification. Post your question on the course mailing list: others are likely to have similar problems. Or send an email to your instructor.
About ...
Author:
- Boris Steipe <boris.steipe@utoronto.ca>
Created:
- 2017-08-05
Modified:
- 2017-08-05
Version:
- 1.0
Version history:
- 1.0 New contents
- 0.1 First stub
This copyrighted material is licensed under a Creative Commons Attribution 4.0 International License. Follow the link to learn more.