ScalaTest 1.0 for JUnit

View: New views
2 Messages — Rating Filter:   Alert me  

ScalaTest 1.0 for JUnit

by Bill Venners-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I wanted to let JUnit folks know that we released ScalaTest 1.0 this
morning, which has deep integration with JUnit. ScalaTest is for all
practical purposes a "JUnit add-on" that facilitates using JUnit and
Scala together. The promise is that by writing tests in Scala, you can
reduce the lines of test code you need to maintain by half or more,
and at the same time increase the clarity of that code. That's the
benefit. The up front cost is you need to learn Scala. But ScalaTest
does let you mix in tests written in Scala with your existing tests
written in Java, so it is easy to dip your toe in before jumping in. I
also think writing tests in Scala is a good way to start learning and
getting experience with Scala, because it is important code, but not
your production code. So it reduces the risk of trying a new language.
And you can certainly write tests in Scala to test production code
written in Java.

You can get a good overview of ScalaTest's JUnit integration on this page:

http://www.scalatest.org/getting_started_with_junit

You can see we have good integration with both JUnit 3 and 4 (because
I know many people are still using JUnit 3). One other thing to keep
in mind is that because of the org.junit.runner.Runner class, which we
extend in our org.scalatest.junit.JUnitRunner class, you can pretty
much write tests in any style you want and run them with JUnit. For
example, you could write in a Behavior-Driven Development (BDD) style
and still run the tests with JUnit. So ScalaTest adds BDD to JUnit in
effect, and other styles as well. By annotating with JUnitRunner, you
can use JUnit to run tests written with any of the "Suite" or "Spec"
traits you see here:

http://www.scalatest.org/quick_start

Here's a list of the ScalaTest/JUnit integration points:

- AssertionsForJUnit, ShouldMatchersForJUnit, and
MustMatchersForJUnit, which provide concise, readable assertion and
matcher DSLs, ensure that assertion failures are reported as
"failures" not "errors" by JUnit and its ecosystem
- JUnit3Suite extends junit.framework.TestCase as well as
org.scalatest.Suite, which allows you to write traditional TestCase
tests that can be run by either JUnit 3 or ScalaTest
- JUnitSuite extends org.scalatest.Suite, and allows you to write
traditional JUnit 4-style tests (with @Test annotation, etc.) that can
be run by either JUnit 4 or ScalaTest
- JUnitWrapperSuite allows you to run existing JUnit tests written in
Java (or Groovy, etc.) with ScalaTest's Runner
- JUnitRunner allows you to run any ScalaTest Suite written in any
style (such as BDD) with JUnit
- ScalaTest's Runner has a -j option that allows you to specify JUnit
tests written in Java (or Groovy, etc.) and have them run alongside
ScalaTest tests (i.e., so you get one uniform report)
- ScalaTest's Ant task can generate the XML format produced by the
JUnit ant task, which can then be used by JUnitReport ant task,
Hudson, etc., to produce reports.

Let me know if anyone has any questions. I'll keep an eye on this
list, but you might get a quicker response if you cross-post
JUnit-related ScalaTest questions to the scalatest-users mailing list
as well.

http://groups.google.com/group/scalatest-users

Thanks.

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

Re: ScalaTest 1.0 for JUnit

by David Saff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bill,

This is like enjoying both peanut butter and chocolate, and just
hearing the announcement of Reese's Pieces.

Thanks!

   David

On Mon, Oct 12, 2009 at 3:41 PM, Bill Venners <bill@...> wrote:

> Hi,
>
> I wanted to let JUnit folks know that we released ScalaTest 1.0 this
> morning, which has deep integration with JUnit. ScalaTest is for all
> practical purposes a "JUnit add-on" that facilitates using JUnit and
> Scala together. The promise is that by writing tests in Scala, you can
> reduce the lines of test code you need to maintain by half or more,
> and at the same time increase the clarity of that code. That's the
> benefit. The up front cost is you need to learn Scala. But ScalaTest
> does let you mix in tests written in Scala with your existing tests
> written in Java, so it is easy to dip your toe in before jumping in. I
> also think writing tests in Scala is a good way to start learning and
> getting experience with Scala, because it is important code, but not
> your production code. So it reduces the risk of trying a new language.
> And you can certainly write tests in Scala to test production code
> written in Java.
>
> You can get a good overview of ScalaTest's JUnit integration on this page:
>
> http://www.scalatest.org/getting_started_with_junit
>
> You can see we have good integration with both JUnit 3 and 4 (because
> I know many people are still using JUnit 3). One other thing to keep
> in mind is that because of the org.junit.runner.Runner class, which we
> extend in our org.scalatest.junit.JUnitRunner class, you can pretty
> much write tests in any style you want and run them with JUnit. For
> example, you could write in a Behavior-Driven Development (BDD) style
> and still run the tests with JUnit. So ScalaTest adds BDD to JUnit in
> effect, and other styles as well. By annotating with JUnitRunner, you
> can use JUnit to run tests written with any of the "Suite" or "Spec"
> traits you see here:
>
> http://www.scalatest.org/quick_start
>
> Here's a list of the ScalaTest/JUnit integration points:
>
> - AssertionsForJUnit, ShouldMatchersForJUnit, and
> MustMatchersForJUnit, which provide concise, readable assertion and
> matcher DSLs, ensure that assertion failures are reported as
> "failures" not "errors" by JUnit and its ecosystem
> - JUnit3Suite extends junit.framework.TestCase as well as
> org.scalatest.Suite, which allows you to write traditional TestCase
> tests that can be run by either JUnit 3 or ScalaTest
> - JUnitSuite extends org.scalatest.Suite, and allows you to write
> traditional JUnit 4-style tests (with @Test annotation, etc.) that can
> be run by either JUnit 4 or ScalaTest
> - JUnitWrapperSuite allows you to run existing JUnit tests written in
> Java (or Groovy, etc.) with ScalaTest's Runner
> - JUnitRunner allows you to run any ScalaTest Suite written in any
> style (such as BDD) with JUnit
> - ScalaTest's Runner has a -j option that allows you to specify JUnit
> tests written in Java (or Groovy, etc.) and have them run alongside
> ScalaTest tests (i.e., so you get one uniform report)
> - ScalaTest's Ant task can generate the XML format produced by the
> JUnit ant task, which can then be used by JUnitReport ant task,
> Hudson, etc., to produce reports.
>
> Let me know if anyone has any questions. I'll keep an eye on this
> list, but you might get a quicker response if you cross-post
> JUnit-related ScalaTest questions to the scalatest-users mailing list
> as well.
>
> http://groups.google.com/group/scalatest-users
>
> Thanks.
>
> Bill
> ----
> Bill Venners
> Artima, Inc.
> http://www.artima.com
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>