-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.qmd
155 lines (108 loc) · 4.14 KB
/
tests.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Tests {#sec-tests .unnumbered}
```{r}
#| eval: true
#| echo: false
#| include: false
source("_common.R")
library(shinypak)
```
Expand the callout boxes below to review what we've covered in the previous chapters on debugging:
:::: {.callout-tip collapse="true" title="Review Chapters 10 - 13"}
::: {.callout-note collapse='true'}
#### Debuggers (Chapter 10)
In the [Debuggers](debugger.qmd) chapter we covered:
- @sec-debug-browser
- @sec-debug-reactive-browse
- @sec-debug-ide-changes
- @sec-debug-vars-values
- @sec-debug-inspect-vars
- @sec-debug-inspect-values
:::
::: {.callout-note collapse='true'}
#### Print debugging (Chapter 11)
In the [Print debugging](debug_print.qmd) chapter we covered:
- @sec-print-debug
- @sec-print-debug-observe-cat-print
- @sec-print-debug-reactive-values-to-list
:::
::: {.callout-note collapse='true'}
#### Debugging apps (Chapter 12)
In the [Debugging apps](debug_apps.qmd) chapter we covered:
- @sec-debug-apps-abstract-syntax-trees
- @sec-debug-apps-modules
- @sec-debug-apps-input-modules
- @sec-debug-ui
- @sec-debug-server
- @sec-debug-apps-module-comms
- @sec-debug-apps-verify-inputs
:::
::: {.callout-note collapse='true'}
#### Logging (Chapter 13)
In the [Logging](logging.qmd) chapter we covered:
- @sec-logging-why
- @sec-logging-arch-tidy-movies
- @sec-logging-validate
- @sec-logging-trycatch
- @sec-logging-funs
- @sec-logging-events
- @sec-logging-logger
- @sec-logging-levels
- @sec-logging-files
- @sec-logging-logr_msg
- @sec-logging-debugging
- @sec-logging-arch-movies
- @sec-logging-pkg-startup-msg
- @sec-logging-on-attach
:::
::::
# 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](test_suite.qmd) 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:
+ @sec-tests-suite-use-testthat
+ @sec-tests-suite-use-test
+ @sec-tests-suite-test-that
+ @sec-tests-suite-expectations
+ @sec-tests-suite-bdd-intro
+ @sec-tests-suite-running-tests
+ @sec-tests-suite-keyboard-shortcuts
## Specifications
[Specifications](test_specs.qmd) discusses how to collect and organize information to write tests for your application:
+ @sec-tests-specs-app-reqs
+ @sec-tests-specs-user-specs
+ @sec-tests-specs-features, and
+ @sec-tests-specs-func-reqs
+ @sec-tests-specs-bdd-testthat
+ @sec-tests-specs-traceability-matrix
This chapter also gives examples of behavior-driven development tests features and how to track specifications and tests together.
## Test tools
[Test tools](test_tools.qmd) was updated recently to include the new [`ensure` package](https://simonpcouch.github.io/ensure/), which was designed for "*drafting testthat unit testing code using LLMs.*"
- @sec-test-tools-help
- @sec-test-tools-scope
- @sec-test-fixtures
- @sec-test-data
- @sec-test-logger
- @sec-test-helpers
- @sec-test-coverage-active-file
- @sec-test-snapshots
- @sec-test-snaps-review
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](test_modules.qmd) gives examples of using `testServer()` to verify module communication (i.e., passing data between modules):
- @sec-tests-mods-returned
- @sec-tests-mods-args-list
- @sec-tests-mods-coverage
- @sec-tests-mods-outputs
## System tests
The [final chapter](test_system.qmd) in this section covers setting up and running system (or end-to-end tests with `shinytest2`):
- @sec-tests-system-shinytest2
- @sec-tests-system-recording-tests
- @sec-tests-system-shinytest2-bdd
- @sec-tests-system-test-mode
```{r}
#| label: git_contrib_box
#| echo: false
#| results: asis
#| eval: true
git_contrib_box()
```