无法通过命令行从TestNG运行Maven项目。。。!
我已经使用maven和testNG配置了eclipse,PF my pom.xml如下:无法通过命令行从TestNG运行Maven项目。。。!,maven,testng,Maven,Testng,我已经使用maven和testNG配置了eclipse,PF my 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
<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>
<parent>
<artifactId>iONAutomation</artifactId>
<groupId>com.iON.tcs</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.iON.tcs</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>common</name>
<description>maintains all common code</description>
<profiles>
<profile>
<id>selenium-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
如果您定义了一个概要文件,那么afaik,您需要调用该概要文件…mvn测试-Pselenium测试。同样地,如果没有特别的理由让你使用配置文件,那么你可以不使用它们,在这种情况下,mvn测试应该可以正常工作。你试着把
<sourceDirectory>/home/{userName}/{projectLocation}/src/main/java/packageTest</sourceDirectory>
/home/{userName}/{projectLocation}/src/main/java/packageTest
在你的身体里?
我有同样的问题,这条线解决了它
您还可以尝试将目标添加到pom文件中
<execution>
<id>default-test</id>
<phase>test</phase>``
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
默认测试
试验``
测试
假的
希望它能帮助你 如果先运行:mvn clean install怎么办
<execution>
<id>default-test</id>
<phase>test</phase>``
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>