I'm not having much luck searching google for this - are there any JRuby unit testing frameworks for Java code that integrate with Eclipse or Maven? Is there perhaps a Cucumber flavor that integrates with Eclipse, and if so, could someone point me to a quickstart guide explaining how to do it? :-(
Have you looked at cucumber-jvm (previously cuke4duke)? From the project README:
Cucumber-JVM is a pure Java implementation of Cucumber that supports the following programming languages:
Clojure
Groovy
Ioke
Java
JavaScript (Rhino interpreter)
Python (Jython interpreter)
Ruby (JRuby interpreter)
Scala
Cucumber-JVM provides the following mechanisms for running Cucumber Features:
Command Line
JUnit (via IDE, Maven, Ant or anything that knows how to run JUnit)
We've been using it in our CI builds with Maven and it works great. It looks like you can also write your tests in JRuby.
Related
I have configured a Cucumber project using Cucumber Java in Intellij IDEA.
I am able to execute the scenarios within a feature file using Cucumber Java (by executing the entire feature file and selecting Cucumber Java), but I am not able to execute a separate scenario due to Ruby plugin.
Specifically, when I click to run a specific scenario, Intellij IDEA defaults the execution to Cucumber (with Ruby) instead of Cucumber Java.
I need the Ruby plugin, since I am using the same IDE for another project which needs the Ruby support but I don't need the Cucumber support for it.
How can I disable Cucumber (Ruby) and default the scenario execution to Cucumber Java?
Update: IntelliJ IDEA 2021.2.1 (Ultimate Edition)
I got opposite issue with rubby project and Idea runs features as cucumber java. Temp solution for me was dissable cucumber java plugin
Is it possible to have in the same solution a project in Java, another in Python and another in Scala? Or all the projects must be either in Java either in Scala?
You can mix Java and Scala in a single Maven project. Read the following tutorial for more information:
Scala with Maven
Python and Maven: well python doesn't need to be compiled like Java or Scala code does. Instead, python project building is about resolving dependencies, running unit tests, creating installables and so on. Unfortunately, python has its own way of doing these things that different from Maven. To the extent that it probably doesn't make much sense for Maven to manage python code.
Having said that, you can "lightly integrate" python into a Maven build system by having Maven run a setup.py script as an external command. Here is an article that describes this approach:
Python & Java: a unified build process (1/4)
I have one rails application. Right now i am using
Parallel_test
gem with Capybara, Cucumber testing framework. Now i am trying to use
Cucumber-JVM
Since previously i have written all my scenario steps in Capybara, so is there any maven dependency of capybara? So that i can use that in my pom file and use existing capybara steps as it is in
Cucumbr-JVM
Please suggest.
No, you can't because there is no port of Capybara to Java. But you can always write your tests in Ruby and than run them from some other Java project. This post explains how to do that.
I've been using Maven for a while for my Java (and now Scala) projects. Recently, I've seen some talk about issue with Maven (example). Personally, I'm happy with it till now. I've used sbt for Scala a little bit and I think it works well.
Again my point here is not to say which system is better but to expore out what other alternatives exist and how real developers are using them for Java and Scala projects.
There is a Scala plugin for Gradle.
Alternatively you could use Scala's built-in Ant tasks and Ivy for dependency management (which is what SBT uses internally).
Yet another option is Apache Buildr.
Pretty much any build system designed for Java-based projects should work with Scala.
Related:
A Basic Ant+Ivy+Scala Setup
Comparing SBT and Gradle
Buildr vs. Gradle
I think if you're going to use Scala, you'll need to become familiar with SBT. It's the standard build system for Scala projects, and the build system of choice at every professional organization that I have worked at using Scala.
SBT has a bit of a learning curve, but it also has some amazing features - console is probably the one I use most - load up a shell with your project already on the CLASSPATH.
You can do some pretty clever stuff with SBT - in the end it's all Scala under the hood. The effort to pick it up is well worth it if you plan to work with Scala professionally.
I'm looking for a plugin that would run in a console continuously to scan a Maven project's test sources directory, and when it detects a change kicks off a test cycle. Something analogous to mvn scala:cc or the Scala Build Tool, but for Java. Can anyone point me towards one?
I have personally used sbt even for a java only project just for continuous test feature.
I added a sbt build file to a maven based project and use sbt when developing, but use maven when building the final package, starting embedded jetty etc and this has worked out quite well.
I've just discovered that the scala-maven-plugin supports both continuous compilation & testing, as well as cross-compilation (Java + Scala). So it's possible to use it over a pure Java build and get all the continuous build goodness.
Recently, I have had a need for a solution to this. Having been learning scala and finding about the goodness of sbt ~test, I want to apply it to Java projects that do not have continuous test.
Using the scala-maven-plugin that you mentioned, I have created a github seed that will run Java Junit tests everytime I save a Java source or a Java test.
Check it out:
https://github.com/ailveen/maven-scala-java-continuous-test
The project is very simple right now (contains only Java files because that is my current need) but in the future I hope to add scala test (or specs2 or scalacheck) so it works with mixed java and scala files.
Hope you find it useful.
It is not exactly for Maven, but JUnit Max does continuous testing and if you're on Eclipse it might be the tool you would like to check out