首页 > 解决方案 > 如何在 pom 文件下编写多个类

问题描述

在此处输入图像描述我想在这个 pom 文件中添加多个类,但是我应该使用哪个标签以及在哪里,请有人澄清一下。2

标签: appiumpom.xmlappium-desktop

解决方案


有两种方法可以Testng使用执行测试用例Maven

直接运行 Testng 测试用例 Pom.xml 没有任何 Testng.xml (不推荐的方式,因为你不能利用 Textng.xml 的许多设施,特别是控制序列等)

创建 testng 测试用例后,在with as中添加testng依赖项pom.xmlscopetest

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.8.8</version>
    <scope>test</scope>
</dependency>

是简单的示例或分步指南(直到第 5 步)

为 Pom.xml 调用 Testng.xml(推荐方式)

使用创建Testng测试用例后,Testng.xml我们可以调用testng.xmlusingmaven surefire plugin如下所述

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <suiteXmlFiles>
                        <!-- TestNG suite XML files -->
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>

是执行此操作的分步指南。


推荐阅读