Cucumber. Get property using System.getProperty()

60 Views Asked by At

I need to get the system property when running cucumber, but

private final String browserName = System.getProperty("browser");

eturns null

I'm using maven, cucumber, selenium and junit I need to get the system properties for cucumber from pom.xml . What am I doing for this. In pom.xml I specify the property to the file

<properties>
<browser>firefox</browser>
</properties>

and I use it in the plugin

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-surefire-plugin</artifactId>
 <version>${surefire.plugin.version}</version>
 <configuration>
 <systemPropertyVariables>
 <browser>${browser}</browser>
 </systemPropertyVariables>
 </configuration>
 </plugin>

Next, I run the script in the file.feature and trying to get verified

private final String browserName = System.getProperty("browser");

But the browser variable returns null. I don't understand why

0

There are 0 best solutions below