title: Debugging 'testthat' tests in RStudio
body: <p>Is it possible to invoke the debugger in RStudio when running <code>testthat</code> tests?  I haven't been able to find a setup that allows this (various combinations of "use <code>devtools</code> package functions if available" in the settings, hitting the "Test Package" option in the "Build -> More" menu, running <code>test()</code> in the console, putting in <code>browser()</code> calls, etc.) but haven't found a way yet.</p>
  
  <p>I also find myself getting lost a lot when testing, unsure whether the code being run has been installed in the system libraries (by doing 'Build &amp; Reload'), or is being run <em>in situ</em> from the local <code>R</code> directory, or what - sometimes RStudio complains that a breakpoint can't be set until the package is rebuilt (so I suspect the former) or doesn't (so I suspect the latter).  Not sure if this issue is closely related or not to my main question.</p>
  
  <p>Without finding a way to drop into the debugger, I end up pasting test code into the console &amp; working in a very ad-hoc fashion, and basically shooting my TDD habits in the foot.  So any advice would be appreciated - if it's not possible to invoke the debugger, any suggested workarounds?</p>
  
  <p>I'm running RStudio version 0.99.447 on OS X, in local mode, with R 3.2.1.</p>
  
  <p><strong>Edit</strong> - I'd also love to know more background about the options, e.g. "option X will never support debugging, because it's running in a forked process, try this other option Y instead."</p>
  
  <p><strong>Update</strong> - having had no responses here, I also asked at <a href="https://support.rstudio.com/hc/communities/public/questions/204779797-Debugging-testthat-tests-in-RStudio" rel="noreferrer">https://support.rstudio.com/hc/communities/public/questions/204779797-Debugging-testthat-tests-in-RStudio</a> (where I also haven't had any responses).</p>