We have a shiny app which is structured as a package (We are not using golem
). There are some functions on the server side for which we have written unit tests. At the same time, we also want to do snapshot testing using shinytest2
to ensure that the app is working.
My questions are :
- Is it possible to have both
testthat
unit tests +shinytest2
tests in one package? - If yes, how would the folder structure look?
- When I want to have simple unit tests for a non-shiny package. My
testthat.R
file looks like this
library(testthat)
library(shiny)
library(my.package.name)
testthat::test_check("my.package.name")
When I use shinytest2
the same file looks like this -
shinytest2::test_app()
In this case, I want to use both. Then how would testthat.R
file look like? I tried with the following but it didn't help.
library(testthat)
library(shiny)
library(my.package.name)
testthat::test_check("my.package.name")
shinytest2::test_app()