【问题标题】:Error appears before running the Webdriver test on a Hudson slave在 Hudson 从站上运行 Webdriver 测试之前出现错误
【发布时间】:2012-04-19 16:36:28
【问题描述】:

我们正在尝试将我们的系统从 Selenium 1 迁移到 WebDriver。 通过 Hudson slave 出现错误消息,但在 eclipse 中测试运行良好。

环境:

  • Hudson 大师:Linux 机器
  • Hudson 从站:Windows 7、x86

Java 版本:1.7.0_03

系统: 为该任务设置了一个新的 Hudson 作业,其配置与 Selenium 1 测试套件的配置相同。该作业执行 build.xml 文件中的目标。 clean、makedir 和编译目标已成功运行。 在执行测试时,Hudson 控制台上出现以下错误消息:

run_shopping_travel_tests:
    [junit] Running com.example.tests.ExampleTests
    [junit] Tests run: 1, Failures: 0, Errors: 2, Time elapsed: 2.385 sec
    [junit] Test com.example.tests.ExampleTests FAILED
    [junit] Running com.example.tests.Example2Test
    [junit] Tests run: 1, Failures: 0, Errors: 2, Time elapsed: 0.752 sec
    [junit] Test com.example.tests.Example2Test FAILED
     [echo] selenium directory: C:\Selenium

错误:

错误信息

LINUX
Stacktrace

java.lang.NoSuchFieldError: LINUX
    at org.openqa.selenium.firefox.FirefoxBinary.isOnLinux(FirefoxBinary.java:62)
    at org.openqa.selenium.firefox.FirefoxBinary.startProfile(FirefoxBinary.java:72)
    at org.openqa.selenium.firefox.FirefoxBinary.clean(FirefoxBinary.java:273)
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:78)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:85)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:121)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:77)
    at com.example.tests.ExampleTests.setup(ExampleTests.java:43)

测试的java代码:

public class ExampleTests
{
    FirefoxDriver driver = null;

    @Before
    public void setup() {
         File profileDir = new File( "C:\\Selenium\\FirefoxProfile" );
         FirefoxProfile profile = new FirefoxProfile(profileDir);

         driver = new FirefoxDriver(profile); // line 43, where error appears
    }
    @Test
    public void T100_VerifyExampleTest() {
   // some test code here
    }
}

我们尝试在没有“配置文件”的情况下运行测试并出现相同的错误消息。

提前致谢。

【问题讨论】:

    标签: java junit hudson webdriver


    【解决方案1】:

    问题解决了。 包含一些 jar 库,用于 -javac(在 ant 脚本中)编译,但不是 eclipse。

    解决方案: 对jar文件一一检查,把不需要的从lib文件夹中删除。

    【讨论】:

      猜你喜欢
      • 2010-11-30
      • 1970-01-01
      • 2012-05-19
      • 2013-06-26
      • 2016-07-01
      • 1970-01-01
      • 2012-09-03
      • 1970-01-01
      • 2011-06-05
      相关资源
      最近更新 更多