Mekk
Mekk

Reputation: 1459

Getting failure detail on failed scala/maven/specs tests

I am playing a bit with scala, using maven and scala plugin.

I can't find a way to have mvn test report failure details - in particular, whenever some function returns wrong reply, I am getting information about the failure, but I have no way to see WHICH wrong reply was reported.

For example, with test like:

object MyTestSpec extends Specification {

  "my_function" should {
      "return proper value for 3" {
           val cnt = MyCode.my_function(3)
           cnt must be_==(3)
      }
  }
}

in case my function returns something different than 3, I get only

Failed tests:
  my_function should return proper value for 3

but there is no information what value was actually returned.

Is it possible to get this info somehow (apart from injecting manual println's)?

Upvotes: 3

Views: 408

Answers (2)

Eric
Eric

Reputation: 15557

The Maven JUnit plugin only shows the failed tests in the console and not error messages. If you want to read the failure message you need to open the corresponding target/site/surefire-reports/MyTestSpecs.txt file.

You can also swap Maven for sbt-0.6.9 (Simple Build Tool) which can run specs specifications.

Eric.

Upvotes: 2

Alexander Azarov
Alexander Azarov

Reputation: 13221

cnt aka "my_function return value" must be_==(3)

Upvotes: 2

Related Questions