Hi Heiko.
There are lots of ways to run scalatest from maven. These are the ones
I know of (some not applicable to FeatureSpecs)
1* JUnit3Suite - turns your tests into (as the name suggests) JUnit 3
tests. Surefire will happily execute these ("Bad thing" is that you
have to follow JUnit3 conventions for your tests)
2* @RunWith(classOf[JUnitRunner]) - turns your tests into JUnit4
tests. Surefire will happily execute these too. Works with all the
cool scalatest stuff (including FeatureSpec)
3* TestNGSuite. Turns your tests into TestNG tests. I havent tried
this one myself, but I guess it works just like the JUnit3Trait.
4* (the secret trick) Run the tests using the pojo-test-support in
surefire. Surefire finds tests by filename and will execute any method
that starts with "test" on properly named non-{junit, testng} classes.
The trick is to have one method starting with "test" in each class
executing scalatest.
E.g
class FooTest extends Spec with ShouldMatchers {
def test_it = execute() // test_it is called by surefire. calling
execute runs your hole scalatest
describe("2 + 2"){
it("should be 4"){
2 + 2 should be (4)
}
}
}
5* maven-scalatest-plugin - There is a maven plugin for scalatest. It
will run all kinds of scalatests. Example pom files can be found in
src/it.
6* maven-antrun-plugin - wire up the scalatest ant task and execute it
in the test phase.
Options 2,4,5 and 6 should work with FeatureSpecs
To really answer your question, the easiest to just get started is
probably number 2 - The @RunWith annotation. In the long run you might
find it a bit tedious having to add that annotation to every single
test, so a more pleasant long term solution is 5 and 6.
/j