net.serenitybdd.plugins.saucelabs.SauceLabsTestSession Maven / Gradle / Ivy
The newest version!
package net.serenitybdd.plugins.saucelabs;
import io.restassured.RestAssured;
import net.thucydides.model.domain.TestOutcome;
import net.thucydides.model.domain.TestResult;
import org.apache.commons.codec.binary.Hex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.Key;
import java.util.HashMap;
import java.util.Map;
public class SauceLabsTestSession {
private static final Logger LOGGER = LoggerFactory.getLogger(SauceLabsTestSession.class);
private static final String REST_API_URL = "https://%s:%[email protected]/rest/v1/%s/jobs/%s";
private static final String APP_TEST_LINK_TEMPLATE = "https://app.saucelabs.com/tests/%s";
private final String sauceLabsUsername;
private final String sauceLabsKey;
private final String sessionId;
public SauceLabsTestSession(String sauceLabsUsername, String sauceLabsKey, String sessionId) {
this.sauceLabsUsername = sauceLabsUsername;
this.sauceLabsKey = sauceLabsKey;
this.sessionId = sessionId;
}
public void updateTestResultFor(TestOutcome testOutcome) {
Map