title: Test user interaction with file.choose()
body: <p>I have a function that contains <code>file.choose()</code> that I would like to be covered by tests using <code>testthat</code> (and in a minor extent using <code>goodpractices</code>).</p>
  
  <p>I know such interactive function is not universally loved. I don't adore it myself but in a package I wrote, I really need such helpers for beginner users (with the hope of bringing them to non-interactive alternative).</p>
  
  <p>Is test a way to do it automatically, eg without picking a file manually?</p>
  
  <p>I know <a href="https://stackoverflow.com/questions/41372146/test-interaction-with-users-in-r-package">such a question</a> has (partly) already been asked and I understand the idea behind the answer but I have the feeling that it circumvents my problem rather than solving it. Perhaps, it is, by essence, impossible to tackle.</p>
  
  <p>Below is a code that could help. We would expect no message in the end.</p>
  
  <pre><code>library(testthat)
  
  fc &lt;- function(x){
    x &lt;- file.choose()
    return(x)
  }
  
  test_that("interactive function works",{
    expect_true(is.character(fc()))
  })
  </code></pre>