我有一些Selenium Webdriver测试,希望使用mvn-test从命令行运行。问题是,我可以清理,构建和编译没有问题,但没有测试运行。我没有收到任何与测试有关消息,如“There are no tests to run”。
我的junit测试遵循*Test类命名约定。
<?xml version="1.0" encoding="UTF-8"?>
<groupId>websiteRegression</groupId>
<artifactId>websiteRegression</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>websiteRegression</name>
<url></url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Full access to hamcrest matchers
see https://github.com/hamcrest/JavaHamcrest
you can add hamcrest-core for the foundation matchers
and you can add hamcrest-library for more extensive libraries
or you can add hamcrest-all for everything if you don't want to think about it
-->
<!-- Junit 4.11 needs hamcrest 1.3 -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<!-- if we use junit-dep then we can bring in the full hamcrest -->
<!-- JUnit 4.10 depends on hamcrest 1.1 -->
<!--
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
</dependency>
-->
<!-- Use JUnit as our test framework -->
<!-- this gives us basic hamcrest -->
<!-- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency> -->
<!-- if I want to use a version of hamcrest above 1.1 with 4.10 then I need an exclusion -->
<!--
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<!-- bring in the full selenium deploy
we could be more selective and bring
only what we need -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.39.0</version>
</dependency>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<!-- I have added the build section to support importing into
IntelliJ automatically without throwing errors about wrong Java
Version. This basically says the source requires at least Java 1.7
and use a compiler that outputs Java 1.7 -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>anyBrowserTests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>firefoxTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
<include>**/FireFoxOnlySuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ieTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>chromeTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>operaTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>failingOperaTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>failingIETests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>failingChromeTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.16</version>
</plugin>
</plugins>
</reporting>
编辑:好的,我发现这是一个配置文件的问题-修复!
编辑:好的,我发现这是一个配置文件的问题-修复!
我正在尝试使用IntelliJ Community edition和Gradle5.5.1运行一个Cucumber/Selenium项目。 我的TestRunner类如下:
我在IntelliJ中打开了一个新的Java项目,用Maven作为构建工具,目前有一个类和一个JUnit5测试类。当我指示IntelliJ单独或一起运行测试时,它就可以工作了。但是当我转到终端并点击或从IntelliJ内的Maven窗格中执行相同操作时,它会跳过测试。 然而,与这个类似问题的提问者不同,我没有得到任何错误信息。测试类被找到并编译。我没有同样的问题(不正确的文件命名),他有。 它们是
当我执行“MVN测试”时,我可以在日志中看到,在maven spring boot插件实例化spring boot实例之前,Cucumber runner被实例化: 我知道我的Cucumber测试实际上是一个集成测试,所以我将其作为“MVN验证”生命周期阶段的一部分运行,方法是将其重命名为CucumberRunnerIT.java,并按如下所示配置pom.xml: 但是,当我作为“验证”的一部分运
我有一个Spring Boot2项目,这是一个ReST API,我正在使用Spring ReST。 我正在使用2个插件来生成一个SDK其他项目导入调用我的API。第一个插件是以生成swagger-codegen-spec文件,第二个插件是,以生成实际的SDK文件作为另一个mvn项目。 最后,我实现了组件测试自动化,这些组件测试使用SDK对正在运行的API运行测试。 我的目标是实际构建SDK作为原始
问题内容: 我刚刚在Eclipse上第一次安装了插件m2e。 我编写了一个简单的JUnit(版本4)测试。我可以从Eclipse中运行它,但不能从pom.xml中运行它(alt单击,运行方式,Maven测试)。我想我需要告诉Maven搜索该课程,但我只是不知道如何。 另外,我在groupId“ junit”中找不到JUnit 4:只有版本3.8.1可用。我真的需要为3.x版本而不是4+版本编写测试
使用maven对Spring应用程序进行单元测试后,在完成构建时遇到问题。我注意到mvn安装没有完成,在运行了所有单元测试之后,它似乎挂起了。如果运行我将从cmd行获得要完成的测试,但构建挂起 这就是它的结尾。两个线程正在运行,不确定我在那里做了什么。无论如何,为了排除故障,我删除了所有测试并让程序完全构建。如果我运行,我就可以完成它。最后,我添加了一个JUnit测试,它本质上是一个system.