Tests

Published

2025-01-17

Expand the callout boxes below to review what we’ve covered in the previous chapters on debugging:

In the Exploring code chapter we covered:

The applications in Chapter 10 (Exploring code) can be accessed with the launch() or get() functions from the shinypak R package:

# install.packages('pak')
pak::pak('mjfrigaard/shinypak')
library(shinypak)

Chapter 10 applications:

list_apps(regex = '^10')
## # A tibble: 1 × 2
##   branch      last_updated       
##   <chr>       <dttm>             
## 1 10_debugger 2025-01-17 13:59:16

In the Debugging apps chapter we covered:

The applications in Chapter 11 (Debugging apps) can be accessed with the launch() or get() functions from the shinypak R package:

# install.packages('pak')
pak::pak('mjfrigaard/shinypak')
library(shinypak)

Chapter 11 applications:

list_apps(regex = '^11')
## # A tibble: 1 × 2
##   branch         last_updated       
##   <chr>          <dttm>             
## 1 11_debug-print 2025-01-17 14:07:45

In the Print debugging chapter we covered:

The applications in Chapter 11 (Print debugging) can be accessed with the launch() or get() functions from the shinypak R package:

# install.packages('pak')
pak::pak('mjfrigaard/shinypak')
library(shinypak)

Chapter 12 applications:

list_apps(regex = '^12')
## # A tibble: 2 × 2
##   branch          last_updated       
##   <chr>           <dttm>             
## 1 12.1_debug-mods 2025-01-20 09:50:43
## 2 12.2_mod-comms  2025-01-20 09:53:35

In the Exploring code chapter we covered:

The applications in Chapter 13 (Utility functions) can be accessed with the launch() or get() functions from the shinypak R package:

# install.packages('pak')
pak::pak('mjfrigaard/shinypak')
library(shinypak)

Chapter 13 applications:

list_apps(regex = '^13')
## # A tibble: 1 × 2
##   branch     last_updated       
##   <chr>      <dttm>             
## 1 13-logging 2025-01-20 12:09:19

Testing your app

We’re now ready to test the code and features in our app-package. The next section covers the following topics:

Test suite

Test suite starts by showing how to create the testthat infrastructure then, dives into creating test files, the mechanics unit tests and expectations, and running tests during development

This chapter also introduces keyboard shortcuts for testing and testthat’s behavior-driven development functions:

Specifications

Specifications discusses how to collect and organize information to write tests for your application:

This chapter also gives examples of behavior-driven development tests features and how to track specifications and tests together:

Test tools

This chapter introduces:

Each tool can contribute to testing your Shiny app-package in a unique way (they’re also relatively recent additions to the testthat framework)

Testing modules

Shiny’s testServer() function can be useful for performing integration tests with module server functions. Testing modules gives examples of using testServer() to verify module communication (i.e., passing data between modules):

System tests

The final chapter in this section covers setting up and running system (or end-to-end tests with shinytest2):

Please open an issue on GitHub