0
我想从父pom运行TestNG硒测试。当我运行命令mvn install
显示BUILD SUCCESSFUL消息时,但测试不运行。从父pom运行testng测试
以下是我的文件夹结构:
Parent
|----Child1
| |---src
| |---pom.xml
|----Child2
| |---src
| |---pom.xml
| |---myTests.xml
|-pom.xml
当命令mvn install
从CHILD2文件夹运行没有任何变化,然后测试运行。
家长pom.xml
文件看起来像:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.parent</groupId>
<artifactId>parent</artifactId>
<version>1</version>
<packaging>pom</packaging>
<profiles>
<profile>
<modules>
<module>Child1</module>
<module>Child2</module>
</modules>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<skipTests>false</skipTests>
<suiteXmlFiles>
<suiteXmlFile>myTests.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
Child1 - pom.xml
CHILD2 - pom.xml
。该项目依赖于Child1
<parent>
<groupId>com.example.parent</groupId>
<artifactId>parent</artifactId>
<version>1</version>
</parent>
<groupId>com.example.parent</groupId>
<artifactId>Child2</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>com.example.parent</groupId>
<artifactId>Child1</artifactId>
<version>1</version>
</dependency>
</dependencies>
我用代码块替换了内联代码标记('\'')。在SO上格式化代码块的最简单方法是粘贴代码,然后选择它并按Ctrl + K或单击“{}”按钮。这会将整个块缩进另外四个空格,指示堆栈溢出将其格式化为代码。 – Chris
@mackowski:我试着给你提到的相对路径以及'Child2/myTests.xml',但没有引发错误。我假设如果maven找不到指定的路径,那么它会抛出错误。 – Shamanth