1

我正在尝试通过 Jenkins 从远程机器运行 selenium 测试(Jenkins 以 root 身份运行)。我可以通过终端通过 SSH 完美地运行测试,但是当我尝试从 Jenkins 运行测试时,我收到下面提到的错误:

Started by user anonymous
Building in workspace [workspace path]
SSH: Connecting from host [host-name]
SSH: Connecting with configuration [ruser name] ...
SSH: EXEC: STDOUT/STDERR from command [command to run] ...
Test Location:          [location]
Test started at:             2013-01-21T16:36:44
Test in Progress...
...starting events generation
SalesforceHome.java:3: error: package com.thoughtworks.selenium does not exist
import com.thoughtworks.selenium.*;
^
SalesforceHome.java:4: error: package org.junit does not exist
import org.junit.After;
                ^
SalesforceHome.java:5: error: package org.junit does not exist
import org.junit.Before;
                ^
SalesforceHome.java:6: error: package org.junit does not exist
import org.junit.Test;
                ^
SalesforceHome.java:7: error: package org.openqa.selenium does not exist
import org.openqa.selenium.WebDriver;
                          ^
SalesforceHome.java:8: error: package org.openqa.selenium does not exist
import org.openqa.selenium.WebDriverBackedSelenium;
                          ^
SalesforceHome.java:9: error: package org.openqa.selenium.chrome does not exist
import org.openqa.selenium.chrome.ChromeDriver;
                                 ^
SalesforceHome.java:10: error: package org.openqa.selenium.firefox does not exist
import org.openqa.selenium.firefox.FirefoxDriver;
                                  ^
SalesforceHome.java:11: error: package org.openqa.selenium.firefox does not exist
import org.openqa.selenium.firefox.FirefoxProfile;
                                  ^
SalesforceHome.java:12: error: package org.openqa.selenium.remote does not exist
import org.openqa.selenium.remote.DesiredCapabilities;
                                 ^
SalesforceHome.java:13: error: package org.openqa.selenium.remote does not exist
import org.openqa.selenium.remote.RemoteWebDriver;
                                 ^
SalesforceHome.java:20: error: package org.apache.log4j does not exist
import org.apache.log4j.Logger;
                       ^
SalesforceHome.java:21: error: package org.apache.log4j.xml does not exist
import org.apache.log4j.xml.DOMConfigurator;
                           ^
SalesforceHome.java:22: error: package org.apache.log4j does not exist
import org.apache.log4j.*;
^
SalesforceHome.java:23: error: package org.apache.log4j does not exist
import org.apache.log4j.FileAppender;
                       ^
SalesforceHome.java:24: error: package org.apache.log4j does not exist
import org.apache.log4j.RollingFileAppender;
                       ^
SalesforceHome.java:26: error: cannot find symbol
public class SalesforceHome extends SeleneseTestBase{
                                    ^
  symbol: class SeleneseTestBase
SalesforceHome.java:27: error: cannot find symbol
Logger logger;
^
  symbol:   class Logger
  location: class SalesforceHome
SalesforceHome.java:28: error: cannot find symbol
    @Before
     ^
  symbol:   class Before
  location: class SalesforceHome
SalesforceHome.java:64: error: cannot find symbol
    @Test
     ^
  symbol:   class Test
  location: class SalesforceHome
SalesforceHome.java:87: error: cannot find symbol
    @After
     ^
  symbol:   class After
  location: class SalesforceHome
SalesforceHome.java:31: error: cannot find symbol
         logger = Logger.getLogger(this.getClass().getName());
                                       ^
  symbol: method getClass()
SalesforceHome.java:31: error: cannot find symbol
         logger = Logger.getLogger(this.getClass().getName());
                  ^
  symbol:   variable Logger
  location: class SalesforceHome
SalesforceHome.java:32: error: cannot find symbol
        DOMConfigurator.configure("log4j.xml");
        ^
  symbol:   variable DOMConfigurator
  location: class SalesforceHome
SalesforceHome.java:51: error: cannot find symbol
          WebDriver driver = conf.setConf(BName);
          ^
  symbol:   class WebDriver
  location: class SalesforceHome
SalesforceHome.java:51: error: cannot access WebDriver
          WebDriver driver = conf.setConf(BName);
                                         ^
  class file for org.openqa.selenium.WebDriver not found
SalesforceHome.java:54: error: cannot find symbol
                  if (driver instanceof RemoteWebDriver) 
                                        ^
  symbol:   class RemoteWebDriver
  location: class SalesforceHome
SalesforceHome.java:56: error: cannot find symbol
                  ((RemoteWebDriver) driver).setLogLevel(Level.OFF);
                    ^
  symbol:   class RemoteWebDriver
  location: class SalesforceHome
SalesforceHome.java:61: error: cannot find symbol
          selenium = new WebDriverBackedSelenium(driver, baseUrl);
          ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:61: error: cannot find symbol
          selenium = new WebDriverBackedSelenium(driver, baseUrl);
                         ^
  symbol:   class WebDriverBackedSelenium
  location: class SalesforceHome
SalesforceHome.java:67: error: cannot find symbol
selenium.setTimeout("1000000");
^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:68: error: cannot find symbol
                selenium.open("/");
                ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:71: error: cannot find symbol
        selenium.type("id=", "");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:72: error: cannot find symbol
        selenium.type("id=", "");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:73: error: cannot find symbol
        selenium.click("id=");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:75: error: cannot find symbol
        selenium.waitForPageToLoad("150000");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:76: error: cannot find symbol
        selenium.click("link=");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:78: error: cannot find symbol
        selenium.waitForPageToLoad("150000");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:79: error: cannot find symbol
        selenium.type("id=", "");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:80: error: cannot find symbol
        selenium.click("id=");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:82: error: cannot find symbol
        selenium.waitForPageToLoad("150000");
        ^
  symbol:   variable selenium
  location: class SalesforceHome
SalesforceHome.java:89: error: cannot find symbol
        selenium.stop();
        ^
  symbol:   variable selenium
  location: class SalesforceHome
42 errors
Error: Could not find or load main class org.junit.runner.JUnitCore
SSH: Disconnecting configuration [machine name] ...
ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 4,067 ms]
[workspace] $ /bin/sh -xe /tmp/hudson1293805758975477494.sh

请指导我做错了什么。由于我是所有这些方面的新手,请详细说明我必须进行哪些更改以及在哪里进行更改的解决方案。在此先感谢=)

4

0 回答 0