Re: [scalatest-users] maven run single test

2,388 views
Skip to first unread message

Bill Venners

unread,
Aug 24, 2012, 5:43:04 PM8/24/12
to scalate...@googlegroups.com
Hi George,

First, does it need to be from the command line, or is just running a
single test enough. If the latter, did you try the ScalaTest Eclipse
plugin?

http://www.scalatest.org/user_guide/using_scalatest_with_eclipse

Bill

On Fri, Aug 24, 2012 at 12:07 PM, George <hellec...@gmail.com> wrote:
> Hello to all,
>
> I was searching to find a way to run a single Scala test
> with maven on the command line.
>
> But I only came across a continious compilation test. Is
> there a way without cc?
>
> I am working with Eclipse Scala IDE. I am open to other
> suggestions as well.
>
> Thanks
>
> best regards
> George
>
> --
> 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



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

George

unread,
Aug 25, 2012, 1:49:40 PM8/25/12
to scalate...@googlegroups.com
Hello Bill,

thank you. It works. Did not see the eclipse integration :)

best regards

Tal Gendler

unread,
Aug 29, 2013, 4:34:44 AM8/29/13
to scalate...@googlegroups.com
Hi Bill,

Is there a way to run specific test from the command line using maven ? (I have maven running all test I just want to run a specific one)

Bill Venners

unread,
Aug 29, 2013, 1:41:19 PM8/29/13
to scalate...@googlegroups.com
Hi Tal,

Yes. Here are some examples:

- run test 'a pending test' in HelloSuite, and all tests in HelloWordSpec:

   mvn test -Dsuites='org.example.
HelloSuite @a pending test, org.example.HelloWordSpec'

 - run all tests in HelloSuite, plus all tests containing 'hello':

   mvn test -Dsuites='org.example.HelloSuite' -Dtests='hello'

 - run all tests in HelloSuite containing 'hello':

   mvn test -Dsuites='org.example.HelloSuite hello'

To access this you'll need to use one of the latest SNAP releases, or wait until tonight or tomorrow when I should have a 2.0.M6 out the door.

Bill



---
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.

Manish Khettry

unread,
Aug 29, 2013, 1:47:17 PM8/29/13
to scalatest-users
Thanks Bill-- this is very similar to something that I need. In particular I would like to run a suite by a simple pattern. WIll I be able to do?

# Will this run all suites containing the word database?
mvn test -Dsuites=database 

m

Bill Venners

unread,
Aug 29, 2013, 2:02:01 PM8/29/13
to scalate...@googlegroups.com
Hi Manish,

There's support for globs in the suite names, so you'd probably need to say something like:

mvn test -Dsuites='*database*'

Please give these a try and let me know if they work for you. We did them for a client who seems to be happy, but I haven't tried them myself through Maven.

Bill

Tal Gendler

unread,
Aug 30, 2013, 1:14:10 PM8/30/13
to scalate...@googlegroups.com
Thanks a lot!

Kane Rogers

unread,
Jul 9, 2014, 8:19:38 PM7/9/14
to scalate...@googlegroups.com
Hi there, Bill!

Is there a way to run a suite matching certain tags? I think this is available when using the ScalaTest runner or Ant, but I'd love do be able to do this from the command line with maven! :- )

Thanks,

Bill Venners

unread,
Jul 9, 2014, 8:40:02 PM7/9/14
to scalate...@googlegroups.com
Hi Kane,

Howdy. I don't use Maven much, but if the -D is maven's way of setting properties, I'd hope you can do this:

mvn test -DtagsToInclude='FastAsLightning'

If you don't mind, give that a try and let me know if it works. If not I would guess that means we did something special just for suites.

Thanks.

Bill



For more options, visit https://groups.google.com/d/optout.

lachla...@gmail.com

unread,
Aug 6, 2020, 4:50:21 AM8/6/20
to scalatest-users
Hey Bill and all,

This sample was posted a long time ago, but I can’t get it to work on my project.

This works to run an entire FooSpec:

mvn scalatest:test -Dtests=Foo 
OR
mvn scalatest:test -Dsuites=“*FooSpec”


But when I try to limit this to a particular scenario within the feature I’m stuck. I’ve tried:

mvn scalatest:test -Dsuites=“*FooSpec Bar”
mvn scalatest:test -Dsuites=“*FooSpec @Bar end of the stick”
mvn scalatest:test -Dsuites=“*FooSpec” -Doptions=“-z Bar”

Unknown lifecycle phase “Bar"

Any ideas?

Cheers,
Lachlan Deck

Lachlan Deck

unread,
Aug 6, 2020, 4:50:21 AM8/6/20
to scalate...@googlegroups.com
Hey Bill and all,

This sample was posted a long time ago, but I can’t get it to work on my project.

This works to run an entire FooSpec:

mvn scalatest:test -Dtests=Foo 
OR
mvn scalatest:test -Dsuites=“*FooSpec”


But when I try to limit this to a particular scenario within the feature I’m stuck. I’ve tried:

mvn scalatest:test -Dsuites=“*FooSpec Bar”
mvn scalatest:test -Dsuites=“*FooSpec @Bar end of the stick”
mvn scalatest:test -Dsuites=“*FooSpec” -Doptions=“-z Bar

Unknown lifecycle phase “Bar"

Any ideas?

Cheers,
Lachlan Deck
Reply all
Reply to author
Forward
0 new messages