A Java client for Sauce Labs 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.
SauceREST sauce = new SauceREST("username", "access-key", "data_center");
SauceREST sauce = new SauceREST("username", "access-key", DataCenter.US_WEST);
|username||String (required)||your sauce labs username|
|access-key||String (required)||your sauce labs accesskey|
|data_center||String or DataCenter (required)||one of
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.
String tunnels = sauce.getTunnels();
Assets are downloaded by providing a job ID and the location to save the asset to.
Filenames are set automatically to
jobId_yyyyMMdd_HHmmSS_filename.ext, where yyyyMMdd_HHmmSS is the retrieval timestamp and ext is determined by the asset type.
Each of these methods comes in two flavours; the
downloadX methods which ignore exceptions, and the
downloadXOrThrow methods which throw:
downloadX methods return a
boolean indicating if the download was successful.
// Download the log; Ignore exceptions sauce.downloadLog("job_id", "/var/tmp/"); // => true if the Log downloads correctly // Download the log; Raise SauceException.NotAuthorized, FileNotFound, IOException sauce.downloadLogOrThrow("job_id", "/var/tmp");
HAR files are only available for jobs using Extended Debugging.
// Download the HAR file; Ignore exceptions sauce.downloadHAR("job_id", "/var/tmp/"); // => true if the HAR File downloads correctly // Download the HAR file; Raise SauceException.NotAuthorized, FileNotFound, IOException sauce.downloadHAROrThrow("job_id", "/var/tmp");
Video is only available for jobs which have not [disabled video recording](https://docs.saucelabs.com/dev/test-configuration-options/#TestConfigurationOptions-Disablevideorecording.
// Download the Log; Ignore exceptions sauce.downloadVideo("job_id", "/var/tmp"); // => true if the Video downloads correctly // Download the Log; Raise SauceException.NotAuthorized, FileNotFound, IOException sauce.downloadVideoOrThrow("job_id", "/var/tmp");
sauce.getJobInfo(n); #n is the number of jobs to retrieve,as an integer
With version 2.x of SauceREST we have made code-breaking changes to this wrapper. It has been updated to be more future-proof and to also support the newest APIs from Sauce Labs.
This is going to be continuous process which means we will release changes to SauceREST over time.
Storage storage = new SauceREST(DataCenter.EU_CENTRAL).getStorage(); GetAppFiles getAppFiles = storage.getFiles();
<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.
Check out our contribution guide Here for details.
Want a fast, setup dev environment? .
Here for Hacktoberfest?. Check out Our Hacktoberfest Issues, or visit https://opensource.saucelabs.com/hacktoberfest/ to see all our Hacktoberfest projects!