September 2018
Intermediate to advanced
764 pages
20h 6m
English
At the moment, we are storing the request, result, error, and payload variables at the top level of the file's scope.
But step definitions can be mixed and matched in different scenarios. For example, in another scenario where we are updating a specific user, we may want to test that the API returns with the correct status code when given a malformed request. Here, we can reuse the same step definition, "our API should respond with a 400 HTTP status code", but this time, the error variable may not be set if the previous steps were defined in a different file.
Instead of using file-scoped variables, we can instead pass a context object into each step and use it to keep track of the results. This context ...
Read now
Unlock full access