September 2019
Intermediate to advanced
462 pages
11h 3m
English
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:
| | val iah = Airport( ... |
Read now
Unlock full access