-
-
Save vcsjones/1556555 to your computer and use it in GitHub Desktop.
Update SauceLabs Results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```java | |
@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