Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
/ xvfb-maven-plugin Public archive

A Maven plugin to manage an Xvfb server, e.g. for headless testing of GUI applications

License

Notifications You must be signed in to change notification settings

Zetten/xvfb-maven-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xvfb-maven-plugin

A Maven plugin to manage an Xvfb server. This may be used for headless testing of GUI applications.

Typical usage

Enable the xvfb:run and xvfb:stop executions in your module's plugin configuration.

These goals bind by default to the pre-integration-test and post-integration-test lifecycle phases. When starting up a free X display port is searched for and Xvfb launched against it, and the process is stopped after integration tests have run.

The DISPLAY variable corresponding to the temporary Xvfb instance may be passed to integration tests in two ways:

  1. The default is that the xvfb:run goal sets a Maven property xvfb.display which can be used in any other plugin executions (e.g. via the environmentVariables option of maven-failsafe-plugin).
  2. An experimental (and unstable) form of setting the $DISPLAY environment variable directly within the executing JVM is also available, but is not recommended.

For example, to run full-UI tycho-surefire-test executions in their own Xvfb instances, use configuration like the below in your parent pom.xml. Since the Tycho test plugin binds to the integration-test phase, the Xvfb plugin will wrap their execution and set the xvfb.display plugin value.

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>com.github.zetten</groupId>
            <artifactId>xvfb-maven-plugin</artifactId>
            <version>${xvfb-maven-plugin.version}</version>
            <executions>
                <execution>
                    <id>wrap-tests</id>
                    <goals>
                        <goal>run</goal>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-surefire-plugin</artifactId>
            <version>${tycho.version}</version>
            <configuration>
                <useUIHarness>true</useUIHarness>
                <environmentVariables>
                    <DISPLAY>${xvfb.display}</DISPLAY>
                </environmentVariables>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>

Credits

The approach was inspired by the Jenkins Xvfb plugin, the Selenium Maven Plugin's Xvfb goal and process-exec-maven-plugin.

About

A Maven plugin to manage an Xvfb server, e.g. for headless testing of GUI applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published