簡體   English   中英

詹金斯(Jenkins)不運行我的Selenium測試(“無測試可運行”)

[英]Jenkins doesn't run my Selenium tests ('No tests to run')

我有一個普通的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批注:已選中

我的POM:

<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目標: clean integration-test

我想念什么?

謝謝。

我終於找到了答案。 問題是我的項目目錄配置。

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

我在另一個我從未見過的SO問題中找到了答案。 https://stackoverflow.com/a/36172200/7093031

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM