Our scala test case calls a REST API for ex. creating a user and it checks if the userId is actually created or not by parsing the output response.
In case the REST API throws any error, the userId is empty and the customReport shows the event as TestFailed with org.scalatest.exceptions.TestFailedException: "" equaled ""
due to the assert condition (assert(userId != ""))
Is there a way that I can pass the response of REST API to the reporter. Please advise.
class CustomReport extends Reporter {
override def apply(event: Event): Unit = {
}
}
Consider providing custom information on failure via clue, for example,
or
where
customInformation
could be, say,Here is a working example
which outputs
For an example of custom reporter consider https://stackoverflow.com/a/56790804/5205022