Maven testng.xml文件是否自动更新

Maven testng.xml文件是否自动更新,maven,testng,Maven,Testng,使用mvn运行testng时,我根据需要配置了我的工作区: 我的pom.xml文件配置了所有必需的依赖项,testng.xml包含所有必需的类 但是,当我添加一个新的测试类时,testng.xml不会自动更新- 它不应该从根目录扫描相应的测试吗?或者我必须手动更新testng.xml文件吗? (顺便说一句,我的工作区是根据以下帖子配置的:)xml方法为您提供了对测试集更精确的控制。它不会自动更改,但如果您选择(比如)文件夹并右键单击RunasTestNG,eclipse将动态生成xml配置。如果

使用mvn运行testng时,我根据需要配置了我的工作区: 我的pom.xml文件配置了所有必需的依赖项,testng.xml包含所有必需的类

但是,当我添加一个新的测试类时,testng.xml不会自动更新- 它不应该从根目录扫描相应的测试吗?或者我必须手动更新testng.xml文件吗?
(顺便说一句,我的工作区是根据以下帖子配置的:)

xml方法为您提供了对测试集更精确的控制。它不会自动更改,但如果您选择(比如)文件夹并右键单击RunasTestNG,eclipse将动态生成xml配置。如果您只想运行所有带testng注释的测试,并且已经使用surefire或failsafe正确配置了maven,那么您甚至不需要xml文件。只需运行“mvn验证”,所有测试都应基于注释运行。如果这不起作用,请张贴您的surefire/failsafe pom部分

如果要在maven中配置特定的xml,请使用类似(surefire或failsafe work same。):


org.apache.maven.plugins
maven故障保护插件
${failsafe.version}
-Xmx1024m
集成测试
集成测试
集成测试
testng.xml
如果您确实需要更细粒度的控制,并且希望使用maven指定的xml文件,那么可以通过“verify-pMyProfile”启动它


我的个人资料
maven故障保护插件
MyProfile.xml
肌瘤轮廓
maven故障保护插件
MyOtherProfile.xml
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${failsafe.version}</version>
                <configuration>
                    <argLine>-Xmx1024m</argLine>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>testng.xml</suiteXmlFile>
                                <!-- <groups>functest,perftest</groups> -->
                            </suiteXmlFiles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
<profiles>
        <profile>
            <id>MyProfile</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>MyProfile.xml</suiteXmlFile>
                                <!-- <groups>functest,perftest</groups> -->
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>MyOtherProfile</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>MyOtherProfile.xml</suiteXmlFile>
                                <!-- <groups>functest,perftest</groups> -->
                            </suiteXmlFiles>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
<profiles>