I need to pass file location as parameter in testng.xml. I'm working on a framework which accepts the location of excel file (Data driven) as parameter in testng.xml. Below is a sample of testng.xml.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<parameter name="Excel" value="C:\Users\workspace\PracticeProjects\MavenSample\src\test\resources\excel\hello.xlsx"></parameter>
<test name="Test">
<classes>
<class name="com.abc.props.SampleTest11"></class>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Since the work space location would differ for different users, I would like to understand if there is a way to dynamically identify the value instead of hard-coding. If the base path location or root directory of project is identified, the remaining src\test\resources\excel\hello.xlsx would remain constant. Looking for help on how to do that.
The project is a Maven project and if I can somehow identify the base directory of project in pom.xml and pass it as value to testng.xml, that would also solve my purpose.
I understand there is a way to pass the value through command line but am looking for the above mentioned approaches.
Thanks in advance.!!