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

Specs2 data tables

Data tables in Specs2 are similar to the table in table-driven property checks. The table consists of a sample input value and an expected result. A function test case follows the table that is run for each row of the table with inputs acting as input to the function, and the result of the function is verified with the expected output in the table:

package com.packt import org.specs2.matcher.DataTables import org.specs2.Specification class EmployeeAgeSpecification extends Specification with DataTables {def is = "Trying out a table of values for testing purposes to determine the age of an employee".name ^ """The first column is the employee first name, the second is a employee last name, and third is Year of Birth and the forth ...

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