Spec2 :how to see failing test stacktrace and resolve "parseBody" keyword not found

82 Views Asked by At

I need to know two things here :
1. How to see the stacktrace of the failing test case? Right now I only see the line number it failed and the result. See the outcome of the test case below :

 
x return status 200
[error]    '404' is not equal to '200' (LayoutControllerSpec.scala:20)

  1. My controller uses parseBody keyword to parse json provided by JacksonJsonSupport class. how to write the test case for the action me below :

val create = post() {
      var layout:Layout = parsedBody.extract[Layout] //Layout is model class
      ....
}

Any help or ideas would be highly appreciated. Thanks, PS: This code is written for scalatra framework using spec2 framework.

1

There are 1 best solutions below

0
On

Let's answer the first question here.

You can use the failtrace argument to get a stacktrace for a failure

sbt> test-only *MySpec* -- failtrace

See also this question.