Skip to content

joshgrantsauce/saucerest-java

 
 

Repository files navigation

#SauceREST Java

codecov.io Build Status

A Java client for Sauce Labs’s REST API. This supercedes the old [sauce-rest-api].

Using this client you can update Job info, including pass/fail status and other information supported. Only the Sauce Labs Virtual Device Cloud is supported. For Real Devices, please see the docs.

If a function you're after isn't supported, we suggest either shelling out and using the curl version, or sending a pull request! Contribution Details Here

http://saucelabs.com/docs/sauce-ondemand#alternative-annotation-methods

Usage

Create an instance of the client

SauceREST sauce = new SauceREST("username", "access-key", "data_center");

OR

SauceREST sauce = new SauceREST("username", "access-key", Datacenter.US);

Paramaters:

Name Type Details
username String (required) your sauce labs username
access-key String (required) your sauce labs accesskey
data_center String (optional) one of US, US_EAST, EU (Default US)

Users generally only have access to their own jobs and resources. Parent accounts may have access to their children's jobs. Check out the Sauce Labs documentation for more information.

Change a job's metadata

###Mark a job passed or failed:

sauce.jobPassed(job_id);
sauce.jobFailed(job_id);

Get all tunnels

String tunnels = sauce.getTunnels();

Download Assets

Assets are downloaded by providing a job ID and the location to save the asset too.

Selenium log

sauce.downloadLog("job_id", "/var/tmp/selenium.log");

HAR File

HAR files are only available for jobs using Extended Debugging.

sauce.downloadHAR("job_id", "/var/tmp/HAR.log");

Video

Video is only available for jobs which have not disabled video recording.

Get Information

About a particular job

sauce.getJobInfo("job_id");

About the last 20 jobs

sauce.getJobInfo();

About a requested number of jobs

sauce.getJobInfo(n);  #n is the number of jobs to retrieve, as an integer

About your tunnels

String tunnels = sauce.getTunnels();

Maven

<dependencies>
  <dependency>
    <groupId>com.saucelabs</groupId>
    <artifactId>saucerest</artifactId>
    <version>LATEST VERSION</version>
    <scope>test</scope>
  </dependency>
</dependencies>

For latest version please check the following link: https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.saucelabs%22%20AND%20a%3A%22saucerest%22

Contributing

Check out our contribution guide Here.

About

Sauce REST API client for Java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%