O'Reilly logo

Scala Test-Driven Development by Gaurav Sood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Write a failing test – RED

Time to put our programming hats on. We will start with the very first test. It is very important to understand the acceptance criteria before we make a start on the test. Our test will be documenting our understanding of the scenario.

In the normal course of events at this stage, if there are any questions about the scenario, they will need to be cleared up with end user or any representation of the end user.

Let's start with the first test. Create a Scala file DecimalBinarySpec.scala for the test under the com.packt package inside src/test/scala as given here:

package com.packt import org.scalatest.FlatSpec class DecimalBinarySpec extends FlatSpec{ "base conversion utility" should "convert a number 99 into a binary number ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required