How to pass arguments to ScalaTest runner in Eclipse?

14 views
Skip to first unread message

patrick...@gmail.com

unread,
Oct 11, 2018, 1:53:54 PM10/11/18
to scalatest-users
I'm using ScalaTest with the ScalaTest Eclipse plugin in ScalaIde in Eclipse, and I'd like to use tags for my tests. In the docs for ScalaTest tags (http://doc.scalatest.org/3.0.1/#org.scalatest.Tag), it says that after you've set up the tags:

"When you run ScalaTest and want to either include or exclude DbTests (for example), you'd give the fully qualified name of the tag annotation (which is also the name passed to the corresponding Tag constructor) to Runner"

But I'm not invoking the runner from the command line or via the Scala "run" method - I'm using the @RunWith annotation ie - "@RunWith(classOf[JUnitRunner])". What's the best way for me to pass tags to the runner?

Bill Venners

unread,
Oct 11, 2018, 2:07:15 PM10/11/18
to scalate...@googlegroups.com
Hi Patrick,

I think if you are using JUnitRunner you might be out of luck.
Essentially JUnitRunner delegates the running to JUnit, and we don't
do anything with the tags. It may be that we could try and use a JUnit
Filter to filter out tests, but currently we don't:

https://github.com/scalatest/scalatest/blob/release-3.0.0/scalatest/src/main/scala/org/scalatest/junit/JUnitRunner.scala#L100

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/d/optout.



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

patrick...@gmail.com

unread,
Oct 12, 2018, 12:48:52 PM10/12/18
to scalatest-users
Thank you Bill.  Wow that was a really fast response!

I don't have any reason to use the JUnit runner except that was how I learned to set up ScalaTest when I first started with it, and I wanted to stick with something that was working unless there's an advantage to changing it.  Looks like now I have a reason to change.
Reply all
Reply to author
Forward
0 new messages