The Artima Developer Community
Sponsored Link

ScalaTest/ScalaUtils Forum
JUnit4Runner for ScalaTest

4 replies on 1 page. Most recent reply: Sep 10, 2009 1:27 PM by Stephen Haberman

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Jon-Anders Teigen

Posts: 2
Nickname: teijon
Registered: Dec, 2007

JUnit4Runner for ScalaTest Posted: Mar 31, 2009 11:11 AM
Reply to this message Reply
Advertisement
Hi. I've written a JUnit4Runner for ScalaTest which lets you run ScalaTests with JUnit4.
It works with Maven, Eclipse, Netbeans and IntelliJ

http://github.com/teigen/scalatest-junit4runner/tree/master

/j


Erkki Lindpere

Posts: 1
Nickname: villane
Registered: Dec, 2007

Re: JUnit4Runner for ScalaTest Posted: Apr 14, 2009 4:15 PM
Reply to this message Reply
Nice, I'll try it out soon.

This is probably more of a question about ScalaTest than your plug-in but could it be done without specifying @RunWith for each suite? i.e. to specify a default runner for a whole project?

Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Re: JUnit4Runner for ScalaTest Posted: Apr 15, 2009 10:46 AM
Reply to this message Reply
> Nice, I'll try it out soon.
>
> This is probably more of a question about ScalaTest than
> your plug-in but could it be done without specifying
> @RunWith for each suite? i.e. to specify a default runner
> for a whole project?
>
Hi Erkki,

Actually it is a question about JUnit. JUnit looks for the RunWith annotation on the class and any superclass, but not on superinterfaces unfortunately. If they did the latter this could be accomplished by mixing in a trait. So the best you can do is make a class that mixes in all the traits you like, plus adds the RunWith annotation, then have all your suite or spec classes extend that class.

By the way we've had a JUnitRunner trait quite similar to Jon-Anders' one, but slightly different, baking in the trunk for 0.9.6. So this approach to JUnit integration will become supported in the next release.

Jon-Anders Teigen

Posts: 2
Nickname: teijon
Registered: Dec, 2007

Re: JUnit4Runner for ScalaTest Posted: May 22, 2009 4:50 AM
Reply to this message Reply
Great work Bill. Nice to see this getting into ScalaTest

Stephen Haberman

Posts: 1
Nickname: shaberman
Registered: Sep, 2009

Re: JUnit4Runner for ScalaTest Posted: Sep 10, 2009 1:27 PM
Reply to this message Reply
Not having found this thread, I independently implemented a "JUnitRunner" as well and posted about it this morning:

http://draconianoverlord.com/2009/09/10/scalatest-spec-from-eclipse.html

I thought I'd post anyway as my take solves the "unrooted" test problem (if you consider that a problem, I suppose). Granted, its not a big deal, and I could be doing something wrong in my naive understanding of ScalaTest, but I like how it looks (see the screenshot in my post).

Looking forward to 1.0. Thanks.

Flat View: This topic has 4 replies on 1 page
Topic: ClassNotFoundException: scala.collection.generic.TraversableTemplate Previous Topic   Next Topic Topic: Empty test suite error

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use