4

I need to create a Executable Jar file for the Selenium Webdriver Project (TestNG) using Eclipse.

After crawling various website I understand we need to create a Main Class to execute the Test Suite.

I have created a Main Class with below code.

package com.testcases;
import java.util.ArrayList;
import java.util.List;
import org.testng.TestListenerAdapter;
import org.testng.TestNG;
import org.testng.xml.XmlClass;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;

public class Main {
public static void main(String[] args) {
    // TODO Auto-generated method stub
    TestListenerAdapter tla = new TestListenerAdapter();
    TestNG testng = new TestNG();
     Class[] classes = new Class[]{
             Abc.class,
             PQR.class,
             XYZ.class
             };
     testng.setTestClasses(classes);
     testng.addListener(tla);
     testng.run();
    }
}

When, I have created a runnable Jar using Export->Java->Runnable Jar from Selenium, and after running through jar file using command prompt with below command:

java -jar AbcXyz.jar

Program Execution get into the Infinite loop

Please help for creating such Executable Jar file.

Below are some References: Testng

Chetan G
  • 85
  • 1
  • 2
  • 7

1 Answers1

0

Did you end your tests with
driver.quit();

This could be the reason

mohamed faisal
  • 177
  • 2
  • 12