< Previous | Front page | Next >
Skip to end of metadata
Go to start of metadata

Graphene strongly ties to Arquillian Core and its extensions Containers and Drone to manage lifecycle of the application server, selenium server and Graphene.

In the common scenarios, you need only to choose container you would like to deploy application into and the framework you would like to use for testing.

Project Setup

Maven Project Dependencies

In order to setup project dependencies, you need to define library dependencies.

Refer to Framework Integration Options for more details.

Starting with testing from Java

The simplest possible test would look like this:

This test uses @Drone annotation in order to bring browser to your test case using dependency injection.
You can read more about Using Drone, where you will get information which instances you can use in which situations.

The browser is represented by WebDriver class instance (or its implementations).
For more information what is WebDriver and how it relates to Graphene, look at Using WebDriver.

This is really simple case, it does not really show where Graphene excels.

Advanced Use Cases

Page Abstractions

On the high level, Graphene allows you to create reusable abstractions in form of Page Object (the pattern widely known in Selenium community)

and Page Fragments, which allow you to encapsulate smaller pieces of your page like JavaScript widgets, UI components or simply forms.

You can read more about using reusable Page Abstractions.

Testing AJAX

Second big promise of Graphene is making a testing of applications using asynchronous calls heavily (AJAX, WebSocket, ...) simple task.

Graphene allows that by exposing compact syntax for describing conditions which must be met on the page once asynchronous call finished.

You can read more about Testing AJAX,
or you can go directly to the documentation of features, which enables that:

Graphene Utility Class

Graphene Utility Classenables compact syntax for waiting and guards

Request Guards

Request Guardsbrings simplest conditions: wait for request to be finished (blocking test)

Under the Hood

Graphene enables way more features on a low level.
Using following features may help you write outstanding tests:

Graphene Context

allows you to obtain current thread-local context of the browser and "inject" it where you need it without reference propagation.

JavaScript Interface

allows to call JavaScript functions from Java directly.

Page Extensions

allows to bring JavaScript code to the browser.

Using Drone

Drone is extension for Arquillian that manages lifecycle of the Selenium Server and Selenium clients as Selenium 1.x, Selenium 2.x and Graphene.

Refer to Using Drone section for more information.

Running Graphene tests from an IDE

It is possible to run Graphene tests from any modern IDE. See Arquillian Getting Started Guide for more information about how to run and debug tests in Eclipse.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.