docs
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
Software Requirements --------------------- Testing is done with JUnit (http://www.junit.org). To run the JUnit ant tasks, you also need the optional ant tasks jar file from http://jakarta.apache.org/site/binindex.html The default build.xml is setup to look for the JUnit jar file under $JRUBY_HOME/lib. The optional ant tasks should be put in $ANT_HOME/lib/optional.jar. Testing ------- Testing in jruby is based on two seperate unit test suites. The first and foremost is rubicon (http://rubyforge.org/projects/rubytests). This is the same test suite that ruby uses to verify the interpreter is running correctly. The second is our own unit tests via ant/junit/minirunit. This test suite is mostly for tests that we cannot or do not want to submit to rubicon (a good example is tests involving java integration). Using Rubicon ------------- a) Before you can use rubicon, you must allow jruby to use ruby's core modules. jruby does not distribute its own set, so you must borrow them. Copy your 'ruby/{verion}' (i.e. /usr/lib/ruby/1.8 on most linuxes) to 'lib/ruby' in your CVS sandbox (on linux a softlink works also). b) Install rubicon (http://rubyforge.org/projects/rubytests). To get it from CVS: cvs -d:pserver:anonymous@rubyforge.org:/var/cvs/rubytests login cvs -z3 -d:pserver:anonymous@rubyforge.org:/var/cvs/rubytests co rubicon c) Run rubicon make RUBY={PATH_TO_JRUBY_HOME}/bin/jruby.sh to run all tests {PATH_TO_JRUBY_HOME}/bin/jruby.sh builtin/TestFloat.rb to test a single file (TestFloat in this case). Read rubicon documentation for more details (or if rubicon changes something since this document was published). Using minirunit --------------- When implementing new methods on the builtin classes the easiest way is to write the tests in Ruby. It also makes it possible to verify the tests against the original Ruby interpreter (MRI). In the folder "test" you will find JRuby's own tests, and in "test/mri" some tests taken from MRI. Run all of them with: ./jruby.sh test/testSuite.rb or jruby.bat test/testSuite.rb Writing Java Tests ------------------ 1) Java unit tests with JUnit: Tests for classes should be put in a "test" subpackage of the original class's package. For example, org.jruby.RubyModule's tests should go in org.jruby.test. Test files should be named: Test${classname}.java (e.g. TestRubyModule.java). After creating individual tests, each test class should be added to the main test suite at org.jruby.test.MainTestSuite. Before checking in your changes, be sure to run the full test suite with the following command line: ant test ..or, if you don't have the ant JUnit task: java junit.textui.TestRunner org.jruby.test.MainTestSuite This will ensure that your changes not only work by themselves but haven't caused problems elsewhere in the source. Unit tests should ALWAYS run at 100% pass rate when checked into CVS.