3pillarlabs/selenium2-visualdiff

Name: selenium2-visualdiff

Owner: 3Pillar Global Open Source

Description: Selenium 2 Visual Diff

Forked from: kreyssel/selenium2-visualdiff

Created: 2015-11-18 11:40:24.0

Updated: 2017-06-21 11:24:37.0

Pushed: 2015-12-09 13:14:49.0

Homepage: kreyssel.github.com/selenium2-visualdiff/visualdiff.html

Size: 72

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Selenium Visual Diff

Goal

The goal is a better integration of screenshots taking in maven executed selenium2 functional tests, storing and versioning of screenshots to get a report of visual differences between two application versions.

Report

See sample report http://kreyssel.github.com/selenium2-visualdiff/visualdiff.html.

Usage

Embed jUnit4 and the selenium2-visualdiff core library as dependencies in your funtional test maven module:

<dependencies>
    ...
    <dependency>
        <groupId>org.kreyssel.selenium2.visualdiff</groupId>
        <artifactId>visualdiff-core</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>
    ...
</dependencies>

Add the selenium2-visualdiff-maven-plugin to the maven module:

<plugins>
    ...
    <plugin>
        <groupId>org.kreyssel.selenium2.visualdiff</groupId>
        <artifactId>visualdiff-maven-plugin</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <executions>
            <execution>
                <goals>
                    <goal>prepare</goal>
                    <goal>package</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    ...
</plugins>

And after all, embed org.kreyssel.selenium2.visualdiff.core.junit4.TakesScreenshotRule in your functional test:

package org.kreyssel.selenium2.visualdiff.it;

import org.kreyssel.selenium2.visualdiff.core.junit4.TakesScreenshotRule;

/**
 * SimpleSeleniumIT.
 */
public class SimpleSeleniumIT {

    @Rule
    public TakesScreenshotRule screenshot = new TakesScreenshotRule();

    RemoteWebDriver driver;

    @Before
    public void init() {
      driver = createDriver();
    }

    @After
    public void destroy() {
      driver.close();
    }

    @Test
    public void test1() throws Exception {
        driver.get( "http://localhost:8080" );

        screenshot.takeScreenshot( driver );
    }
}

After the executions of functional tests in a maven run, all screenshots taken at this time are packaged as zip and attached to the build as ${project.build.finalName}-screenshots.zip. This archive is deployed to maven repository in the deploy phase of the maven build.

The selenium2-visualdiff report plugin generates a report that shows you the different screens per testcase compared to the previous release.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.