[ 
https://issues.apache.org/jira/browse/BUILDR-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571110#action_12571110
 ] 

Victor Hugo Borja commented on BUILDR-29:
-----------------------------------------

Well, for testing java with ruby, I've been playing around with Ola's JTestr, 
and so far it seems quite flexible.
My experimental buildr plugin for jtestr lets buildr creates a configuration 
file like this:

      # Let buildr configure the jtestr classpath to use
      classpath 'dependencies determined by buildr for runnig the test task'

      # If the java project contains JUnit sources, we search for their classes 
*Test.class 
      # and tell JTestr about their names so they will be run
      junit ['org.foo.ATestForOther', 
'org.these.classes.also.determined.by.BuildrTest']

      # Buildr searches for *_spec.rb on  src/test/ruby directory, if any of 
them is found
      # buildr uses the following command to tell JTestr the specs to run
      rspec ['/full/project-path/src/test/ruby/foo_spec.rb', 
'/full/project-path/src/test/ruby/bar_spec.rb']

      # If *_test.rb are found on src/test/ruby directory, they are ruby based 
unit tests:
      test_unit ['/full/project-path/src/test/ruby/foo_test.rb', 
'/full/project-path/src/test/ruby/bar_test.rb']

Of course users will be able to override or skip this configuration.

As you can see, regarding directories for ruby based tests/specs, I was 
thinking of using a single directory
    src/test/ruby 

*_test would be rubyUnit 
*_spec would be rspec examples.

Even though JtestR is very young, I'd vote for using it instead of maintaining 
our custom rspec runner.

I would like know what you guys think about all of this. Nothing is set in 
stone, so we are just in time for deciding about directory conventions and 
which rspec runner to use.

> Run RSpec specs with JRuby
> --------------------------
>
>                 Key: BUILDR-29
>                 URL: https://issues.apache.org/jira/browse/BUILDR-29
>             Project: Buildr
>          Issue Type: New Feature
>          Components: Test frameworks
>    Affects Versions: 1.3
>            Reporter: Nick Sieger
>            Assignee: Victor Hugo Borja
>             Fix For: 1.3
>
>         Attachments: buildr_framework.rb
>
>
> Attached is a test framework I wrote that allows me to write RSpec specs that 
> test Java code.
> If Buildr is run under MRI, JRuby is downloaded as a dependency and launched 
> to run the specs.
> If Buildr is run under JRuby, JRuby will launch a sub-vm of itself, including 
> the project classpath but using the same JRuby version that was used to 
> launch Buildr.
> Note the following features and/or limitations:
> * No specs for this currently exist; they'll need to be written if you want 
> the coverage. I probably won't write them (for now) :)
> * Assumes project specs are in the "spec" directory. You may want this to be 
> customized.
> * Runs specs in "specdoc" mode (hard-coded). Choosing a formatter would be 
> another possible customization.
> * Allows a {{SPEC}} environment variable to be set or passed on the 
> command-line to specifiy a single spec to run (just like the RSpec rake task)
> * Allows {{:required_gems}} as an option to be passed to the "test" clause of 
> the project, which will ensure that gems are present before running 
> (installing them if necessary) before running specs. There is currently no 
> way to specify gem version.
> * Uses ci_reporter to generate JUnit-like XML reports; assumes that they may 
> be useful (perhaps in conjunction with the junit:report task); but it's not 
> strictly necessary.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to