R Shiny不能将shinytest用于更大的应用
我需要测试我的闪亮应用程序,因此我下载了R Shiny不能将shinytest用于更大的应用,r,shiny,automated-tests,R,Shiny,Automated Tests,我需要测试我的闪亮应用程序,因此我下载了shinytest,并遵循本教程- 当我在一个小应用程序上运行recordTest()时,它工作正常。但是我有一个需要为其创建测试的大型应用程序,我无法在该应用程序上方运行recordTest()。它输出以下行: Error in sd_startShiny(self, private, path, seed) : Cannot find shiny port number. Error: Running application in test mo
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
-可能是指无法…
我在这里看到有人在处理这个问题,但没有明确的答案来解决这个问题
解决方案可能是:重写放置在github上的shinytest的代码,然后安装重写后的代码。但我不知道这是否可行。我不确定这是否是解决此类问题的正确态度,但不妨这么说。我遵循这一点,将loadTimeout=10000
参数更改为loadTimeout=100000
这是以下代码行:
app <- ShinyDriver$new(app, seed = seed, loadTimeout = 10000)
app调用recordTest时,我只需包含一个loadTimeout参数,就可以解决这个问题:
> recordTest("myApp", loadTimeout = 100000)
但是,正如scarface所提到的,您还可以通过将loadTimeout参数添加到第一行来更改recordTest()创建的测试脚本的第一行