本文整理汇总了Java中com.saucelabs.saucerest.SauceREST.updateJobInfo方法的典型用法代码示例。如果您正苦于以下问题:Java SauceREST.updateJobInfo方法的具体用法?Java SauceREST.updateJobInfo怎么用?Java SauceREST.updateJobInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.saucelabs.saucerest.SauceREST
的用法示例。
在下文中一共展示了SauceREST.updateJobInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tearDown
import com.saucelabs.saucerest.SauceREST; //导入方法依赖的package包/类
/**
* <p>
* Saucelabs tearDown, flag the tests as passed or failed.
* </p><p>
* Uses the SauceREST API to register a test as passed or failed. {@see #SAUCE_REST_API_DELAY_MS}
* </p>
*
* @param passed true if passed, falsed if failed, as a boolean
* @param sessionId saucelabs test session id, as a String
* @throws Exception
*/
public void tearDown(boolean passed, String sessionId, String className, String testName) throws Exception {
if (sessionId != null && System.getProperty(REMOTE_DRIVER_SAUCELABS_PROPERTY) != null) { // dup guard so WebDriverUtils doesn't have to be used
SauceREST client = new SauceREST(System.getProperty(SauceLabsWebDriverHelper.SAUCE_USER_PROPERTY),
System.getProperty(SauceLabsWebDriverHelper.SAUCE_KEY_PROPERTY));
/* Using a map of udpates:
* (http://saucelabs.com/docs/sauce-ondemand#alternative-annotation-methods)
*/
Map<String, Object> updates = new HashMap<String, Object>();
updates.put("passed", passed);
updates.put("build", System.getProperty(SAUCE_BUILD_PROPERTY, "unknown"));
client.updateJobInfo(sessionId, updates);
if (passed) {
client.jobPassed(sessionId);
} else {
client.jobFailed(sessionId);
}
// give the client message a chance to get processed on saucelabs side
Thread.sleep(Integer.parseInt(System.getProperty(SAUCE_REST_API_DELAY_MS, "5000")));
downloadResults(className, testName);
}
}
示例2: addTestName
import com.saucelabs.saucerest.SauceREST; //导入方法依赖的package包/类
public static void addTestName(String sessionID, String testName)
{
SauceREST r = connectToSauceREST();
Map<String, Object> updates = new HashMap<>();
updates.put("name", testName);
r.updateJobInfo(sessionID, updates);
}
示例3: storeBuildNumberInSauce
import com.saucelabs.saucerest.SauceREST; //导入方法依赖的package包/类
/**
* Invokes the Sauce REST API to store the TeamCity build number and pass/fail status within
* Sauce.
* @param build
* @param sessionId
*/
private void storeBuildNumberInSauce(SRunningBuild build, String sessionId) {
Collection<SBuildFeatureDescriptor> features = build.getBuildType().getBuildFeatures();
if (features.isEmpty()) return;
for (SBuildFeatureDescriptor feature : features) {
if (feature.getType().equals("sauce")) {
SauceREST sauceREST = new SauceREST(getUsername(feature), getAccessKey(feature));
Map<String, Object> updates = new HashMap<String, Object>();
try {
String json = sauceREST.getJobInfo(sessionId);
JSONObject jsonObject = (JSONObject) new JSONParser().parse(json);
String buildNumber = build.getBuildTypeExternalId() + build.getBuildNumber();
logger.info("Setting build number " + buildNumber + " for job " + sessionId + " user: " + getUsername(feature));
updates.put("build", buildNumber);
if (jsonObject.get("passed") == null || jsonObject.get("passed").equals("")) {
if (build.getStatusDescriptor().getStatus().isSuccessful()) {
updates.put("passed", Boolean.TRUE.toString());
} else if (build.getStatusDescriptor().getStatus().isFailed()) {
updates.put("passed", Boolean.FALSE.toString());
}
}
sauceREST.updateJobInfo(sessionId, updates);
} catch (org.json.simple.parser.ParseException e) {
logger.error("Failed to parse JSON for session id: " + sessionId + " user: " + getUsername(feature), e);
}
}
}
}