An assertion tells you where a scenario stopped, but not necessarily what caused the failure. The Test Log pattern records what the automation did before that point, making the path to the error easier to follow. section 19.3 section 19.7
Start with the boundary between the test layer, which decides what actions to take, and the automation layer, which performs them. Log each action’s name, inputs, result, and duration. A shared test-action implementation can record these details consistently instead of relying on scattered log statements. section 19.3
A login that needs more than a pass or fail
A login log records the attempted action, a masked password, and the returned result. When deeper detail is needed, it can also show the REST API request and response made during that action. Together, those entries distinguish the scenario’s intended action from the lower-level interaction that carried it out. section 19.3
Listing 19.9 Hierarchical test execution log
*** Test execution result (lines trimmed for readability) ***
When the customer attempts to log in with valid password
18:52:15 Info: Executing Login with (Rebecca, ****)...
18:52:15 Debug: REST API request: POST /api/auth/login, Content:...
18:52:15 Debug: REST API response: 200 (OK), Content:...
18:52:15 Info: Login executed successfully in 00:00:00.2476439 with...
-> done: AuthenticationStepDefinitions.WhenTheCustomerAttemptsToLogIn...
Then they should be authenticated
-> done: AuthenticationStepDefinitions.ThenTheyShouldBeAuthenticated...The hierarchical log nests REST API entries under the login action, so the order and relationship of events remain visible. section 19.3
Keep the default log useful rather than exhaustive: excess detail can obscure important events and consume storage. Adjust detail through configuration or feature-file tags when diagnosis calls for more. Application log entries can provide further context, but the test log’s central job is to show the flow of test automation. section 19.7
