【发布时间】:2015-02-08 04:00:22
【问题描述】:
我是自动化测试和 Testng 框架的新手。我正在 java 和 windows 环境中开发我的测试用例。我想在 unix/linux 环境中运行这些开发的测试用例。谁能帮助我一步一步这个过程。非常感谢
@PeterLawrey 我有下面的 pom.xml,我正在尝试在 unix 上执行
{ <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>ProjTestAutomation</groupId>
<artifactId>ProjTestAutomation2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ProjTestAutomation</name>
<description>ProjTestAutomation</description>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<!-- Suite testng xml file to consider for test execution -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>ProjestAutomation</groupId>
<artifactId>ProjTestAutomation2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0.2</version>
</dependency>
</dependencies>
</project>
}
但我遇到了错误 [错误] 无法在项目 MDFsureManager 上执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test):执行目标 org.apache.maven.plugins:maven-surefire 的默认测试-plugin:2.17:test failed: 分叉进程出错 [错误] org.testng.TestNGException: [错误] 在类路径中找不到类:TestCustomerResource
【问题讨论】:
-
我会从你的构建系统运行测试。你有
maven或ant吗?在 Maven 中,您将运行mvn test -
-
是的,您按照 maven 的指南进行设置。然后运行它是微不足道的。
-
哦..好的,谢谢。我会经历的。如有任何澄清将与您联系。谢谢
-
@PeterLawrey 我有下面的 pom.xml 我正在尝试在 unix {} 上执行