jeudi 15 février 2018

Junit Passes in Eclipse Fails in Jenkins

Hi my JUnit test passes in eclipse. JUnit has all green bars in eclipse however when I envoke the xml file from Jenkins it says failed. I have seared for hours on stakeoverflow and i cant find the issue. Please help my code that works is below:

   @FixMethodOrder(MethodSorters.NAME_ASCENDING) // this allows you to execute test in order 
public class AdpPortal_1_Homepage {

  private WebDriver driver;
  private String homeUrl;
  private String homeTitle = "ADP Associate Portal";
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    System.setProperty("webdriver.chrome.driver", "C:\\eclipse\\chromedriver\\chromedriver.exe");
    driver = new ChromeDriver();
    homeUrl = "https://myadp.adpcorp.com/wps/myportal/main/myADP_new";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  //Full test
  @Test
  public void fullTest() throws Exception {

    step01_VerifyHomePage();

  }


  // Go to Home page and verify title 
  public void step01_VerifyHomePage() throws Exception {
    driver.get(homeUrl);
    // homeTitle = "ADP Associate Portal" 
    driver.getTitle().contains(homeTitle);
    Thread.sleep(3000);
  }


  @After
  public void tearDown() throws Exception {
    driver.quit();
    String verificationErrorString = verificationErrors.toString();
    if (!"".equals(verificationErrorString)) {
      fail(verificationErrorString);
    }
  }
}

Also here is my console output from Jenkins:

enter image description here

Please help.

Aucun commentaire:

Enregistrer un commentaire