Eclipse中的Maven测试失败,但Jenkins中的相同测试成功

Eclipse中的Maven测试失败,但Jenkins中的相同测试成功,eclipse,maven,jenkins,Eclipse,Maven,Jenkins,这是我的代码: 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.annot

这是我的代码:

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中运行测试时,它失败了(我是故意这么做的)

但当我在詹金斯运行它时,它说构建成功


这是怎么可能的,以及如何让Jenkins给出正确的结果作为Eclipse中的结果,Maven模型的Eclipse仿真不是100%正确的

值得注意的是,Eclipse并没有区分src/main/java和src/test/java,这一切都是大锅饭。马文有


测试类必须放在src/Test/java中,才能由maven surefire插件调用。

而实际的测试是什么?请参阅上面的代码,我刚刚添加了它。我建议您更多地了解什么是
driver.get()
返回。但这与Jenkins提供的成功构建有何联系?看起来像是在不同机器上运行的结果。请制作一个MCVE演示此行为,并将其放在例如github上。