Skip to content

A sample project with Geb integration tests using the geb-container library.

License

Notifications You must be signed in to change notification settings

cbmarcum/geb-container-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geb Container Sample Application

A sample application using the Geb Container library for integration testing.

Geb Functional Testing using Testcontainers

Geb Containers integrates Apache Geb with Testcontainers to make it easy to write functional tests for your applications and utilize browsers running in testcontainers and optionally record the browser using a VNC testcontainer and/or capture reporting screenshots and HTML.

System Requirements

Running and testing this application require Java 21+ due to the sample application using SimpleFileServer.

Usage

This sample project is an example of functional web tests using Geb Container in the integration-test sources, Apache Geb tests in the test sources, and an application to run in the main source set.

Each test source set has a GebConfig.groovy in resources that is configured with an environments block. These environments are used to specify which browser type to use for the test run. The default browser when not specified is firefox. Configured environments are firefox, chrome, and edge. Firefox is generally available on most platforms which is why we configured it as the default.

To run all tests with firefox on Unix/Linux:

./gradlew check

To run all tests with Chrome:

./gradlew check -Dgev.env=chrome

On Windows you can omit the leading ./

The main source set contains the sample application being tested. It starts a simple Java file server running on port 8080 and serves files from src/main/resources/webroot.

Run with:

./gradlew run

Open a browser to http://localhost:8080 to view the test page. Stop with CTRL-C

The itegrationTest starts and stops this application during testing.

More Information

See Geb-Container and Geb for how to use build.gradle and GebConfig.groovy to configure all other options.

About

A sample project with Geb integration tests using the geb-container library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published