I run some tests using ScalaTest, which rely on connections to test servers. Currently, I have created my own Spec, similar to this one:
abstract class ServerDependingSpec extends FlatSpec with Matchers { def serverIsAvailable: Boolean = {
Is it possible to ignore (but not interrupt) tests when this method returns false ?
I am currently doing this in a "hacker" way:
"Something" should "do something" in { if(serverIsAvailable) { // my test code } }
but i want something like
whenServerAvailable "Something" should "do something" in { // test code }
or
"Something" should "do something" whenServerAvailable { // test code }
I think I should define my own tag, but I can only reference the in or ignore source code, and I donβt understand how I should connect my custom implementations.
How to do it?
scala scalatest
rabejens
source share