gpt4 book ai didi

R Shiny 不能将 shinytest 用于更大的应用程序

转载 作者:行者123 更新时间:2023-12-05 01:43:21 24 4
gpt4 key购买 nike

我需要测试我的 shiny 应用程序,所以我下载了 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的代码并安装重写的。但我不知道这是否可能。

最佳答案

我不确定这是否是解决此类问题的正确态度,但让我们说吧。我跟着这个answer并将 loadTimeout = 10000 参数更改为 loadTimeout = 100000

是下面一行代码:

app <- ShinyDriver$new(app, seed = seed, loadTimeout = 10000)

关于R Shiny 不能将 shinytest 用于更大的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49499695/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com