Skip to content

Commit

Permalink
remove outdated junit 4 examples and reformat (#157)
Browse files Browse the repository at this point in the history
* remove outdated junit 4 examples and reformat
  • Loading branch information
titusfortner authored Oct 17, 2023
1 parent 85bb01a commit b87ffb4
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 475 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/junit4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@ on:
pull_request:

jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: axel-op/googlejavaformat-action@v3
with:
args: "--replace"
files: "selenium-junit4-examples/**/*.java"
skip-commit: true
- name: Print diffs
run: git --no-pager diff --exit-code

build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Run JUnit 4 Tests
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SCREENER_API_KEY: ${{ secrets.SCREENER_API_KEY }}
run: mvn test -pl selenium-junit4-examples -X
12 changes: 12 additions & 0 deletions selenium-junit4-examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Selenium JUnit 4 examples

This project is to demonstrate how to run JUnit 4 tests on Sauce Labs including:
* Setting correct options
* Sending test results to Sauce
* Running in Parallel with Maven surefire. See [pom.xml](pom.xml)

## Execute tests in parallel:
```bash
cd selenium-examples
mvn test -Dsurefire.parallel=20
```
44 changes: 35 additions & 9 deletions selenium-junit4-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demo-java</artifactId>
<groupId>com.saucelabs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>selenium-junit4-examples</artifactId>
<groupId>com.com.saucelabs</groupId>
<artifactId>selenium_junit4_examples</artifactId>
<version>1.0-SNAPSHOT</version>

<name>Sauce Labs Selenium Examples</name>
<description>Example code for using Selenium on Sauce labs</description>
<url>https://github.com/saucelabs-training/demo-java</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<surefire.parallel>1</surefire.parallel>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>saucebindings-junit4</artifactId>
<version>${sauce_junit4.version}</version>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.14.1</version>
</dependency>
<dependency>
<groupId>com.titusfortner</groupId>
<artifactId>selenium-logger</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -25,10 +51,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<version>3.1.2</version>
<configuration>
<parallel>all</parallel>
<threadCountMethods>100</threadCountMethods>
<threadCountMethods>${surefire.parallel}</threadCountMethods>
<useUnlimitedThreads>true</useUnlimitedThreads>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit b87ffb4

Please sign in to comment.