https://github.com/cmccarthyIrl/playwright-java-testng-test-harness
This project uses Java and Playwright to provide a basic test harness. UI and API test examples provided
https://github.com/cmccarthyIrl/playwright-java-testng-test-harness
api github-actions java java-17 multimodule playwright testng ui
Last synced: 3 months ago
JSON representation
This project uses Java and Playwright to provide a basic test harness. UI and API test examples provided
- Host: GitHub
- URL: https://github.com/cmccarthyIrl/playwright-java-testng-test-harness
- Owner: cmccarthyIrl
- License: mit
- Created: 2025-01-06T21:53:42.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-13T08:52:51.000Z (6 months ago)
- Last Synced: 2025-07-13T10:26:57.295Z (6 months ago)
- Topics: api, github-actions, java, java-17, multimodule, playwright, testng, ui
- Language: Java
- Homepage:
- Size: 71.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Playwright Automated Testing Framework
[](https://github.com/cmccarthyIrl/playwright-java-test-harness/actions/workflows/run.yml)
# Index
Start
| Maven
| Quickstart |
Run
| Command Line
| IDE Support
| Java JDK
| Troubleshooting |
| Environment Switching
Report
| Configuration
| Logging |
Advanced
| Contributing |
# Playwright Java Test Harness
This project is a test harness for using Playwright with Java for both UI and API testing. It is set up as a multi-module Maven project with two modules: `ui` for UI-based tests and `api` for API-based tests.
# Maven
The Framework uses [Playwright](https://spring.io/guides/gs/testing-web/) and [TestNG](https://testng.org/) client implementations.
```xml
com.microsoft.playwright
playwright
1.49.0
org.testng
testng
7.10.2
```
# Quickstart
- [Intellij IDE](https://www.jetbrains.com/idea/) - `Recommended`
- [Java JDK 17](https://jdk.java.net/java-se-ri/11)
- [Apache Maven](https://maven.apache.org/docs/3.6.3/release-notes.html)
# Command Line
Normally you will use your IDE to run a test via the `*Test.java` class. With the `Test` class,
we can run tests from the command-line as well.
Note that the `mvn test` command only runs test classes that follow the `*Test.java` naming convention.
You can run a single test or a suite or tests like so :
```
mvn test -Dtest=UITest
```
Note that the `mvn clean install` command runs all test Classes that follow the `*Test.java` naming convention
```
mvn clean install
```
# IDE Support
To minimize the discrepancies between IDE versions and Locales the `` is set to `UTF-8`
```xml
...
UTF-8
UTF-8
...
```
# Environment Switching
You can specify the profile to use when running Maven from the command line like so:
```
mvn clean test -Ptest
```
Example of a maven profile
```xml
...
test
config-test.properties
...
```
# Java JDK
The Java version to use is defined in the `maven-compiler-plugin`
```xml
...
...
org.apache.maven.plugins
maven-compiler-plugin
17
17
...
...
```
# Logging
The Framework uses [SLF4J](https://www.slf4j.org/) You can instantiate the logging service in any Class
like so
```java
private static final LogManager log = new LogManager(UITest.class);
```
you can then use the logger like so :
```java
logger.info("This is a info message");
logger.warn("This is a warning message");
logger.debug("This is a info message");
logger.error("This is a error message");
```
# Extent Reports
The Framework uses [Extent Reports Framework](https://extentreports.com/) to generate the HTML Test Reports
The example below is a report generated automatically by Extent Reports open-source library.

# License
This project is open source and available under the [MIT License](https://github.com/cmccarthyIrl/playwright-java-test-harness/blob/main/LICENSE).
# Troubleshooting
- Execute the following commands to resolve any dependency issues
1. `cd ~/install directory path/playwright-java-test-harness`
2. `mvn clean install -DskipTests`
# Contributing
Spotted a mistake? Questions? Suggestions?
[Open an Issue](https://github.com/cmccarthyIrl/playwright-java-test-harness/issues)