views:

136

answers:

2

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)?

+1  A: 
cnt aka "my_function return value" must be_==(3)
Alexander Azarov
It does not seem to change anything :-(
Mekk
+1  A: 

Hi Mekk,

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.

Eric
Indeed, surefire-reports now contain this information. It may be that Alexander's suggestion helped (i checked those files earlier and I could not find the actual results there). Not perfect, but it is some solution.I played briefly with sbt and it seemed to have problems with getting all dependant jars in order, but I did not try too hard, it is still on my todo.
Mekk