Issue
Hello folks , I'm testing Rest API , using rest-assured . maven , cucumber , and as a programming language I use JAVA, so I'm facing an issue , to run my some test in production environment,so I have properties file , where I store the URL for QA environment , and I have properties reader method , which reads from properties, so now I need to add URL of production , and execute both QA & prod , please help if u have any ideas to solve this issue , I've done my research in Stack overflow, couldn't find anything useful, found some solutions but I didn't get at all , because of lack of experience Thanks in advance
Solution
If I understand your problem correctly, this solution will be similar to what I did for one of my previous teams. You will need to create a custom property in Maven, like this one:
<properties>
<myEnvironment>${myEnv}</myEnvironment>
</properties>
Then, you will need to create the properties containing the URLs in the properties file:
QA=http://www.yourQAEnvURL.com
PROD=http://www.yourProdEnvURL.com
Lastly, you will need to pass the value using Maven (along with your other arguments):
mvn test ... -DmyEnvironment=QA
Your test application will need to consume this argument to look up the appropriate URL from the properties file in order to be able to test the correct environment.
Answered By - hfontanez
Answer Checked By - Willingham (JavaFixing Volunteer)