Hi ph,

If you end up needing to use JUnit, you can import Assertions or
ShouldMatchers or MustMatchers from ScalaTest to get a nicer
scala-like assertion syntax inside JUnit tests. JUnit won't care it
was written in Scala or used ScalaTest assertions and will run it and
generate JUnit-compatible output, since it actually is JUnit. Here's
what that might look like:

import org.junit.Test
import org.scalatest.matchers.MustMatchers._

class MyJUnitTest {
  @Test
  def mapKeys() {
    Map("one" -> 1, "two" -> 2) must contain key ("two")
  }
  @Test
  def stringLength() {
    "hello, world" must have length (12)
  }
  @Test
  def stringCharAtMethodRejectsBadInput() {
    intercept[StringIndexOutOfBoundsException] {
      "hi".charAt(-1)
    }
  }
}

http://www.artima.com/scalatest

Bill

On Wed, Jul 1, 2009 at 3:07 PM, ph<pkirsa...@gmail.com> wrote:
>
> This question might be obvious to most of the people here, but since I
> new to Scala and Java I'm not clear
>
> Maven generates 2 different unit test files:
> MySpec >> specs
> AppTest >> junit
>
> running "mvn test" invokes AppTest (and other test cases with
> annotation @Test)
> running from Eclipse project as JUnit invokes MySpec
>
> I'm trying to figure out what unit test framework to use in my
> project. I'd prefer to have JUnit compatible output as continuous
> build system will, probably, understand it.
>
> Are both test frameworks generate JUnit-compatible output?
> How to make maven invoke specs test when running "mvn test"?
> Why is it 2 different test frameworks used? Are they complimentary? If
> yes when use which?
> I will probably use Hudson for continuous builds and also invoke unit
> tests from script and or command line and will need parse result and
> generate reports. What framework is better for these purposes? Or
> maybe use both in defferent cases?
>
> >
>



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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to