這是我的代碼:Maven的測試失敗,但在詹金斯同樣的測試succeded
package example;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
public class NewTest {
private WebDriver driver;
@Test
public void f() {
driver.get("http://demo.guru99.com/selenium/guru99home/");
String title = driver.getTitle();
AssertJUnit.assertTrue(title.contains("Demo Guru99 Pageee"));
System.out.println("Success");
}
@BeforeTest
public void beforeTest() {
String exePath = "/Users/enislavmollov/Downloads/chromedriver";
System.setProperty("webdriver.chrome.driver", exePath);
driver = new ChromeDriver();
}
@AfterTest
public void afterTest() {
driver.quit();
}
}
怎麼可能,以及如何使詹金斯給予正確的結果作爲一個在Eclipse
而實際的測試是? –
請看我上面的代碼,我剛添加它。 – EnislavMollov
我建議多看看'driver.get()'返回的內容。 –