Property files and parsing test data on the fly
In a lot of cases, the test environment data, such as username, password, servers, IP, and URL are dynamic, and change with the environment they run on. In these situations, it makes sense to use a placeholder in the test data and replace the values on the fly when the test method is run.
To do this, environment data can be stored in property files, a system property can be used to pass in the name of the file for that specific environment, and it can then be read as part of the @BeforeSuite
method.
Let's take a quick look at the various parts of this equation.
Environment property files
Let's say the server URL, username, and password are dynamic and change for each test environment that the suite runs against. To handle this type of data, users can create a property file to store those values:
// sample test environment property file server.1.url=https://myDomain.com [email protected] server.1.password=SuperEasyPassw0rd...