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 column is the expected age in 2016""" ! employeeTable def employeeTable = "First Name" | "Last Name" | "Year...