0

システムをSelenium1からWebDriverに移行しようとしています。Hudsonスレーブ全体でエラーメッセージが表示されましたが、Eclipseでテストは正常に実行されました。

環境:

  • ハドソンマスター:Linuxマシン
  • ハドソンスレーブ:Windows 7、x86

Javaバージョン:1.7.0_03

システム: Selenium 1テストスイートの場合と同じ構成で、タスク用に新しいHudsonジョブが設定されました。ジョブは、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
    }
}

「プロファイル」なしでテストを実行しようとしましたが、同じエラーメッセージが表示されました。

前もって感謝します。

4

1 に答える 1

0

問題が解決しました。-javac(antスクリプト内)でコンパイルするために使用されたjarライブラリがいくつか含まれていましたが、eclipseでは使用されませんでした。

解決策:jarファイルを1つずつ確認し、不要なファイルをlibフォルダーから削除します。

于 2012-05-07T09:10:02.497 に答える