maven - Is it possible to pass property file value to testng.xml as parameter value? -
is possible pass property file value testng.xml
parameter value?
example:
test.properties:
browser = firefox
testng.xml:
parameter name = "browser" value = "${test.browser}"
yes, possible filtering testng.xml
test resource.
inside pom, need declare filter poiting properties files , override <testresources>
filter testng.xml
resource.
<build> <filters> <filter>path/to/test.properties</filter> <!-- relative location of pom --> </filters> <testresources> <testresource> <directory>src/test/resources</directory> <includes> <include>testng.xml</include> </includes> <filtering>true</filtering> </testresource> <testresource> <directory>src/test/resources</directory> <excludes> <exclude>testng.xml</exclude> </excludes> </testresource> </testresources> <!-- rest of build section --> </build>
if properties file contains key test.browser
, correctly replace plaholder ${test.browser}
value of key. of happen before tests launched testng see filtered file values replaced.
note above configuration filters testng.xml
avoid filtering much. extend filter multiple files.
Comments
Post a Comment