Mismatch between instance/method classes

9 views
Skip to first unread message

Music Account

unread,
Oct 28, 2022, 1:19:04 AM10/28/22
to testng-users
My implementation is as follows: 
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
public abstract class ParentTest {

    // Some logic

    @Factory
    public Object[] tst_createMultipleParentTests() {
       // Logic to create multiple parent tests

}

-*-*-*-*-*-*-*-*-*-*

public class ChildTest extends ParentTest {

    // Some logic

    @Factory
    public Object[] tst_createChildTests() {
       // Logic to create multiple child tests
}

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

When trying to run this code, I am getting the following exception: 

testng.TestNGException: 
Found a default constructor and also a Factory method when working with ParentTest. Root cause: Mismatch between instance/method classes [ChildTest] [ParentTest].

Looks like it is happening because @Factory methods are implemented in both ParentTest and ChildTest classes. Does anyone knows how can I fix this?



⇜Krishnan Mahadevan⇝

unread,
Oct 28, 2022, 2:02:57 AM10/28/22
to testng...@googlegroups.com
What version of TestNG are you working with ? Please ensure that you try using the latest released version.
  • 7.6.1 (needs JDK11)
  • 7.5 (last version that supports JDK8)
Also please share a complete standalone example that can be used to reproduce the problem and also share details on how you are running your test (via IDE (or) via a suite file (or) via a build tool )

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/a27bd3aa-4e23-4d89-9e6f-9e51a51d5cd8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages