--
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 http://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 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.
public abstract class BaseTest {
protected abstract Data getData();
@Test
public void test1() {
/* test here using getData() */
}
@Test
public void test2() {
/* test here using getData() */
}
}
@Test
public class ConcreteTest1 extends BaseTest {
@Override
protected Data getData() {
/* implementation of getData() */
}
}
@Test
public class ConcreteTest2 extends BaseTest {
@Override
protected Data getData() {
/* implementation of getData() */
}
}
@Test(groups = "ignored") // not working
public class ConcreteTest2 extends BaseTest {
@Override
protected Data getData() {
/* implementation of getData() */
}
}
...
test {
...
useTestNG() {
suites "../../config/testNG.xml"
excludeGroups 'broken', 'manual', 'slow', 'ignored'
}
...
}
...
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="TestNG Suite" time-out="2000">
<test name="All Tests">
<packages>
<package name=".*">
... // unrelated XMl configuration
</package>
</packages>
</test>
</suite>
package organized.chaos.forums;
import org.testng.annotations.Test;
public abstract class SimpleBaseTest {
protected abstract String getData();
@Test
public void test1() {
System.err.println(getClass().getName() + ":: + test1() with getData() ---> " + getData());
}
@Test
public void test2() {
System.err.println(getClass().getName() + ":: + test2() with getData() ---> " + getData());
}
@Test
public static class ConcreteTest1 extends SimpleBaseTest {
@Override
protected String getData() {
return "Hello World";
}
}
@Test
public static class ConcreteTest2 extends SimpleBaseTest {
@Override
protected String getData() {
return "Goodbye World";
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Class1Suite" parallel="false" verbose="2">
<test name="Class1Test">
<method-selectors>
<method-selector>
<script language="beanshell">
<![CDATA[whatClass = System.getProperty("class", "all");
return testngMethod.getInstance().getClass().getName().endsWith(whatClass) == false;
]]>
</script>
</method-selector>
</method-selectors>
<classes>
<class name="organized.chaos.forums.SimpleBaseTest$ConcreteTest1"/>
<class name="organized.chaos.forums.SimpleBaseTest$ConcreteTest2"/>
</classes>
</test>
</suite>
--