What is configuration or properties
file?
As we all are aware that it is not good practice to store hard
coded values in the code, also it is against the basic coding principal so with
the help of properties/configuration file, we can eliminate all these hard
coded from our code.
For this purpose .properties files
are used in Java programs to maintain configuration data, any project-specific setting such as
browser name or any test data. All the values in this file are normally stored
in the Key-Value Format.
So we need to follow below steps to a setup .properties file in our rest assured or any other testing framework.
3)In project Base Class, declare one Property
variable and provide the path of .properties file along with below code
snapshot.
4) Now we are ready to use our Properties the file inside test classes using below syntax.
pro.getProperty("JIRAHOST");
getProperty method will take
the Key of the property as a parameter and return the Value of
the matched key from the .properties file.
Now when we are going to execute code the compiler will read the data from this .properties file and this way we can also
remove all the hard-coded values from our project.
Keep Learning, Keep Sharing J
Steps To Read Configuration From Properties File In Rest Assured Framework - Qa Automation >>>>> Download Now
Reply>>>>> Download Full
Steps To Read Configuration From Properties File In Rest Assured Framework - Qa Automation >>>>> Download LINK
>>>>> Download Now
Steps To Read Configuration From Properties File In Rest Assured Framework - Qa Automation >>>>> Download Full
>>>>> Download LINK 3t
This method works perfectly fine for when calling from within the application. But when this property file needs to be tested against external calls, say, testing an API using Postman, it fails to load the properties.
ReplyAny fix for that?