Ruby Code Coverage in the builds now

I've checked the Ruby code coverage code into the trunk now, so if you grab a recent daily 7.0 build, it should be there. I found a Windows-specific bug in the Python code coverage code as well, so grab a new build if you're on that platform.

I've had some fun with Java2D lately. Instead of the ugly coverage bars I showed in my screenshots a couple of weeks ago, the coverage bars now have proper gradients, drop shadows behind the text etc.:

Another thing I added is a bar in the editor footer (while code coverage is enabled) which lists the coverage percentage for the current file, along with actions to quickly run the tests again, or bring up the coverage report, or clear the results, or finish the coverage mode. As well as warn you when your data is older than your code.

And finally, I updated the built-in and extra color themes to also have color definitions for the coverage highlights. Here's the Dark Pastels color theme with coverage data enabled:

Please let me know of any problems while this code is still fresh in my mind :)


Thanks for this! Out of all Java IDEs that have bolted on Ruby support recently, only NetBeans seems to be making progress in actually becoming a useful and comfortable IDE.

Posted by Apostlion on January 02, 2009 at 10:08 PM PST #


This is great stuff. Please, please tell me that the JavaFX plugin is somewhere near the top of your list? It is rather painful to use at the moment.

All I want for Christmas is Tor's TLC applied to JavaFX! :-)


Posted by Dean Iverson on January 03, 2009 at 12:09 AM PST #

Any plans to support rspec? Running one test works right now but running all tests says it can't find anything to test. Also, code coverage is executed on the spec files themselves. Looks awesome though! Can't wait to use it with rspec.

Posted by Richard Poirier on January 03, 2009 at 01:56 AM PST #

Thanks a lot for all your work. Netbeans is my favorite IDE for Ruby and Groovy (and probably soon for Python, too).
All the new features are fantastic and way ahead of other solutions.

Posted by Markus Jais on January 03, 2009 at 03:08 AM PST #

Slick, thanks!

Posted by Brad Werth on January 03, 2009 at 04:22 AM PST #

Code coverage +++

Two improvements :

1. Should be restricted to project files and not include library files : in my case I get a full page of fxruby files coverage ...

2. "Report" should give file names relative to the source directory, and not absolute names (too long).

Best wishes for 2009

Posted by Michel Demazure on January 03, 2009 at 05:42 PM PST #

Thanks for your comments everybody!

yep, I'm really interested in JavaFX.

Which version of the build are you using? The file names were already supposed to be project relative, and also only project files should have been included. I'm specifying an exclude-path to rcov (which is used for Ruby code coverage behind the scenes) and the exclude path includes both the root directory for your Ruby installation as well as your Gem installation (if different from the Ruby installation). If you're using a recent (2009) build there must be a bug somewhere here - perhaps something related to / versus \\ in path comparisons so it would be great if you could give me some more details (e.g. is there something special going on with the fxruby files - what exactly is the full path listed, and what is your ruby and gem installation paths as well as your project - are there any spaces in the path etc. etc.).

Richard and I have communicated a bit off line and the issue with RSpec is that the "All Tests" button in the editor toolbar only runs tests, not specs. Other than that RSpec code coverage should work - just enable code coverage and then run the RSpec tests action in the project context menu. Hopefully the editor toolbar action for this can be sorted out quickly.

Posted by Tor Norbye on January 05, 2009 at 02:17 AM PST #

I have the same problem as Michel. Here are the files rcov is hitting that it shouldn't:

/Library/Frameworks/RubyCocoa.Framework/Resources/ruby/osx/objc/<lots of different files>



OS: OS X 10.5.6
Ruby: ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] (/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby)
Gem Home: /Library/Ruby/Gems/1.8
Gem Path: /Library/Ruby/Gems/1.8,
Gem Tool: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem (1.2.0)

Posted by Richard Poirier on January 05, 2009 at 06:34 AM PST #

Hey Tor,

