0
votes

I want to create a executable jar from selenium testNg code

 import org.testng.TestNG;
import com.test.Utility.ExtentReporterNG;

public class TestRunner {
    static TestNG testNg;
    public static void main(String[] args) {
        ExtentReporterNG ext = new ExtentReporterNG();
        TestNG testNg = new TestNG();
        testNg.setTestClasses(new Class[] { LoginTest.class });
        testNg.addListener(ext);
        testNg.run();
    }
}

It contains 3 test cases within LoginTest class but its giving below error while executing:

=============================================== Command line suite Total tests run: 3, Passes: 0, Failures: 0, Skips: 3

Configuration Failures: 1, Skips: 1

1

1 Answers

0
votes

Replace your line of code :

testNg.addListener(ext);

Replace with:

testNg.addListener((ITestNGListener)ext);

It will work fine

Note :

I assume that you write reporting logic in your ExtentReporterNG class which implements IReporter