Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ryancoughlin/eb4e29cb5b1600262ae3fafaceb2628e to your computer and use it in GitHub Desktop.
Save ryancoughlin/eb4e29cb5b1600262ae3fafaceb2628e to your computer and use it in GitHub Desktop.
Update SauceLabs Results

List:

  • foo
  • bar

This is an H1

This is an H2

@AfterMethod(alwaysRun = true)
public void shutDownDriver(ITestResult result) throws IOException {
}@AfterMethod(alwaysRun = true)
public void shutDownDriver(ITestResult result) throws IOException {
    
    // Update SauceLabs result
    if(testbed.equals("saucelab")) {
        String jobID = ((RemoteWebDriver)driver).getSessionId().toString();
        SauceREST client = new SauceREST("username", "key");
        Map<String, Object>sauceJob = new HashMap<String, Object>();
        sauceJob.put("name", "Test method: "+result.getMethod().getMethodName());
        if(result.isSuccess()) {
            client.jobPassed(jobID);
        } else {
            client.jobFailed(jobID);
        }
        client.updateJobInfo(jobID, sauceJob);            
    }
    driver.manage().deleteAllCookies();
    driver.quit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment