Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firefox Maven测试,Jenkins测试套件失败java.lang.NoClassDefFoundError-_Firefox_Jenkins_Selenium Webdriver_Maven 2 - Fatal编程技术网

Firefox Maven测试,Jenkins测试套件失败java.lang.NoClassDefFoundError-

Firefox Maven测试,Jenkins测试套件失败java.lang.NoClassDefFoundError-,firefox,jenkins,selenium-webdriver,maven-2,Firefox,Jenkins,Selenium Webdriver,Maven 2,我试图通过Maven运行我的测试,但是在构建过程中我遇到了一个错误。在过去的两天里,我一直试图解决这个问题,但现在已经没有办法了。我已经确保我的POM具有正确的依赖项,并且测试在Jenkins之外工作 操作系统-Windows Server 2012 R2 浏览器-firefox 50.1.0 Selenium驱动程序-3.0.1 詹金斯错误日志 ------------------------------------------------------- T E S T S --------

我试图通过Maven运行我的测试,但是在构建过程中我遇到了一个错误。在过去的两天里,我一直试图解决这个问题,但现在已经没有办法了。我已经确保我的POM具有正确的依赖项,并且测试在Jenkins之外工作

操作系统-Windows Server 2012 R2 浏览器-firefox 50.1.0 Selenium驱动程序-3.0.1

詹金斯错误日志

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Running TestSuite
[AppClassLoader@18b4aac2] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified

09:48:46.025 [main] INFO  - START com.Ceridian.tests.HB01.CD01
09:48:46.119 [main] WARN  - SKIP  com.Ceridian.tests.HB01.CD01
09:48:46.119 [main] ERROR - Unable to take screenshot - java.lang.NullPointerException
09:48:46.135 [main] INFO  - START com.Ceridian.tests.HB01.CD02
09:48:46.150 [main] WARN  - SKIP  com.Ceridian.tests.HB01.CD02
09:48:46.150 [main] ERROR - Unable to take screenshot - java.lang.NullPointerException
Tests run: 4, Failures: 2, Errors: 0, Skipped: 2, Time elapsed: 2.688 sec <<< FAILURE! - in TestSuite
configureBrowserBeforeTest(com.Ceridian.tests.HB01)  Time elapsed: 2 sec  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.SessionNotFoundException

configureBrowserBeforeTest(com.Ceridian.tests.HB01)  Time elapsed: 0.093 sec  <<< FAILURE!
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.SessionNotFoundException

Results :

Failed tests: 
com.Ceridian.tests.HB01.configureBrowserBeforeTest(com.Ceridian.tests.HB01)
  Run 1: HB01>BaseTest.configureBrowserBeforeTest:102 » NoClassDefFound org/openqa/sele...
  Run 2: HB01>BaseTest.configureBrowserBeforeTest:102 » NoClassDefFound org/openqa/sele...
POM文件

<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>com.frameworkium</groupId>
    <artifactId>Frameworkium</artifactId>
    <packaging>jar</packaging>
    <version>2.0.5</version>

    <name>Frameworkium</name>
    <description>
        A template designed to get up and running quickly with Selenium and Appium.
    </description>
    <url/>
    <inceptionYear/>
    <organization/>
    <licenses/>

    <developers/>
    <contributors/>

    <prerequisites>
        <maven>3.1.1</maven>
    </prerequisites>

    <modules/>

    <scm/>
    <issueManagement/>
    <ciManagement/>
    <distributionManagement/>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <env.config>local</env.config>
        <threads>1</threads>
        <groups/>
        <aspectj.version>1.8.9</aspectj.version>
    </properties>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.9.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.11</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.14</version>
        </dependency>
        <dependency>
            <groupId>com.github.Frameworkium</groupId>
            <artifactId>frameworkium-core</artifactId>
            <version>2.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>3.0.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.1</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.0.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
        <testSourceDirectory>src/test/java</testSourceDirectory>
        <resources>
            <resource>
                <directory>
                    src/main/resources
                </directory>
            </resource>
        </resources>
    </build>


    <profiles>
        <profile>
            <id>tests</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>

                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.5.1</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.19.1</version>
                        <configuration>
                            <parallel>methods</parallel>
                            <threadCount>${threads}</threadCount>
                            <systemProperties>
                                <screenshotDirectory>
                                    ${project.build.directory}/screenshots
                                </screenshotDirectory>
                                <allure.issues.tracker.pattern>
                                    /browse/%s
                                </allure.issues.tracker.pattern>
                            </systemProperties>
                            <suiteXmlFiles>
                                <suiteXmlFile>testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                            <includes>
                                <include>**/Test*.java</include>
                                <include>**/*Tests*.java</include>
                                <include>**/*Tests.java</include>
                                <include>**/*Test.java</include>
                                <include>**/*TestCase.java</include>
                            </includes>
                            <groups>${groups}</groups>
                            <testFailureIgnore>false</testFailureIgnore>
                            <argLine>
                                -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                            </argLine>
                        </configuration>
                    </plugin>
                </plugins>

            </build>
        </profile>
    </profiles>
</project>
我已经包括了构建的配置屏幕。

如果我遗漏了什么,我会道歉

添加依赖项

更新

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.0.1</version>
    </dependency>

org.seleniumhq.selenium
硒爪哇
3.0.1

因此它也在3.0.1上,错误消失了。感谢@duffymo的帮助。

看起来org.openqa中缺少一个工件。检查Maven依赖关系树,确保它是由一个依赖关系带来的。我会将所有这些Selenium依赖项标记为测试范围。另外,请检查包裹,确保它们存在。谢谢您的回复。很抱歉问一些基本问题,我对设置CI环境还不熟悉。Maven依赖树是Maven插件吗?你怎么通过詹金斯查到的?如果我的POM在Jenkins之外拉动依赖项OK,为什么Jenkins可能会丢失它?如果你提到检查包裹以确保他们在场,你能详细说明检查地点吗?我想你是说在我的C:?感谢你的帮助:)詹金斯之外的事情不要检查。看这个包裹。我使用IntelliJ检查依赖关系tree@duffymo啊,好的,我已经在原始问题中加入了。@duffymo谢谢你的帮助,我不得不使用其中一个存储库的更新版本,它似乎可以工作。感谢:)
@BeforeMethod(
    alwaysRun = true
)
public static void configureBrowserBeforeTest(Method testMethod) {
    try {
        ((Driver)driver.get()).resetBrowser();
        wait.set(newDefaultWait());
        userAgent = determineUserAgent();
        initialiseNewScreenshotCapture(testMethod);
    } catch (Exception var2) {
        logger.error("Failed to configure browser.", var2);
        throw new RuntimeException("Failed to configure browser.", var2);
    }
}
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.0.1</version>
    </dependency>