【发布时间】:2020-05-12 13:27:17
【问题描述】:
我是 MAVEN 和 Junit 的新手。我正在尝试在命令行中运行一个包含 junit 测试和黄瓜功能文件的 maven 项目。 它显示“构建成功”,但也显示“无需编译”。它是一个使用 Selenium 和黄瓜功能文件的网络自动化代码。有人可以帮我在 windows 的命令行中运行它。这是 POM 文件。(项目没有 Main 类。)
<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>BFL</groupId>
<artifactId>Web_Automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Web_Automation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.35.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<mainClass>test_runner.WEBRUNNER</mainClass>
<systemPropertyVariables>
<!-- <retryCount>${retryCount}</retryCount> -->
<!-- <accountBrowser>${myaccountBrowser}</accountBrowser>
<searchBrowser>${searchBrowser}</searchBrowser>
<pdpBrowser>${pdpBrowser}</pdpBrowser>
<browseBrowser>${browseBrowser}</browseBrowser>
<cartBrowser>${cartBrowser}</cartBrowser>
<globalNavBrowser>${globalNavBrowser}</globalNavBrowser>
<homeBrowser>${homeBrowser}</homeBrowser>-->
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
【问题讨论】:
-
到目前为止你有什么尝试?
-
在找到包含POM文件和其他代码包的项目目录后,我只是运行了“mvn test”命令。
-
在构建过程中你应该有一些 WARNING ....
-
@khmarbaise 感谢您的回复。是的..我收到警告“工件 org.apache.commons:common-io:jar :1.3.2 已重新定位到 common-io:commons-io :jar:13.2"
-
这意味着您使用了错误的依赖项。首先,这需要修复。除了使用 JUnit 3 ...我怀疑这是否正确....
标签: eclipse maven selenium junit