Question about migrating to scalatest-maven-plugin (from surefire)

127 views
Skip to first unread message

bkuder

unread,
Nov 22, 2013, 11:28:55 AM11/22/13
to scalate...@googlegroups.com
Hi,

I'm trying to upgrade my maven project from using Surefire for unit tests to using the scalatest-maven-plugin instead.

I'm getting tripped up on one use case we have and am wondering how to achieve the comparable functionality using the scalatest plugin.

In my maven module, I have Scala tests (implemented with FunSpec) in two different packages. My test files are all named like "*Spec" and use the JUnitRunner annotation. Let's call them com.truefit.apackage and com.truefit.anotherpackage.

I want to configure the scalatest plugin to execute *only* the com.truefit.apackage specs. In surefire, I am use the following surefire configuration to accomplish this:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>com/truefit/apackage/**/*Spec.class</include>
          </includes>
        </configuration>
</plugin>

I'm at a loss at how to reproduce this behavior in the scalatest plugin. I see I can specify "tagsToInclude" and "tagsToExclude", but I'm not leveraging tags and I don't think they are what I want to use in this case.

Thoughts? Any help is appreciated.

Regards,

Brian

Bill Venners

unread,
Nov 22, 2013, 11:57:26 AM11/22/13
to scalate...@googlegroups.com
Hi Brian,

Can you try:

<suites>com.truefit.apackage.*Spec</suites>

We did make -s take a glob, so in theory this should work from the Maven plugin. Please let us know on this list whether or not that solves your problem.

Bill


--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Bill Venners
Artima, Inc.
http://www.artima.com

bkuder

unread,
Nov 22, 2013, 12:55:53 PM11/22/13
to scalate...@googlegroups.com
Hi Bill,

Thanks for your quick response. I tried that syntax and get the below error. But, I'm still running an older version of scalatest (2.0.M5b), so perhaps I need to upgrade to the proper 2.0 release?

Regards,

Brian

[INFO] --- scalatest-maven-plugin:1.0-RC2:test (test) @ consumer ---
←[31m*** RUN ABORTED ***←[0m
←[31m  java.lang.ClassNotFoundException: com.truefit.apackage.*Spec←[0m
←[31m  at java.net.URLClassLoader$1.run(Unknown Source)←[0m
←[31m  at java.security.AccessController.doPrivileged(Native Method)←[0m
←[31m  at java.net.URLClassLoader.findClass(Unknown Source)←[0m
←[31m  at java.lang.ClassLoader.loadClass(Unknown Source)←[0m
←[31m  at java.lang.ClassLoader.loadClass(Unknown Source)←[0m
←[31m  at org.scalatest.tools.Runner$$anonfun$22.apply(Runner.scala:1962)←[0m
←[31m  at org.scalatest.tools.Runner$$anonfun$22.apply(Runner.scala:1960)←[0m
←[31m  at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:264)←[0
m
←[31m  at scala.collection.immutable.List.foreach(List.scala:318)←[0m
←[31m  at scala.collection.TraversableLike$class.filter(TraversableLike.scala:263)←[0m
←[31m  ...←[0m

Bill Venners

unread,
Nov 22, 2013, 1:58:34 PM11/22/13
to scalate...@googlegroups.com
Hi Brian,

Yes, the -s taking a glob feature was added post-2.0M5b. Please give 2.0 proper a try when you can and let us know if it works for you.

Thanks.

Bill

bkuder

unread,
Nov 22, 2013, 4:28:20 PM11/22/13
to scalate...@googlegroups.com
Upgraded to 2.0 proper and everything is now working as expected with the <suites> tag. Thanks so much for your help!

Regards,

Brian

Bill Venners

unread,
Nov 22, 2013, 5:38:55 PM11/22/13
to scalate...@googlegroups.com
Hi Brian,

Great. Thanks for letting us know.

Bill
Reply all
Reply to author
Forward
0 new messages