Skip to content

Windows Testing

Alan Dipert edited this page May 30, 2017 · 9 revisions

Shiny applications can be tested on Windows using VMs provided by Microsoft.

In most cases, to test a Shiny application or control, one can run the application in a development server in RStudio on the host machine and access it from the VM.

Setting Shiny host and port on the host

The easiest way to run a Single-file Shiny App in development is with a call like shinyApp(ui = ui, server = server).

However, depending on the Windows VM's networking settings, the server may not be accessible.

One reliable way to connect to the host from the VM is to configure the VM to use NAT. Then, on the host, run:

shinyApp(ui = ui, server = server, options = list(host = "0.0.0.0", port = 8080))

where

  • 8080 is an arbitrary but memorable port higher than 1000

Within the Windows VM, the Shiny app should be accessible at http://x.x.x.x:8080, where x.x.x.x is the host's local network port. It should look something like 192.168.1.234. On a Mac you can see your machine's interfaces and their addresses by running ifconfig -a in a terminal.

fileInput from Windows

One control that isn't necessarily well-behaved is fileInput. This control only works for Internet Explorer versions 9 and below when the application that uses it is running on Shiny Server or RStudio Connect ("RSC").

Deploying test Shiny apps to RSC

  1. First, configure Global Options > Publishing to add your RSC server as a publishing option. For details on this see the User Guide section after logging into RSC with your browser.
  2. Commit your Shiny changes on a branch.
  3. Push the changes to GitHub.
  4. Run devtools::install_github("user/shiny@branchname") where user is a GitHub name or organization and branchname is the branch with changes.
  5. Deploy the app with the Publish button.

Deploying test Shiny apps to local Shiny Server

Please see the Running development version of Shiny in Shiny Server in Docker document.