testing shiny apps structured as a package

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 :

  1. Is it possible to have both testthat unit tests + shinytest2 tests in one package?
  2. If yes, how would the folder structure look?
  3. 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()

What happened exactly?

Thank you for your reply @Gabor , I think running only the below lines run tests from both testthat as well as shinytest2.

testthat::test_check("my.package.name")

OK, but that's good, no?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.