Skip to content

Posts tagged ‘screenshots’


Thucydides Release 0.9.92 – Improved Requirements reporting, screenshot blurring and bug fixes

Release 0.9.92 is now available and contains the following enhancements:

Improved requirements reporting

The Requirements reporting tab has been enhanced to show test results at a requirements level. This provides an overall view of the progress of the project by making it easier to view not only what stories have been implemented, but also features and capabilities that remain to be done. Here’s a screenshot.

Requirements Reporting tab

Requirements Reporting tab

You can read more about Thucydides’ approach to requirements reporting in this excellent blog post – Functional Test Coverage – Taking BDD Reporting To The Next Level

Blurring screenshots (Thucydides-116)

For security/privacy reasons, it may be required to blur sensitive screenshots in Thucydides reports. This is now possible by annotating the test methods or steps with the annotation @BlurScreenshots. When defined on a test, all screenshots for that test will be blurred. When defined on a step, only the screenshot for that step will be blurred. @BlurredScreenshot takes a string parameter with values LIGHT, MEDIUM or HEAVY to indicate the amount of blurring. For example,

 public void looking_up_the_definition_of_pineapple_should_display_the_corresponding_article() {
     endUser.should_see_definition_containing_words("A thorny fruit");

This feature is currently available for junit stories but we’ll extend it shortly to jbehave and easyb.

Other enhancements and bug fixes

  • Uninstantiated page objects in step libraries are now automatically instantiated.
  • Fixed a bug that caused tests to wait unnecessarily in subsequent steps after a step had failed.
  • A custom requirements tag provider, if specified, will be given preference over the default file system based requirements provider.

Keep watching this space for more updates and announcements.


New features in Thucydides 0.7.10

The latest version of Thucydides (0.7.10) to be released has some great new features! Find out more below:

Flag a test as ‘pending’ or ‘ignored’ from within a test step/page object
This is useful if a test can’t be completed for reasons outside the scope of the test, which occasionally happens with acceptance tests. To do this, just call ‘Thucydides.pendingStep()’ or ‘Thucydides.ignoredStep()’, as shown here:

public String findFirstPartiallyPublishedBookingId() {
    String partiallyPublishedBookingId = null;
    try {
        partiallyPublishedBookingId = getFirstBookingIDWithStatus("Partially Published");
    } catch (NoMatchingBookingFoundError e) {
        Thucydides.pendingStep("No partially published booking available");
    return partiallyPublishedBookingId;

Both methods take a message as an argument, which appears in the final report, on the screenshot corresponding to the step where this occured. Any steps following a pending step will be flagged as ‘ignored’. Any steps following a step marked as ‘ignored’ in this way will be executed normally.

Improved reporting
The reports in Thucydides 0.7.10 come with a brand new dashboard which provides you with a quick overview of the state of your tests, as well as many other improvements:

New, improved dashboard

Proxy support
If you need to use a proxy to access the web site you are testing, you can now do this by providing the system properties thucydides.proxy.http and thucydides.proxy.http_port. Note: This feature is currently supported for Firefox only.

Tell us what you think of the changes…


Managing state between steps

Sometimes it’s useful to be able to pass information between steps. For example, you might need to check that a client’s details that were entered into a registration form appear correctly on a confirmation page later on.

You could do this by storing the values in local variables, as illustrated in the following example:

public void "Search property when creating ad"() {
    property_owner.selects_ad_category_and_style("Houses For Sale", "Premium Ad Style")
    def publicationName = pages[PublicationDatesPage].publicationName;
    def publicationDate = pages[PublicationDatesPage].publicationDate;


    def displayedPublicationName = pages[ConfirmationPage].getPublicationDate();
    def displayedPublicationDate = pages[ConfirmationPage].getPublicationName();
    assertThat(displayedPublicationDate, is(publicationDate));
    assertThat(displayedPublicationName, is(publicationName));

The problem with this approach is that it tends to clutter up the steps, and it also leaks implementation details into the high-level tests. Another approach is to use the Thucydides test session, which is essentially a hash map allowing you to store variables for the duration of a single test. You can obtain this session map using the Thucydides.getCurrentSession() static method.

In the following example, we store the publication name and date, obtained from the current web page, in the test session.

public void notes_publication_name_and_date() {
    PublicationDatesPage page = pages().get(PublicationDatesPage.class);
    String publicationName = page.getPublicationName();
    DateTime publicationDate = page.getPublicationDate();

    Thucydides.getCurrentSession().put("publicationName", publicationName);
    Thucydides.getCurrentSession().put("publicationDate", publicationDate);
Then, in a step invoked later on in the test, you can check the values stored in the session:
public void checks_publication_details_on_confirmation_page() {
    ConfirmationPage page = pages().get(ConfirmationPage.class);
    String selectedPublicationName = (String) Thucydides.getCurrentSession().get("publicationName");
    DateTime selectedPublicationDate = (DateTime) Thucydides.getCurrentSession().get("publicationDate");
    assertThat(page.getPublicationDate(), is(selectedPublicationName));
    assertThat(page.getPublicationName(), is(selectedPublicationDate));
The end result is a more concise and high-level test:
public void "Search property when creating ad"() {
    property_owner.selects_ad_category_and_style("Houses For Sale", "Liner + Large Header + Attention Getter")
Thucydides test session data is stored in a ThreadLocal variable, so it will work if tests are run in parallel. The test session is cleared at the start of each test, so test data stored from previous tests cannot interfere with the current test. If no variable is found with the requested name, the test will fail.
It is always preferable to keep the high-level acceptance tests as general as possible: using and comparing temporary variables at the test level clutters and distracts from the overall understanding of the test. Using the Thucydides test sessions can go a long way helping to do this.

Thucydides 0.4.8 Released

A new version of Thucydides – version 0.4.8 – is now available in the Maven repositories.

One of the most important improvements in this latest version is that it uses Selenium 2.6, which supports all versions of Firefox from 3.0 to 7. Previous versions of Selenium did not work well with Firefox 6 and 7.

Other improvements have been made in the reporting features. By default, Thucydides opens a browser with a width of around 1000px. Sometimes, this is not enough, and you need a larger window to see all of the elements on your page in the screenshots. Thucydides 0.4.8 lets you define the witdh of the browser Thucydides opens via the thucydides.browser.width command line option. Read more »