詹金斯不运行我的Selenium测试("没有测试要运行")



我有一个普通的Selenium项目,我想用Jenkins运行它。我一直在阅读很多SO帖子,并在我的项目中进行了一些更正,以使我的测试可见。无论如何,当我尝试在 Jenkins 中运行测试时,我最终会得到一条'No tests to run'消息。这是令人困惑的。

让我展示我的东西。

我的测试方法之一:

package tests;
import junitparams.JUnitParamsRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import junitparams.FileParameters;
import pages.AnyPage;
import utils.AbstractTest;
@RunWith(JUnitParamsRunner.class)
public class DisponibiliteSitesWebTest extends AbstractTest {
@Test
@FileParameters("src\selenium\resources\check_websites.csv")
public void test_AffichageTexte(String url, String texteATrouver) {
accesURL(url);
AnyPage page = new AnyPage(this);
page.assertTextDisplayed(texteATrouver);
}
}
  • "测试"包存在:已选中
  • 测试命名约定:选中
  • @Test注释:选中

我的聚甲醛:

<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hightest.nc</groupId>
<artifactId>poc</artifactId>
<!--<packaging>pom</packaging>-->
<packaging>jar</packaging>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>${skip.selenium.tests}</skip>
<parallel>none</parallel>
<threadCount>1</threadCount>
<reuseForks>false</reuseForks>
<disableXmlReport>true</disableXmlReport>
</configuration>
<executions>
<execution>
<id>runSeleniumTests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.7</version>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-core</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-spock</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
  • 包装=罐子:已检查
  • 提及的测试范围:已检查

我的 Jenkins 工作调用了 Maven Goals:clean integration-test

我错过了什么?

谢谢。

我最终找到了答案。问题是我的项目目录配置。

它是src/selenium/java/**而不是src/test/java。

我在另一个我以前从未见过的SO问题中找到了答案。 https://stackoverflow.com/a/36172200/7093031

最新更新