maven - 从相同的 POM.xml Maven 运行现有的 TestNG 测试和新添加的空手道 API 测试
问题描述
在我的项目中,我们有使用传统 testng.xml 文件从 pom.xml 运行的 TestNg 测试(使用 selenium)的 repo。
现在我添加了空手道 API 测试。我能够使用mvn test "-Dkarate.options=--tags @api-test"
但不是 Testng 测试来运行空手道测试。有人可以帮助正确配置它吗?
我的 POM.xml 文件如下
<build>
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>${selenium-server.version}</version>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
解决方案
推荐阅读
- mercurial - 在所有克隆之间共享 .hg/hgrc 设置
- javascript - Inline function in React isn't running
- react-select - How do you get rid of this className react-select warning?
- node.js - Electron, Closing "sub-window" from main window
- python - python 3.6 //更新pyodbc
- reactjs - 反应传单库的自定义弹出窗口
- excel - Excel获取corespods为null的值
- ibm-watson - 如何让 Watson Assistant 捕获上下文变量中的多个实体
- r - 翻转矩阵列
- ios - 使用 Swift、AlamoFire 和 SwiftyJSON 解析 JSON 数据