November 2018
Intermediate to advanced
404 pages
10h 16m
English
Given the non-blocking asynchronous communication model in most of the server-side frameworks, each test often involves an asynchronous call to an API method. The callback of an asynchronous call contains the results of a test run. This means that the validation of the returned results of a test happen at an undetermined time later. You need to take precautionary measures to ensure that the thread for validating the result doesn't terminate prematurely.
The Kitura test boilerplate code shows you how to handle a non-blocking asynchronous situation elegantly:
func testGetStatic() { let printExpectation = expectation(description: "The /route will serve static HTML content.") // [1] URLRequest(forTestWithMethod: ...Read now
Unlock full access