By Alvin Alexander. Last updated: October 26, 2020
Problem: You want to note that a ScalaTest unit test needs to be created, but you’re not ready to write it yet.
Solution
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)
Discussion
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.”
See Also
I hope it has been helpful. All the best, Al.
this post is sponsored by my books: | |||
#1 New Release |
FP Best Seller |
Learn Scala 3 |
Learn FP Fast |