From ef1e5310ec38e32c8ca3ae5f1210e32cbf40da05 Mon Sep 17 00:00:00 2001 From: "nikolay.advolodkin" Date: Mon, 15 Apr 2019 13:33:16 -0400 Subject: [PATCH] Update the docs for the new usage of the APi --- README.md | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f2bd20b..4bec3b3 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,11 @@ Sauce Java Helper libraries [![Codacy Badge](https://api.codacy.com/project/badge/Grade/4655f1e8e1fa4c3bae6487e8cc09b23e)](https://app.codacy.com/app/nikolay.advolodkin/sauce-java?utm_source=github.com&utm_medium=referral&utm_content=saucelabs/sauce-java&utm_campaign=Badge_Grade_Dashboard) [![codecov.io](https://codecov.io/github/saucelabs/sauce-java/coverage.svg?branch=master)](https://codecov.io/github/saucelabs/sauce-java?branch=master) -This project contains helper libraries for consuming Sauce Labs services from Java using [TestNG](http://www.testng.org) -and/or [JUnit](http://www.junit.org). - -The helper libraries provide the following functionality: -* Invoke the Sauce REST API to mark a Sauce Job as passed/failed, based on the test result -* Output the Sauce Session Id to the stdout, so that the Sauce Continuous Integration plugins (for Bamboo/Jenkins/Hudson) -can parse the output) -* Provide a com.saucelabs.common.SauceOnDemandAuthentication class, which handles obtaining the Sauce OnDemand user name -and access key from environment variables and/or the filesystem. - -For JUnit projects, the library can be added to a project by including the following dependency: +This project contains helper libraries for consuming Sauce Labs services from Java: +How to use +------ +1. Import the dependency into your pom.xml ```xml com.saucelabs @@ -24,17 +17,23 @@ For JUnit projects, the library can be added to a project by including the follo test ``` +2. Create object -For TestNG projects, the library can be added to a project by including the following dependency: +RemoteWebDriver driver = new RemoteWebDriver(new URL(SAUCE_REMOTE_URL), caps); +SauceHelper sauce = new SauceHelper(driver); + +add an informational comment to your test + +```sauce.comment("Open the Google page");``` + +tell Sauce Labs the status of your test + +```sauce.setTestStatus("pass"); //pass,fail,true,false``` + +set the name of your test case in Sauce Labs + +```sauce.setTestName("shouldOpenGooglePage");``` -```xml - - com.saucelabs - sauce_testng - 2.1.21 - test - -``` [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/saucelabs/sauce-java/trend.png)](https://bitdeli.com/free "Bitdeli Badge")