36  Automated testing and continuous integration

Learning Objectives

  1. Argue the costs and benefits of using automated test infrastructure
  2. Define continuous integration testing
  3. Explain why continuous integration testing is superior to manually running tests
  4. Define the following key concepts that underlie GitHub Actions:
    • Actions
    • Workflow
    • Event
    • Runner
    • Job
    • Step
  5. Use matrix GitHub Actions workflows to reduce workflow redundancy
  6. Use GitHub Actions to set-up automated running of tests by pytest upon push to any branch
  7. Use GitHub Actions to set-up automated running of tests by testthat upon push to any branch

36.1 Continuous Integration (CI)

Defined as the practice of frequently integrating code (e.g., several times a day) changes from contributors to a shared repository. Often the submission of code to the shared repository is combined with automated testing (and other things, such as style checking) to increase code dependability and quality.

36.1.1 Why use CI + automated testing

  • detects errors sooner
  • reduces the amount of code to be examined when debugging
  • facilitates merging
  • ensures new code additions do not introduce errors