Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98787

How to add testng parameters in a java main method?

$
0
0

I wanted to trigger the execution from a java main method instead of testng.xml file.

My doubt is how to add the parameters to Java main method for the execution. I have found .addListener and .setGroups to add listener and groups respectively, but couldn't able to find a way to add parameters.

Please help me out to start the exection through java main method.

Sample:

public class Execution {
    public static void main(String[] args) throws IOException {
        TestNG test = new TestNG();
        test.setTestClasses(new Class[] {AETVTests.class});
        test.addListener(new MyTestListenerAdapter());
        test.setGroups("");
        test.run();
    }
}

Viewing all articles
Browse latest Browse all 98787

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>