...

/

Writing Empirical Tests

Writing Empirical Tests

We'll cover the following...

Empirical tests

Empirical tests are common in unit testing—you call a method and verify that it did what you expected. Such tests help us to verify that, as code evolves, the expectations are still met and the code continues to work as intended.

Empirical tests are useful for functions and methods that are deterministic and don’t have any dependencies that hold state. We’ll create a few empirical tests for the Airport class now.

First, let’s create some properties in the test suite using the yet-to-be-written Airport class. For this, within the AirportTest class, let’s define a few sample properties before the init() function:

// AirportTest.kt
val iah = Airport("IAH", "Houston", true)
val iad =
...