Update on Test Runner
By Erno Mononen on Aug 26, 2008
Since the initial introduction of the new test runner in the NetBeans Ruby IDE it has gone through some changes and improvements that I thought I should document somewhere. Eventually I'll turn this into a wiki page. I'll explain here a bit what it does under the hoods; it might not be that interesting for all users as it should just work, but I'm sure many users like to understand what exactly it runs.
Test actions in the project context menu
There are at most three test related actions in the menu: Test, RSpec Test and AutoTest:
What actions are displayed depends on what gems you have installed; if the target platform of the project has the RSpec gem installed, the RSpec Test action is visible. Similarly for AutoTest, just that it requires the ZenTest gem.
By default, the Test and RSpec Test actions try to invoke the corresponding Rake task and run that. So if your project has a 'test' Rake task, that will be run by the Test action. For RSpec Test action the respective Rake task is 'spec'. So in effect these actions are just shortcuts for rake 'test' and 'spec' tasks, if the project has such tasks. If not, they will run all tests found in the test folders of the project; the RSpec Test actions runs all \*spec.rb files in those folders and the Test action in turn all \*test.rb and test\*.rb files.
The AutoTest action basically just runs the autotest command on the project. It was integrated with the new test runner just recently, in 6.5 Beta AutoTest results are displayed just in the output window.
Rake tasksBy default the test runner is associated with the following tasks:
- Test/Unit: 'test' and all tasks starting with 'test:'
- RSpec: 'spec'
The test runner now checks for project.properties (and/or private.properties) for the following properties:
- 'test.tasks' for test/unit tests
- 'spec.tasks' for rspec tests
If those properties are not defined, the test runner will run by default the following tasks:
- 'test' and all tasks starting with 'test:' for test/unit
- 'spec' for rspec
test.tasks=test,my_tests,yet_another_test_task spec.tasks=spec,my_test_specsIf you define the property but leave the value empty, no tasks will be associated with the test runner. So if you for some reason don't want to run any tasks through the test runner, you can do: