Confirmation and exception property files
In the preceding example, we extracted the username, password, and error message data from the JSON data file. But what if the username and password need to change dynamically based on the test environment being used? Would we really want to hardcode in the username and password for a test? What if the error message is used in 10 other places in the application? Would we really want to change that test message data 10 times if the message is changed in the application?
The answer is simple: probably not! So, in this section, let's start by talking about using property files to store confirmation and exception messages.
Property files
Using property files in development is fairly common and simple to do. In some development environments, actual confirmation and exception messages are stored in confirmation.properties
and exception.properties
files. In those files, there is usually a code=message
pairing for each type of message and those are pulled on...