【发布时间】:2016-10-06 05:53:37
【问题描述】:
我使用 TestNG 框架创建了基于 maven 的 Selenium 项目。 当我从命令提示符运行命令:-“mvn clean install”时,我的脚本运行良好,但没有创建“test-output”文件夹,如果我通过 Eclipse 运行我的脚本,右键单击 testng.xml 文件——运行和TestNGsuite 然后创建包含报告的测试输出文件夹。
我为surefire报告添加了插件,同样工作正常,但同时我也想要“test-output”文件夹,同时从命令提示符运行“mvn clean install”命令。请推荐!!
因为我想在 jenkins 中进行相同的配置(使用 mvn clean install 命令)并且想将 emailablerepots.html 发送给我的前辈。
下面是我的 pom.xml:-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mavenTestProject</groupId>
<artifactId>MAVENprojectEmail</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<!-- Source directory configuration -->
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- Following plugin executes the testng tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<!-- Compiler plugin configures the java version to be usedfor compiling
the code -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Selenium Java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
</dependencies>
</project>
【问题讨论】:
-
我的情况也是如此。我正在通过 [link]automationtesting.in/… 生成 Excel 报告,但问题是它需要来自 test-output 文件夹的 test-results.xml。当我使用 mvn test 命令时不会生成。
标签: maven jenkins selenium-webdriver maven-plugin testng-eclipse