Q: Parallel cross browser testing with Selenium and TestNG without using testng.xml I am using Maven Failsafe + TestNG to run Selenium tests. I know it is possible to pass parameters to my TestNG tests by defining system properties in pom.xml like this:
 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
      <systemPropertyVariables>
        <browser>firefox</browser>
      </systemPropertyVariables>
    </configuration>
  </plugin>

My TestNG test refers this property like this:
@Parameters("browser")
public void setUpClass(@Optional("firefox") String browser)
{
   ...
}

However, I was wondering is it possible to run cross browser tests in parallel without a need to specify a testng.xml file. I was trying something like this but it didn't work. Appreciate if you can help.
 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
      <systemPropertyVariables>
        <browser>firefox, chrome</browser>
      </systemPropertyVariables>
      <parallel>tests</parallel>
    </configuration>
  </plugin>

Is it possible to achieve this with just pom.xml configuration? Because of the multi-module nature of my project, I am not keen in using testng.xml file.

A: You may populate all properties in *.properties file and then use it with Properties Maven Plugin. QATools Properties will make easy to use them during drivers configuration.

A: You can run any TestNG test programmatically as well. Check here TestNG Running programmatically
so from maven u just need to call your class with main method having the code to run testng programmatically and read whatever properties you wish from any source (csv, properties, xml, xlsx.,etc..)

A: This is a simple workaround to achieve the same goal. What I am doing and it helps me to maintain a clean code and not adding to many variations and all.
This is based on the assumption that you are using Jenkins to trigger your tests.
You can create 2 Jenkins jobs on the Jenkins server. And then execute them with different mvn commands.
Such as
mvn clean test -Dbrowser=firefox
and
mvn clean test -Dbrowser=chrome
Hope this helps.
