What is the reason we are using properties file 1

What is the reason we are using properties file

What is the main reason we are using properties file?
    - To avoid hard coding.
    - We are able to exclude some test data from our tests.
    - So that we can manage important test data from external files.

Here is what the above code is Doing:
1. We are creating a class called ConfigReader.
2. We are creating a method called getProperty.
3. We are passing a parameter called key.
4. We are creating a Properties object called prop.
5. We are creating a FileInputStream object called fis.
6. We are passing the path of the properties file to the FileInputStream object.
7. We are loading the properties file into the Properties object.
8. We are returning the value of the key from the properties file.

Similar Posts