Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestNG: java.lang.NoSuchMethodError: com.aventstack.extentreports.ExtentTest.assignCategory([Ljava/lang/String;)Lcom/aventstack/extentreports/ExtentTest #16

Open
1 of 7 tasks
jamarante89 opened this issue Sep 5, 2023 · 0 comments

Comments

@jamarante89
Copy link

jamarante89 commented Sep 5, 2023

TestNG Version

Note: only the latest version is supported
7.8.0

ExtentReport Version

Note: only the latest version is supported
3.3.0

Expected behavior

Should be able to execute test in parallel with testNG attributes groups and dependsOnGroups

Actual behavior


java.lang.NoSuchMethodError: com.aventstack.extentreports.ExtentTest.assignCategory([Ljava/lang/String;)Lcom/aventstack/extentreports/ExtentTest;

	at com.vimalselvam.testng.listener.ExtentTestNgFormatter.afterInvocation(ExtentTestNgFormatter.java:193)
	at org.testng.internal.invokers.InvokedMethodListenerInvoker$InvokeAfterInvocationWithoutContextStrategy.callMethod(InvokedMethodListenerInvoker.java:100)
	at org.testng.internal.invokers.InvokedMethodListenerInvoker.invokeListener(InvokedMethodListenerInvoker.java:62)
	at org.testng.internal.Invoker.runInvokedMethodListeners(Invoker.java:566)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:713)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Is the issue reproducible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

Please, share the test case (as small as possible) which shows the issue

ReportsTest.java

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class ReportsTest extends GenericTest {
    private GenericController genericController;
    private ReportsController reportsController;

    @BeforeMethod
    public void beforeMethodReports(){
        genericController = new GenericController(selDriver);
        reportsController = new ReportsController(selDriver);
    }

    @Test(dataProvider = "testA", dataProviderClass = DataProviderCustom.class, groups = {"Reports"})
    public void testA(String dataTestCaseName, ReportModel reportModel){
        try {
            // Setup

            // Trigger

            // Assertion

        } catch (Exception ex) {
            Utilities.printUnexpectedPageErrors(selDriver, dataTestCaseName, ex);
        }
    }

}

FileUploadTest.java

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class ReportsTest extends GenericTest {
    private GenericController genericController;
    private ReportsController reportsController;

    @BeforeMethod
    public void beforeMethodReports(){
        genericController = new GenericController(selDriver);
        reportsController = new ReportsController(selDriver);
    }

    @Test(dataProvider = "testB", dataProviderClass = DataProviderCustom.class, groups = {"FileUpload"}, dependsOnGroups = {"Reports"})
    public void testB(String dataTestCaseName, ReportModel reportModel){
        try {
            // Setup

            // Trigger

            // Assertion

        } catch (Exception ex) {
            Utilities.printUnexpectedPageErrors(selDriver, dataTestCaseName, ex);
        }
    }

}

suite.xml

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Selenium Webdriver Test" parallel="classes" thread-count="3">
    <listeners>
        <listener class-name="com.vimalselvam.testng.listener.ExtentTestNgFormatter" />
    </listeners>
    <test name="Test in FF">
        <classes>
            <class name="com.sample.test.FileUploadTest">
                <methods>
                    <include name="testA"/>
                </methods>
            </class>
            <class name="com.sample.test.ReportsTest">
                <methods>
                    <include name="testA" />
                </methods>
            </class>
        </classes>
    </test>
</suite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant