Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Oct 18, 2023
1 parent 40fd3d8 commit fe8d837
Showing 1 changed file with 66 additions and 77 deletions.
143 changes: 66 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,62 @@
# Java Demonstration Scripts
# Java Demonstration Code

Welcome to Java Demo Scripts designed by Solution Architects to provide examples of how to use Sauce Labs technologies. This repository contains
everything that you need to get started with web, mobile, visual, functional and all other types of automation using Java.
Welcome to Java Demo Scripts designed by Solution Architects to provide examples of how to use Sauce Labs technologies.
This repository contains
everything that you need to get started with web, mobile, functional, performance, accessibility and all other types of
automation using Java.

[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/564ddfb012db40048781b7b6c954d099)](https://app.codacy.com/gh/saucelabs-training/demo-java?utm_source=github.com&utm_medium=referral&utm_content=saucelabs-training/demo-java&utm_campaign=Badge_Grade_Dashboard)
[![Best Practices Tests](https://github.com/saucelabs-training/demo-java/actions/workflows/best-practice.yml/badge.svg)](https://github.com/saucelabs-training/demo-java/actions/workflows/best-practice.yml)
[![Selenium JUnit 5 Tests](https://github.com/saucelabs-training/demo-java/actions/workflows/selenium-examples.yml/badge.svg)](https://github.com/saucelabs-training/demo-java/actions/workflows/selenium-examples.yml)
[![JUnit 4 Tests](https://github.com/saucelabs-training/demo-java/actions/workflows/junit4.yml/badge.svg)](https://github.com/saucelabs-training/demo-java/actions/workflows/junit4.yml)
[![TestNg Tests](https://github.com/saucelabs-training/demo-java/actions/workflows/testng.yml/badge.svg)](https://github.com/saucelabs-training/demo-java/actions/workflows/testng.yml)
[![Selenium Cucumber Examples](https://github.com/saucelabs-training/demo-java/actions/workflows/cucumber.yml/badge.svg)](https://github.com/saucelabs-training/demo-java/actions/workflows/cucumber.yml)
[![Real Devices](https://github.com/saucelabs-training/demo-java/actions/workflows/real-devices.yml/badge.svg)](https://github.com/saucelabs-training/demo-java/actions/workflows/real-devices.yml)

## 🥇Most Popular
* [Web automation best practices framework with multiple testing strategies. Crafted by industry experts with decades of experience.](./best-practice/)
* [Quick start test, Junit 5](./selenium-examples/src/test/java/com/saucedemo/selenium/demo/SeleniumTest.java)
* [Quick start test, Junit 4](./selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/demo/SeleniumTest.java)
* [Quick start test, TestNg](./selenium-testng-examples/src/test/java/com/saucedemo/selenium/testng/demo/SeleniumTest.java)
* [iOS real device, native app, Junit4](./appium-examples/src/test/java/com/appium_app/simple_example/IOSNativeAppTest.java)
* [Front-end performance testing](./selenium-examples/src/test/java/com/saucedemo/selenium/PerformanceTest.java)
* [Visual E2E test](./selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/SimpleVisualE2ETest.java)
* [Sauce Connect usage](./selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/SauceConnectTest.java)

## Best Practices
* [Desktop](./best-practice/src/test/java/com/saucedemo/tests/DesktopTests.java) `junit4` `sauce-bindings`
* [Emu/Sim Web](./best-practice/src/test/java/com/saucedemo/tests/EmuSimWebAppTests.java) `junit4` `sauce-bindings`
* [Performance](./best-practice/src/test/java/com/saucedemo/tests/PerformanceTests.java) `junit4` `sauce-bindings`
* [RealDevice](./best-practice/src/test/java/com/saucedemo/tests/RealDeviceWebTests.java) `junit4` `sauce-bindings`
* [Visual E2E](./best-practice/src/test/java/com/saucedemo/tests/VisualCrossPlatformTests.java) `junit4` `sauce-bindings`

## 🖥Web automation

- Sauce Bindings With TestRunner Examples
* [Junit 5](./selenium-examples/src/test/java/com/saucedemo/selenium/demo/SaucebindingsJunitTest.java) `junit5` `sauce-bindings`
* [Junit 4](./selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/demo/SauceBindingsJunit4Test.java) `junit4` `sauce-bindings`
* [TestNg](./selenium-testng-examples/src/test/java/com/saucedemo/selenium/testng/demo/SauceBindingsTestngTest.java) `testng` `sauce-bindings`

- Sauce Bindings Examples
* [Junit 5](./selenium-examples/src/test/java/com/saucedemo/selenium/demo/SauceBindingsTest.java) `junit4` `sauce-bindings`
* [Junit 4](./selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/demo/SauceBindingsTest.java) `junit4` `sauce-bindings`
* [TestNg](./selenium-testng-examples/src/test/java/com/saucedemo/selenium/testng/demo/SauceBindingsTest.java) `junit4` `sauce-bindings`

- Selenium Examples
* [Accessibility Test with Sauce Bindings](/selenium-examples/src/test/java/com/saucedemo/selenium/accessibility/SauceBindingsTest.java) `junit4` `sauce-bindings`
* [Accessibility Test with Deque Axe](/selenium-examples/src/test/java/com/saucedemo/selenium/accessibility/DequeAxeTest.java) `junit4`
* [Cucumber web test](./selenium-cucumber-examples/src/test/java/com/saucedemo/selenium/cucumber/RunTestsAT.java)
* [Windows authentication](./selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/WindowsAuthentication.java) `junit4`
* [Cross Browser/Platform in Parallel w/ TestNG](./selenium-testng-examples/src/test/java/com/saucedemo/selenium/testng/CrossBrowserPlatformTest.java) `testng`
* [Performance, front-end with Sauce Bindings](/selenium-examples/src/test/java/com/saucedemo/selenium/PerformanceTest.java) `junit5` `sauce-bindings`
* [Single Browser in Parallel w/ TestNG](./selenium-testng-examples/src/test/java/com/saucedemo/selenium/testng/ParallelSingleBrowserTest.java) `testng`
* [Visual e2e test](./selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/SimpleVisualE2ETest.java) `visual` `junit4`
* [Visual e2e test with branching strategy](./blob/54a4bfde9040d71f88f3b3aff79a047474d01be9/selenium-junit4-examples/src/test/java/com/saucedemo/selenium/junit4/SimpleVisualE2ETest.java#L115-L158) `visual` `junit4`
## 🖥Desktop browser automation

There are 3 main test runners people use with Java:

* [Junit 5](./selenium/src/test/java/com/saucedemo/selenium/) `junit5` `sauce-bindings`
* [Junit 4](./selenium-junit4/src/test/java/com/saucedemo/selenium/junit4/) `junit4` `sauce-bindings`
* [TestNg](./selenium-testng/src/test/java/com/saucedemo/selenium/testng/) `testng` `sauce-bindings`

### Selenium Features

* Running tests in Parallel
* Running Cross Browser/Platform
* RemoteWebDriverBuilder
* Recommended Capabilities
* Firefox-only Features
* Chrome-only Features
* Chrome DevTools

### Sauce Labs Features

* [Performance, front-end with Sauce Bindings](/selenium/src/test/java/com/saucedemo/selenium/sauce_features/PerformanceTest.java) `junit5` `sauce-bindings`
* [Accessibility Test with Deque Axe](/selenium/src/test/java/com/saucedemo/selenium/sauce_features/AccessibilityTest.java) `junit4`

## 📱Mobile automation

[📚 Mobile Testing Training Tutorials](./TRAINING.md)

- Real Devices
* [iOS native app](./appium-examples/src/test/java/com/appium_app/simple_example/IOSNativeAppTest.java)
* [Android native app](./appium-examples/src/test/java/com/appium_app/simple_example/AndroidNativeAppTest.java)
* [Upload app to Sauce Storage](./appium-examples/src/test/java/com/helpers/push_apps_to_storage.sh)
* [Image Injection](./appium-examples/src/test/java/com/appium_app/image_injection)
* [Biometric Login](./appium-examples/src/test/java/com/appium_app/biometric_login)
* [Cucumber w/ Appium](./appium-junit4-cucumber-examples/src/test/resources/LoginPage.feature) `junit4` `cucumber`
* [iOS native app](./appium-examples/src/test/java/com/appium_app/simple_example/IOSNativeAppTest.java)
* [Android native app](./appium-examples/src/test/java/com/appium_app/simple_example/AndroidNativeAppTest.java)
* [Upload app to Sauce Storage](./appium-examples/src/test/java/com/helpers/push_apps_to_storage.sh)
* [Image Injection](./appium-examples/src/test/java/com/appium_app/image_injection)
* [Biometric Login](./appium-examples/src/test/java/com/appium_app/biometric_login)
* [Cucumber w/ Appium](./appium-junit4-cucumber-examples/src/test/resources/LoginPage.feature) `junit4` `cucumber`

- Emulators and Simulators
* [iOS native app](./appium-examples/src/test/java/com/appium_app/simple_example/IOSNativeAppTest.java)
* [Android native app](./appium-examples/src/test/java/com/appium_app/simple_example/AndroidNativeAppTest.java)
* [Biometric Login](./appium-examples/src/test/java/com/appium_app/biometric_login)
* [iOS native app](./appium-examples/src/test/java/com/appium_app/simple_example/IOSNativeAppTest.java)
* [Android native app](./appium-examples/src/test/java/com/appium_app/simple_example/AndroidNativeAppTest.java)
* [Biometric Login](./appium-examples/src/test/java/com/appium_app/biometric_login)

## ⚙️Setup

* Install [Git](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-git)
* Install [IntelliJ (or another IDE)](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-intellij)
* Install [JDK](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-the-jdk)
* Install [Maven](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-maven)
* Install [Git](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-git)
* Install [IntelliJ (or another IDE)](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-intellij)
* Install [JDK](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-the-jdk)
* Install [Maven](https://github.com/saucelabs-training/demo-java/blob/main/docs/prerequisites.md#install-maven)

### Import the Project

Expand All @@ -92,44 +74,45 @@ everything that you need to get started with web, mobile, visual, functional and
5. Choose the **demo-java** directory as the **root** directory of the project.

### Set Your Sauce Labs Credentials
1. Copy your Sauce Labs **username** and **accessKey** in the [User Settings](https://app.saucelabs.com/user-settings) section of the [Sauce Labs Dashboard](https://app.saucelabs.com/dashboard/builds).

1. Copy your Sauce Labs **username** and **accessKey** in the [User Settings](https://app.saucelabs.com/user-settings)
section of the [Sauce Labs Dashboard](https://app.saucelabs.com/dashboard/builds).
2. Open a Terminal window (command prompt for Windows) and set your Sauce Labs Environment variables:
**Mac OSX:**
```
$ export SAUCE_USERNAME="your username"
$ export SAUCE_ACCESS_KEY="your accessKey"
$ export SCREENER_API_KEY="your screener key"
```
**Windows:**
```
> set SAUCE_USERNAME="username"
> set SAUCE_ACCESS_KEY="accessKey"
> set SCREENER_API_KEY="your screener key"
```
> To set an environment variables permanently in Windows, you must append it to the `PATH` variable.
> Go to **Control Panel > System > Windows version > Advanced System Settings > Environment Variables > System Variables > Edit > New**
> Go to **Control Panel > System > Windows version > Advanced System Settings > Environment Variables > System
Variables > Edit > New**
> Then set the "Name" and "Value" for each variable
3. Test the environment variables

**Mac OSX:**
**Mac OSX:**
```
$ echo $SAUCE_USERNAME
$ echo $SAUCE_ACCESS_KEY
```

***WARNING FOR UNIX USERS!***
*If you have problems setting your environment variables, run the following commands in your terminal:*
***WARNING FOR UNIX USERS!***

*If you have problems setting your environment variables, run the following commands in your terminal:*

```
$ launchctl setenv SAUCE_USERNAME $SAUCE_USERNAME
$ launchctl setenv SAUCE_ACCESS_KEY $SAUCE_ACCESS_KEY
```

**Windows:**
**Windows:**
```
> echo %SAUCE_USERNAME%
> echo %SAUCE_ACCESS_KEY%
Expand All @@ -150,18 +133,24 @@ everything that you need to get started with web, mobile, visual, functional and
$ mvn test -pl best-practice -Dtest=DesktopTests
```

You can run different tests from different modules. Check out some examples by looking at the [CI YML files](./.github/workflows)

## Contributing
You can run different tests from different modules. Check out some examples by looking at
the [CI YML files](./.github/workflows)

This repository is maintained by the Solutions Architect team at Sauce Labs. **We welcome all ideas and contributions!**
## Contributing

Guidance for contributing can be found [here](./CONTRIBUTING.md)
This repository is maintained by the Solutions Architect team at Sauce Labs. **We welcome all ideas and contributions!**

Guidance for contributing can be found [here](./CONTRIBUTING.md)

## Disclaimer

> The code in these scripts is provided on an "AS-IS" basis without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement. These scripts are provided for educational and demonstration purposes only, and should not be used in production. Issues regarding these scripts should be submitted through GitHub. These scripts are maintained by the Technical Services team at Sauce Labs.
> The code in these scripts is provided on an "AS-IS" basis without warranty of any kind, either express or implied,
> including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a
> particular purpose, or non-infringement. These scripts are provided for educational and demonstration purposes only, and
> should not be used in production. Issues regarding these scripts should be submitted through GitHub. These scripts are
> maintained by the Technical Services team at Sauce Labs.
>
> Some examples in this repository, such as `appium-example`, `parallel-testing`, and `headless`, may require a different account tier beyond free trial. Please contact the [Sauce Labs Sales Team](https://saucelabs.com/contact) for support and information.
> Some examples in this repository, such as `appium-example`, `parallel-testing`, and `headless`, may require a
> different account tier beyond free trial. Please contact the [Sauce Labs Sales Team](https://saucelabs.com/contact) for
> support and information.

0 comments on commit fe8d837

Please sign in to comment.