I've finally taken the plunge and upgraded from my 6.1 dev build even though it cost me all my custom key binding settings because there wasn't an export function on that version :-(

Anyway, code coverage looks great but I just found a problem. It ran fine for a single test but when I ran all tests I saw the following in the output window:

(in /Users/mkovacs/starter_app/trunk)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -Ilib:test -r"/Applications/NetBeans/NetBeans Dev" "/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/unit/feedback_category_test.rb" "test/unit/feedback_test.rb" "test/unit/user_mailer_test.rb" "test/unit/user_test.rb"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -Ilib:test -r"/Applications/NetBeans/NetBeans Dev" "/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/functional/admin/feedback_categories_controller_test.rb" "test/functional/admin/feedback_controller_test.rb" "test/functional/admin/roles_controller_test.rb" "test/functional/admin/users_controller_test.rb" "test/functional/comatose_admin_controller_test.rb" "test/functional/feedback_controller_test.rb" "test/functional/sessions_controller_test.rb" "test/functional/users_controller_test.rb"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -Ilib:test -r"/Applications/NetBeans/NetBeans Dev" "/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb"

No file to analyze was found. All the files loaded by rcov matched one of the
following expressions, and were thus ignored:

You can solve this by doing one or more of the following:
\* rename the files not to be ignored so they don't match the above regexps
\* use --include-file to give a list of patterns for files not to be ignored
\* use --exclude-only to give the new list of regexps to match against
\* structure your code as follows:
test/test_\*.rb for the test cases
lib/\*\*/\*.rb for the target source code whose coverage you want
making sure that the test/test_\*.rb files are loading from lib/, e.g. by
using the -Ilib command-line argument, adding
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
to test/test_\*.rb, or running rcov via a Rakefile (read the RDoc
documentation or README.rake in the source distribution).

Finished in 8.304 seconds.
74 tests, 0 failures, 0 errors

Posted by Michael Kovacs on January 07, 2009 at 05:25 AM PST #

Hi Tor,

I also am not seeing any coverage results even after I run my RSpecs from within Netbeans. I do have a few Pending items, but all others passed.

If there is any debug/other info I can send you to help please let me know.

BTW - I do see an error in the Output - app name(spec) window, however this just seems to be the last error of my specs (i.e. have a test case that expects an exception and tests to see that it occurred)


Posted by Greg on January 10, 2009 at 11:19 AM PST #

Hi Michael and Greg,
it would be great if you guys can give me some more information to try to track this down.

I just checked in a couple of flags which might help track this down. Can you get build #4788 or later (from - that build should finish any minute).

Then try running NetBeans with
-J-Dcoverage.exclude=true -J-Dcoverage.rcov-rails=false

Does that help at all? If not: can you open the report (project context menu - code coverage - Show Report...) - are any files listed there? Are any of those files in your project, but when opened does not show any colors? If so, what is the exact path (in case there are spaces-in-path or / versus \\ path issues here).

Depending on the answers to the above I may have to put some more diagnostics in and ask for more details :)

P.S. Michael, sorry about your keybindings - yes, there's no settings migration to dev builds. But if you copy your $old-userdir/config/Editors/ folder to your $new-userdir/config/Editors folder the settings should move as well.

Posted by Tor Norbye on January 12, 2009 at 11:18 AM PST #

...P.S. Richard - thanks for your comment too. It looks like some files that should be getting excluded aren't - but it also looks like Greg and Michael are running into a problem where -too much- is excluded so I'm looking into that first...

Posted by Tor Norbye on January 12, 2009 at 11:20 AM PST #

thanks Tor - will try to get some more detail this evening for you - do you want me to raise a Bug or Submit to Forum?

FYI - I've also recently posted some debug info at the following forum post regarding debug for Ruby not working for Rspec files. Not sure if there's a relationship there or not. Link =

Posted by Greg on January 12, 2009 at 11:53 AM PST #


Have create bug # 156673 and put the trace into this.


Posted by GregH on January 12, 2009 at 08:31 PM PST #

Hey Tor,

Going to try out the build shortly... in the meantime can you tell me where $old-userdir would live on a mac? I checked .netbeans in my homedir and the dir structure you describe is not there:

"But if you copy your $old-userdir/config/Editors/ folder to your $new-userdir/config/Editors folder the settings should move as well."

I've given up on salvaging my key bindings and know I'll have to remap them but if I know where they resided on disk I can always go get a time machine snapshot of that directory and restore them!


Posted by Michael Kovacs on January 13, 2009 at 01:46 PM PST #

Following on my post of Jan. 4 ans your answer of jan. 5. on code coverage.

Tor, I am sorry, but I did not find time to answer before.

Same situation with nightly build 20090115. I have a copy of the screen showing both issues (lib files present, long filenames). How can I send it to you ?


Posted by Michel Demazure on January 15, 2009 at 04:46 PM PST #

Post a Comment:
Comments are closed for this entry.

Tor Norbye


« July 2016