Tests

Published

2025-02-05

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

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:

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

Test tools was updated recently to include the new ensure package, which was designed for โ€œdrafting testthat unit testing code using LLMs.โ€

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