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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -