Executing Tests on DRb Server
Running test suits sometimes involves overheads, because every time a test suit is executed, the whole environment (for example, the entire Rails environment for Rails applications) should be reloaded. You can avoid it using the Spork DRb server, which loads the environment only once.
With the Spork DRb server running in the background, you have a choice to execute any testing script using the Spork DRb server, or locally.
To launch Spork DRb server
On the main menu, choose.
- In the Spork DRb Launch Options dialog box, select the desired testing framework, and click Run.
If you are going to use
sporkfor the first time in your project, launch the action with the Perform bootstrap checkbox selected. Thus Spork will patch the testing scripts.
The Spork DRb server starts in a separate tab of the Run tool window.
To run a test script using the Spork DRb server
Make sure that Spork DRb server is launched using RubyMine and is running in the background.
Run a test script, or one of its examples. Note that the option Spork DRb is automatically selected in the corresponding run configuration. If you want to run this test locally, you have to select the option None.
To debug tests, when using Spork DRb, follow these general steps
Make sure the breakpoints are set in the test script you want to debug.
On the main toolbar, click the run/debug configuration selector, and choose.
In the Run/Debug Configurations Dialog dialog box, create run/debug configuration for Spork DRb server. Refer to the section Creating and Editing Run/Debug Configurations for detailed description of the procedure.
Launch Spork DRb in the debug mode. To do that, with the Spork DRb run/debug configuration selected, click , or press Shift+F9.
With the Spork DRb server running in the debug mode, run the desired test script.
Managing Spork DRb server
Refer to the description of the Run tool window. In particular, use the following buttons:
- stop the Spork DRb server without closing its tab in the Run tool window.
- close the Spork DRb server tab.
- rerun Spork DRb server in the same tab.
Tips and tricks
RubyMine creates a temporary run/debug configuration for Spork DRb server. Later you can change this run/debug configuration as required, save it as permanent, and use it to launch the server.
If you are using TeamCity, avoid overhead by adding the following statement into
Spork DRb server doesn't work with Ruby 2.0.
If both Zeus and Spork DRb servers are running simultaneously, it is Zeus that gets priority.