我正在尝试使用Jenkins和Mac OS运行我的测试。我使用非常简单的代码,基本上是打开google.com。当我在eclipse中运行它时它很成功,这是我的代码:
package GitProject.gittest;
import org.testng.annotations.Test;
import org.testng.annotations.Test;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.AssertJUnit;
/**
* Unit test for simple App.
*/
public class AppTest
{
@Test
public void testApp()
{
String exePath = "/Users/enislavmollov/Downloads/chromedriver";
System.setProperty("webdriver.chrome.driver", exePath);
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");
System.out.println("Success");
driver.quit();
}
}
pom.xml位于Jenkins的工作空间中,否则会给我错误。当我从Jenkins运行它时,我的构建失败并且它给了我错误:
Failed
GitProject.gittest.AppTest.testApp
Error Message
The driver executable does not exist:
/Users/enislavmollov/Downloads/chromedriver
Stacktrace
java.lang.IllegalStateException: The driver executable does not exist: /Users/enislavmollov/Downloads/chromedriver