Introduction
Services are the heartbeat of any application because of the critical role they play in the entire application. They are also responsible for orchestrating communications between the controllers and lower-level resources such as the database, messaging resources, third-party services, and so on. Furthermore, they often encapsulate the business logic of the application, thereby doing most of the heavy lifting so to speak. As such, it is important to have a means of testing them and knowing whether they pose a bottleneck to the application or not. Testing them could help expose areas that need tuning within the application or infrastructure that could then be communicated to the responsible parties.
Apart from testing services, it is also beneficial to test the underlying resources the application relies on directly. Such resources could be the database, messaging, e-mail, ftp, reporting, and so on.
In this chapter, we will detail how to test two categories of services, REST and...