-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage For Shiny Applications #277
Comments
https://github.com/rstudio/shinytest makes this feature request more compelling, I think. CC: @wch |
I actually worked on this at the work week in May / June last year and had a simple proof of concept, it requires fairly small changes to covr and shiny test. https://github.com/r-lib/covr/compare/shiny-app?expand=1 I didn't proceed further because it didn't seem like there was a terrible amount of interest. If we want this it should not be a great deal of work, happy to do what is needed. |
Hi, the combination of covr and shinytests seems very valuable to me! It's a pity to write nice shinytests which do not add to the "visible" test coverage... :) Unfortunately, I wasn't able to transfer this proof of concept to the most recent version of shinytest (1.3.0). But if you can give me some hints or adjust the shinytest 1.3.0 initialize.R code I'm happy to test or extend this proof of concept. Thanks and best! |
Is there any update on this. This will be a great functionality. Ref: rstudio/shinytest#97 This will helpful for tracking code coverage for packages with shiny modules. |
There is a difference between instrumenting code coverage for a package and for a seperate shiny app. If you use a package where the shiny app is fully contained in source code in the package itself, e.g. <R/shinyApp.R>
#' @export
myShinyApp <- function() {
shiny::shinyApp(ui=ui, server=server)
} then the <tests/testApp.R>
shinytest::testApp(appDir="tests/testApp") <tests/testApp/app.R>
myShinyApp() <tests/testApp/tests/test.R>
app <- ShinyDriver$new("..", loadTimeout = 30000, seed=1234)
app$snapshotInit("full-test")
## execute test actions
## Interrupt shinyProcess so covr::save_trace can execute onExit
p <- app$.__enclos_env__$private$shinyProcess
p$interrupt()
p$wait() Hope this helps others! |
@rfaelens do you have an example package for this. Let me try to re-create it and see. |
See https://github.com/rfaelens/exampleShinyTest for a nice example. |
Great. Here is also my quick take : I adopted |
No description provided.
The text was updated successfully, but these errors were encountered: