English 中文(简体)
利用Jenkins在java书写的pack试验
原标题:Trying to run a pack of selenium tests written in java using Jenkins

在阅读了它在“具有类似头衔的问题”下建议的所有职位(我将在派出这一职位后继续阅读)和阅读

  • centripetal.ca/blog/2011/02/07/getting-started-with-selenium-and-jenkins/
  • oliverpolden.com/content/setting-automated-selenium-testing-jenkinshudson

以及其他一些员额(我注意到这两个员额,因为我认为这些员额可能对某人有用) 我没有找到我所需要的答案。 我现在谈谈:

I m在一家公司工作,该公司使用Jenkins for CI和maven。 他们有三类电.检测:黄麻、陶瓷和 se。 原告可以进行陪审员测试。 现在他们决定使用Jenkins进行其他两种类型的测试(Cactus和Selenium)。 这也是我的任务。 事实将是我后来问的另一个问题(现在我一直禁止我与他站在一起太久)。 Sel测试在java书写,并且有一只java文档,所有测试如下:

package com.mycompany.test.dailySanity;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses({
        Test1.class,
        Test2.class,
        Test3.class,
})

public class AllTests {
        /**
         * This is just a place holder.
         * Add All your TestClass one to the list above.
         * NOTE, the TestClasses should be "," separated
         */
}

我收集的所有信息都发现了关于“html”诉讼的谈话,但没有发现关于这些试验是否在 j(没有,将其出口到超文本不是选择)。 我受审

export DISPLAY=":99" && java -jar /path/to/selenium-server.jar -browserSessionReuse -htmlSuite *firefox http://localhost /path/to/my/testsfile/AllTests.java /path/to/my/logfile/SeleniumLog.html

as an "Execute Shell" in "Build" step in Jenkins job, but it just stays trying something. Console output

09:29:48.508 INFO - Java: Sun Microsystems Inc. 14.2-b01
09:29:48.518 INFO - OS: Linux 2.6.18.8-xenU amd64
09:29:48.654 INFO - v2.4.0, with Core v2.4.0. Built from revision 13337
09:29:49.263 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
09:29:49.264 INFO - Version Jetty/5.1.x
09:29:49.269 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
09:29:49.271 INFO - Started HttpContext[/selenium-server,/selenium-server]
09:29:49.271 INFO - Started HttpContext[/,/]
09:29:49.337 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@7a187814
09:29:49.337 INFO - Started HttpContext[/wd,/wd]
09:29:49.343 INFO - Started SocketListener on 0.0.0.0:4444
09:29:49.343 INFO - Started org.openqa.jetty.jetty.Server@67ad77a7
10:51:00.038 INFO - Shutting down...
10:51:00.040 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]

我假定,它没有任何其他东西(在铺设之前等待了2小时)用它作为 j,它需要一份html的档案(-htmlappe是一个cl)。

总而言之:我需要一种途径,在 Java进行Selenium测试,并在对Jenkins提起的java诉讼中进行包装。


EDITING Ok, I m not getting anywhere and running out of time. I m adding more information just in case someone can give me a hand (not that I m not thankful to Ross). Here goes my selenium_pom.xml:

<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>my.company</groupId>
    <artifactId>selenium-test</artifactId>
    <version>0.1-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium.client-drivers</groupId>
            <artifactId>selenium-java-client-driver</artifactId>
            <version>1.0.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>selenium-maven-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start-server</goal>
                        </goals>
                        <configuration>
                            <background>true</background>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Skip the normal tests, we ll run them in the integration-test phase -->
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <includes>
                                <include>/path/to/my/tests/AllTests.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

一. 导言

mvn -f selenium_pom.xml integration-test

我获得以下产出:

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.kana.sem:selenium-test:jar:0.1-SNAPSHOT
[WARNING]  build.plugins.plugin.version  for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 44, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building selenium-test 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ selenium-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /path/to/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ selenium-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ selenium-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /path/to/resources/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ selenium-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ selenium-test ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ selenium-test ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO]
[INFO] --- selenium-maven-plugin:2.1:start-server (default) @ selenium-test ---
Launching Selenium Server
Waiting for Selenium Server...
[WARNING] OS appears to be Unix and no DISPLAY environment variable has been detected. Browser maybe unable to function correctly. Consider using the selenium:xvfb goal to enable headless operation.
[INFO] User extensions: /localhome/kana/p4/dev/BOT/target/selenium/user-extensions.js
08:05:07,166 INFO  [org.openqa.selenium.server.SeleniumServer] Java: IBM Corporation 2.3
08:05:07,173 INFO  [org.openqa.selenium.server.SeleniumServer] OS: Linux 2.6.18.8-xenU x86
08:05:07,184 INFO  [org.openqa.selenium.server.SeleniumServer] v2.9.0, with Core v2.9.0. Built from revision 14289
08:05:07,273 INFO  [org.openqa.selenium.server.SeleniumServer] RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
08:05:07,277 INFO  [org.openqa.jetty.http.HttpServer] Version Jetty/5.1.x
08:05:07,686 INFO  [org.openqa.jetty.util.Container] Started org.openqa.jetty.jetty.servlet.ServletHandler@51fe51fe
08:05:07,687 INFO  [org.openqa.jetty.util.Container] Started HttpContext[/wd,/wd]
08:05:07,687 INFO  [org.openqa.jetty.util.Container] Started HttpContext[/,/]
08:05:07,688 INFO  [org.openqa.jetty.util.Container] Started HttpContext[/selenium-server,/selenium-server]
08:05:07,689 INFO  [org.openqa.jetty.util.Container] Started HttpContext[/selenium-server/driver,/selenium-server/driver]
08:05:07,705 INFO  [org.openqa.jetty.http.SocketListener] Started SocketListener on 0.0.0.0:4444
08:05:07,705 INFO  [org.openqa.jetty.util.Container] Started org.openqa.jetty.jetty.Server@40e640e6
08:05:07.916 INFO - Checking Resource aliases
Selenium Server started
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default) @ selenium-test ---
[INFO] No tests to run.
[INFO] Surefire report directory: /path/to/surefire-reports/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.387s
[INFO] Finished at: Fri Jan 13 08:05:08 CST 2012
[INFO] Final Memory: 12M/30M
[INFO] ------------------------------------------------------------------------

I m Use perforce, Jenkins, maven3 and Red Hat Enterprises Franklin release 5.5 (Tikanga). 我确信我的om是问题之一,但从互联网样本中去。


感谢(并祝贺所有完成这一职务的人!)

PS: If you also know how to get a report from the Selenium tests that would be great.

问题回答

-htmlappe” 备选办法与你试图做的工作完全不同。 Don:

你的《 Java法》似乎已经写成,因此测试是通过Junnit进行的。 这是一种非常常见的做法。 我预计,你们需要做的是,确保塞伦ium驻地协调员服务器在试验开始之前运行。 Just java -jar /path/to/selenium-server.jar, 并离开该编码至至少最后一次测试结束。 您的测试将通过建立与服务器的联系与服务器联系,或许可以通过打电话new DefaultSelenium(......)

Jenkins与Maven非常融合,因此我建议你集中精力使用Maven而不是Jenkins进行测试。 你们可以利用失败的金gin进行一体化测试,如 se测试。 申述人将自动找到失败的报告,并填写一份超文本摘要。 而且,你可以更方便地用你的当地机器来测试。

请您更新职位,以澄清您是否重新使用第1期或第2期。 参看第2条,但贵系统显示<代码>selenium-java-client-driver。





相关问题
Javascript communication with Selenium (RC)

My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to ...

Running automated Web browser tests under Hudson

I m running Hudson for my automated builds and love it. I d now like to create automated Web browser tests using either WaTiN (preferred) or Selenium. As my Hudson runs as a Windows service (under ...

Using a Java library with Scala reserved words

I m using an external library written in Java (Selenium). One of the function calls has the signature type(String, String), and I keep getting compiler errors when trying to call it from Scala, that ...

Heightened privilege selenium browsers on Windows 7 (x64)

I make use of *firefox and *iexplore etc. within my selenium tests to get around the issue of self-signed SSL certificates on my local machine. Unfortunately, now that I ve moved from XP over to 7, ...

Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Selenium IDE: Incrementing values by 1 and 71

Currently I m incrementing a value called wert by 1 with the following code: getEval storedVars[ wert ]=${wert}+1; The value wert is something like 80401299. I want to add 1 to the value, if it ...

热门标签