Skip to content

concordion/concordion-screenshot-extension-demo

Repository files navigation

Build and Test Apache License 2.0

Introduction

This project demonstrates the usage of the Concordion Screenshot Extension with Selenium WebDriver.

Example output is shown here.

Running the tests

The tests use Selenium's ChromeDriver, so you'll need to have:

  1. Chrome installed (or you could change the code to use a different driver).
  2. chromedriver downloaded and added to the PATH (or the webdriver.chrome.driver system property set)

The download includes support to run the tests with either Gradle or Maven.

Using Gradle

  1. From a command line opened at the location to which this package has been unzipped, run gradlew clean test
  2. View the Concordion output under the subfolder build/reports/spec/demo

Using Maven

  1. Download and install maven (this has been tested with 3.0.3)
  2. From a command line opened at the location to which this package has been unzipped, run mvn test
  3. View the Concordion output under the subfolder target/concordion/demo

Running from your IDE

Import as a Gradle or as a Maven project. This may require additional plugins to be installed to support Gradle or Maven.

Under the src/test/java folder, find the ScreenshotDemoFixture class in the demo package and run as a JUnit test. The location of the Concordion output is shown on the standard output console.

What you should see

The tests will open a Chrome browser and perform a Google search.

JUnit output

The test should pass successfully, though the console output will show a failure with the message:

<-- Note: This test has been marked as EXPECTED_TO_FAIL

This test deliberately fails in order to demonstrate the extension. The example in the specification is tagged with a status attribute of ExpectedToFail - the JUnit test passes since it meets this expectation (you'd normally only use this when you have a partially implemented feature).

Concordion output

The output folder should contain the following specification. (You can see an example of it here).

ScreenshotDemo.html

This should show a failing example (red). Hovering the mouse over the failing example will show a screenshot taken when the failure occurred. Clicking on the failure will open the screenshot.

The screenshot extension is configured with a custom SeleniumScreenshotTaker class that uses Selenium's TakesScreenshot interface to take a screenshot of the web page. The extension has a number of configuration options, for example to also take screenshots on successful examples and to set the image width.

It can also be used to explicitly add screenshots to the Concordion output.

Potential Issues

Proxy

If you are behind a HTTP proxy server, you may need to configure the proxy to allow access to www.google.com

The easiest way to do this may be to add the following lines to the Site() constructor:

    System.setProperty("http.proxyHost", "<proxy.host>");
    System.setProperty("http.proxyPort", "<proxy.port>");

replacing <proxy.host> with the host name of the proxy server, and <proxy.port> with the port number.

If your proxy requires authentication, you will also need to set the properties http.ProxyUser and http.proxyPassword.

Additional Gradle Files

publish.gradle is only needed if you want to publish the output to Github pages.

If copying the project for your own use, you probably won't want this file.

Mailing List

Feel free to discuss this demo project on the Concordion mailing list.

About

Demonstrates the usage of the Concordion Screenshot Extension with Selenium WebDriver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •