JtestR 0.4 Released


I have just released version 0.4 of JtestR. This version doesn’t really provide any new features – instead it contains updates to all included libraries, upgrading JRuby to 1.2 being the most important one.

More information here: http://jtestr.codehaus.org.



JtestR 0.1 released


If people have wondered, this is what I have been working on in my spare time the last few weeks. But now it’s finally released! The first version of JtestR.

So what is it? A library that allows you to easily test your Java code with Ruby libraries.

Homepage: http://jtestr.codehaus.org
Download: http://dist.codehaus.org/jtestr

JtestR 0.1 is the first public release of the JtestR testing tool. JtestR integrates JRuby with several Ruby frameworks to allow painless testing of Java code, using RSpec, Test/Unit, dust and Mocha.

Features:

  • Integrates with Ant and Maven
  • Includes JRuby 1.1, Test/Unit, RSpec, dust, Mocha and ActiveSupport
  • Customizes Mocha so that mocking of any Java class is possible
  • Background testing server for quick startup of tests
  • Automatically runs your JUnit codebase as part of the build

Getting started: http://jtestr.codehaus.org/Getting+Started

Team:
Ola Bini – ola.bini@gmail.com
Anda Abramovici – anda.abramovici@gmail.com



RSpec and RBehave runs on JRuby


I’m not sure if this is well known or not, so I’ve been meaning to write a quick notice about it. The short story is this: JRuby can run RSpec and RBehave. Why is this important? Well, you can write code that tests Java code using RSpec and RBehave, meaning that it will be possible to get much more readable tests, even for code living in Java land.

Even if your organization won’t accept writing an application in Ruby, it would probably be easier to get the testing done in Ruby. And writing tests in an effective language means that you will either write more production code, or more tests. Either of those are a quite good outcome.

A quick example of this in action. To run this example, you need JRuby 1.0 or later, and the rspec gem:

require 'java'

describe java.util.ArrayList, " when first created" do
before(:each) do
@list = java.util.ArrayList.new
end

it "should be empty" do
@list.should be_empty
end

it "should be able to add an element" do
@list.add "content"
end

it "should raise exception when getting anything" do
lambda{ @list.get 0 }.should raise_error(java.lang.IndexOutOfBoundsException)
end
end

In this code the examples are not that realistic, but you can see that the RSpec code looks the same for Java code, as it does for Ruby code. Even the raise_error exception matcher works. You can run this:

jruby -S spec -fs arraylist_spec.rb

The RBehave test suite also runs, which means you can stop using JBehave now… =)

This is a perfect example of the intersection where JRuby’s approach can be very powerful, utilizing the existing Ruby libraries to benefit your Java programming.



RSpec 1.0


Yesterday, the RSpec team pushed out version 1.0 which I’m personally very happy to hear. RSpec is a really important project and we are seriously considering including RSpec in the base JRuby distribution. Congratulations on the 1.0 release!



Focus on Java, this Tuesday


This Tuesday is JFokus in Stockholm, where I will talk about Java, JRuby and RSpec and how to combine these in exciting ways. Let me tell you, I look forward to speaking about this. I believe there is something incredibly useful in combining technologies like this.

Of course, it would also have been great fun to take about where JRuby is at right now, since there is so much cool stuff going on at the moment. When the 0.9.3 release comes along, I bet many people will be surprised and as excited as I am about this. I will get back with more information what has happened in the codebase lately quite soon.

If you’re going to JFokus, please say hi if you see me!