How do I disable subclass tests?
My design includes a base class with @Test methods, and subclasses without their own @Test methods. Using enabled=false on the class level does not disable the subclass as you might hope.
// A.java
public abstract class A {
@Test
public void testMethod(){
//...
hookMethod();
//...
}
protected abstract void hookMethod();
}
// B.java
@Test (enabled=false) //doesn't disable test
public class B extends A {
protected void hookMethod() {
// implementation
}
}
protected abstract void hookMethod();
}
// C.java
@Test //runs like B
public class C extends A {
protected void hookMethod() {
// implementation
}
}
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Joshua,
You mean you tried something like this using TestNG 6.14.3 ?
import org.testng.annotations.Test;
@Test
public class ParentClass {
public void testA() {
System.err.println("testA()");
}
public void testB() {
System.err.println("testB()");
}
}
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
public class ChildClass extends ParentClass {
@Test
@Ignore
public void testC() {
System.err.println("testC()");
}
@Test
@Ignore
public void testD() {
System.err.println("testD()");
}
}
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 Scribbings @ http://rationaleemotions.wordpress.com/
Reply-To: <testng...@googlegroups.com>
Date: Tuesday, February 27, 2018 at 9:48 PM
To: <testng...@googlegroups.com>
Subject: Re: [testng-users] Re: How do I disable a subclass test?
--
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to testng-users...@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
JOSHUA FOX
Director, Software Architecture | Freightos
--
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 post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
JOSHUA FOX
Director, Software Architecture | Freightos
T (Israel): +972-545691165 | T (US): +1-3123400953
Smooth shipping.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
My class setup is a little different. The subclass has no @Test methods of its own.Thank you for the @Ignore annotation! I guess it new https://github.com/cbeust/testng/pull/861 and seems to do the job.
Joshua,
This is a bug. We need to get this fixed.
But with the way currently TestNG works, it may be a bit difficult.
You can track the discussions of this issue here : https://github.com/cbeust/testng/issues/1709
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 Scribbings @ http://rationaleemotions.wordpress.com/
From: <testng...@googlegroups.com> on behalf of Joshua Fox <jos...@freightos.com>
Reply-To: <testng...@googlegroups.com>
Date: Wednesday, February 28, 2018 at 4:03 PM
To: <testng...@googlegroups.com>
Subject: Re: [testng-users] Re: How do I disable a subclass test?
Unfortunately, with the following code, mvn test still runs the test, printing ChildClassTest#hook(), whether I use either or both of Ignore and enabled=false
--
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to testng-users...@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
JOSHUA FOX
Director, Software Architecture | Freightos
Error! Filename not specified.
--
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 post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to testng-users...@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
JOSHUA FOX
Director, Software Architecture | Freightos
--
JOSHUA FOX
Director, Software Architecture | Freightos
--
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 post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
JOSHUA FOX
Director, Software Architecture | Freightos
Error! Filename not specified.
T (Israel): +972-545691165 | T (US): +1-3123400953
Smooth shipping.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe
.
To unsubscribe from this group and all its topics, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
JOSHUA FOX
Director, Software Architecture | Freightos
T (Israel): +972-545691165 | T (US): +1-3123400953
Smooth shipping.
--
JOSHUA FOX
Director, Software Architecture | Freightos
T (Israel): +972-545691165 | T (US): +1-3123400953
Smooth shipping.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to
testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/d_m7S0upJl8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.