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; #2978

Closed
1 of 7 tasks
jamarante89 opened this issue Sep 4, 2023 · 4 comments

Comments

@jamarante89
Copy link

TestNG Version

Note: only the latest version is supported
7.8.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>

Contribution guidelines

Incase you plan to raise a pull request to fix this issue, please make sure you refer our Contributing section for detailed set of steps.

@juherr
Copy link
Member

juherr commented Sep 4, 2023

The issue comes from https://github.com/email2vimalraj/TestNGExtentsReport/blob/master/src/main/java/com/vimalselvam/testng/listener/ExtentTestNgFormatter.java#L193
You may not have used a supported version of ExtentReports.
You should report an issue there: https://github.com/email2vimalraj/TestNGExtentsReport/

@jamarante89
Copy link
Author

The issue comes from https://github.com/email2vimalraj/TestNGExtentsReport/blob/master/src/main/java/com/vimalselvam/testng/listener/ExtentTestNgFormatter.java#L193 You may not have used a supported version of ExtentReports. You should report an issue there: https://github.com/email2vimalraj/TestNGExtentsReport/

hi @juherr , may I kindly know what woudl be the supported version of extent reports for TestNG?

@juherr
Copy link
Member

juherr commented Sep 5, 2023

Ping @email2vimalraj

@juherr
Copy link
Member

juherr commented Sep 5, 2023

@jamarante89 As indicated on email2vimalraj/TestNGExtentsReport#16 3.3 should be a good start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants