Problem: You want to note that a ScalaTest unit test needs to be created, but you’re not ready to write it yet.
Instead of supplying the body of a test method, mark the test as
pending. In the ScalaTest TDD style, create a pending test like this:
test ("should allow removal of toppings") (pending)
In the ScalaTest BDD style, create a pending test like this:
it("should allow removal of toppings") (pending)
When your tests are run, pending tests will be printed like this:
[info] - should allow addition of toppings (pending)
When tests are run at the command line with SBT, pending lines are printed in a yellow(ish) color.
Marking tests as
pending helps support the TDD style, and it’s a convenient way of saying, “I need to write this test and implement the code behind it, but I haven’t gotten there yet.”
The Scala Cookbook
This tutorial is sponsored by the Scala Cookbook, which I wrote, and was published by O’Reilly in late 2013:
You can find the Scala Cookbook at these locations:
I hope it has been helpful. All the best, Al.
This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.