3

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

cetnar
  • 9,357
  • 2
  • 38
  • 45
Mekk
  • 1,441
  • 10
  • 12
  • While applying suggestions below (adding alias via aka and checking test reports in target/surefire-reports) help, this solution is by far not perfect, so I keep the question open. Maybe there is some trick to force maven to report those errors better.... – Mekk Jan 05 '10 at 22:46

2 Answers2

2
cnt aka "my_function return value" must be_==(3)
Alexander Azarov
  • 12,971
  • 2
  • 50
  • 54
2

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
  • 15,494
  • 38
  • 61
  • 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 Jan 05 '10 at 22:44