Я хочу разделить тестовый API на 2 группы и запустить любую группу в testng xml в соответствии с требованиями.
Но метод, упомянутый в теге include, всегда выполняется независимо от групп.Можно ли как-нибудь реализовать эту функцию в TestNg, поскольку я не могу избежать тега include.
Мой класс Test и соответствующий xml выглядят следующим образом:
package com.eci.raft.tests.shadetree;
import java.io.IOException;
import org.testng.annotations.Test;
public class TestClass {
@Test(groups= {"WithOuthardware","Withhardware"})
public void configureApi() {
System.out.println("Configure");
}
@Test(groups= {"Withhardware"})
public void validateApi() throws IOException {
System.out.println("Validate");
throw new IOException();
}
}
TestNg.xml
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SuiteTest">
<groups>
<run>
<include name="WithOuthardware"></include>
</run>
</groups>
<test name="Test1" >
<classes>
<class name="com.eci.raft.tests.shadetree.TestClass">
<methods>
<include name="validateApi"></include>
</methods>
</class>
</classes>
</test>
<test name="Test2">
<classes>
<class name="com.eci.raft.tests.shadetree.TestClass">
</class>
</classes>
</test>
</suite>
Здесь «validateApi» в «Test1» выполняется, даже если он не помечен именем группы «WithOuthardware».
Спасибо и всего наилучшего,
Венкатеш Ганесан