ScalaTest 110: Temporarily disabling unit tests

Problem: When using ScalaTest, you want to temporarily disable one or more tests, presumably until you can get them working again.


When using BDD-style tests, change it method calls to ignore:

ignore ("A new pizza has zero toppings", DatabaseTest) {
  Given("a new pizza")
  pizza = new Pizza
  Then("the topping count should be zero")
  assert(pizza.getToppings.size == 0)

With TDD-style tests, change test method calls to ignore:

ignore ("A new pizza has zero toppings", DatabaseTest) {
  //assert(pizza.getToppings.size === 1)
  expectResult(0) {

When you run your tests, the tests you changed to ignore will result in output similar to the following:

[info] - A new pizza has zero toppings !!! IGNORED !!!

When run from the command line using SBT, this output is displayed in a yellow font.


Many times when testing your code, you’ll need to temporarily disable some tests until you can get them working again. Changing it and test to ignore is a simple way to change the tests so they’ll be skipped over. The output is a hard-to-miss reminder that the tests are being ignored.

See Also

See these links for more information:

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.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Enter the characters shown in the image.