aspose file tools*
The moose likes Testing and the fly likes Writing JUnit 4 tests in JRuby Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Writing JUnit 4 tests in JRuby" Watch "Writing JUnit 4 tests in JRuby" New topic
Author

Writing JUnit 4 tests in JRuby

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hey,
I'm considering writing JUnit 4 tests in JRuby instead of Java.
I might missed it but I googled it and found nothing about writing JUnit 4 tests in JRuby.
Is it possible to do this?
Thanks.
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi John,

You might want to have a look at the comments on this page
Charles Oliver Nutter added a comment - 03/Feb/09 9:58 PM
I'm resolving this as "duplicate" because there are other bugs to track eventual development of a "compiler #2"
that can create normal Java classes, at which time all annotation-based libraries should work fine. So there's not
really a need to track JUnit4 independent of the larger task of building that compiler.


"Eppur si muove!"
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Depends. No annotations in JRuby (last I checked), since that would be a syntactical extension. But you can extend Java classes.

I guess I'd ask why, if you're using JRuby anyway, you wouldn't just write something using a Ruby test framework--much cleaner.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Is it possible to use RSpec and Cucumber to test Java code?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Of course; why wouldn't it be? JRuby allows unfettered access to Java classes.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Wow, this looks really powerful and useful.
So if I wrote my tests with JRuby and Ruby testing libraries, how to run them? with Rake or Ant?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The same way you'd run them in Ruby. JRuby *is* Ruby, on the JVM. Modulo some JNI libraries, anything you can do in Ruby you can do with JRuby. Gems work. Libraries work. Ruby works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing JUnit 4 tests in JRuby