在Testng XML套件中使用组时,将排除所有测试

在Testng XML套件中使用组时,将排除所有测试,testng,Testng,当我尝试在Testng XML套件中对测试进行分组时,所有的测试方法都被排除在测试运行之外 我编写测试时希望运行类中的所有测试方法,但只执行套件中的某些类,因此我使用了类级注释: @Test (groups={ TestConstrants.Group1}) public class ABCTests extends AbstractIntegrationTest { @Test public void Test1() throws Exception @Test p

当我尝试在Testng XML套件中对测试进行分组时,所有的测试方法都被排除在测试运行之外

我编写测试时希望运行类中的所有测试方法,但只执行套件中的某些类,因此我使用了类级注释:

@Test (groups={ TestConstrants.Group1})
public class ABCTests extends AbstractIntegrationTest
{

    @Test
public void Test1() throws Exception

    @Test
    public void Test2() throws Exception
}

@Test (groups={ TestConstrants.Group2})
public class DEFTests extends AbstractIntegrationTest
{

    @Test
public void Test3() throws Exception

    @Test
    public void Test4() throws Exception
}
My Testng XML的配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SuiteGroup">
  <test name="TestGroups" preserve-order="true">
    <groups>
    <run>
        <include name="TestConstants.Group1"/>
        <exclude name="TestConstants.Group2"/>
    </run>  
</groups>
    <classes>
      <class name="ABCTests"/>
      <class name="DEFTests"/>
    </classes>
  </test> <!-- TestGroups -->
</suite> <!-- SuiteGroup -->

在本例中,我希望只运行类ABCTests中的测试,但是,由于某种原因,似乎所有测试都被排除在外。我已经验证了我正在扩展的类(AbstractIntegrationTest)中的方法是否设置为“alwaysRun=true”


我知道我不能简单地包含我不想运行的类,但我可能会有数百个测试,按组维护测试套件比按类维护要容易得多。

如果您可以创建一个显示问题的小项目,请通过电子邮件发送给我,我会查看

注意:您在上面的代码片段中使用了“Constrants”一词,不确定这是您的真实代码还是一个无害的打字错误