我需要测试我的闪亮的应用程序,所以我下载了shinytest并遵循了本教程- https://www.rstudio.com/resources/webinars/testing-shiny-applications-with-shinytest/。
当我在一个小应用程序上运行recordTest()时,它工作得很好。但是我有一个很大的应用程序,我需要为它创建测试,而且我不能在这个应用程序之上运行recordTest()。它输出以下几行:
Error in sd_startShiny(self, private, path, seed) :
Cannot find shiny port number. Error:
Running application in test mode.
Loading required package: shiny
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Loading required package: Hmisc
Loading required package: lattice
Loading required package: Formula
Attaching package: 'Hmisc'
The following objects are masked from 'package:dplyr':
src, summarize
The following objects are masked from 'package:base':
format.pval, units
Loading required package: SparseM
Attaching package: 'SparseM'
The following object is masked from 'package:base':
backsolve
Attaching package: 'rms'
The following object is masked from 'package:shiny':
validate
Loading required package: ggpubr
Loading required package: magrittr
Warning: package 'compareGroups' was built under R version 3.4.4
Loading required package: gdata
gdata: Unab我的应用程序需要测试是相当大的。它连接到数据库,从数据库中检索数据,源源不断的文件。在上面打印的行中,您可以从最后一行清楚地看到它可能超时。gdata: Unab -可能是Unable ...的意思。
我在这里看到了处理这个问题的人-- https://github.com/rstudio/shinytest/issues/111 --但是没有明确的答案来解决这个问题。
解决方案可能是:重写放在github上的shinytest代码并安装重写的代码,但我不知道这是否可行。
发布于 2018-03-26 20:30:48
我不知道这是否正确的态度,如何解决这样的问题,但让我们说。我遵循这个answer并将loadTimeout = 10000参数更改为loadTimeout = 100000。
这是以下代码行:
app <- ShinyDriver$new(app, seed = seed, loadTimeout = 10000)发布于 2018-05-11 16:30:05
我只需在调用loadTimeout时包含一个recordTest参数就可以解决这个问题:
> recordTest("myApp", loadTimeout = 100000)但是,如前所述,还可以通过将recordTest()参数添加到第一行来更改由loadTimeout ()创建的测试脚本的第一行。
https://stackoverflow.com/questions/49499695
复制相似问题