Quantcast
Channel: Official Serenity BDD Automated Acceptance Testing Blog » Tips and Tricks
Viewing all articles
Browse latest Browse all 31

Thucydides Release 0.9.98 – Better screenshots management

$
0
0

Thucydides Release 0.9.98 is now out.

More granular screenshot capturing

Adding on to some recent enhancements to screenshots management, Thucydides now supports a method to give you even finer control on capturing screenshots in your tests. Using the newly added takeScreenshot method, you can now instruct Thucydides to take a screenshot at any arbitrary point in the step irrespective of the screenshot level set earlier.

Simply call Thucydides.takeScreenshot() in your step methods whenever you want a screenshot to be captured.

Disk space optimization for reports

Thucydides now saves only rescaled screenshots by default. This is done to help reduce the disk space taken by reports. Should you require to save the original unscaled screenshots too, this default can be easily overridden by setting the property, thucydides.keep.unscaled.screenshots to true.

From this release onwards, html source files for the screenshots will also not be saved by default. Set the property, thucydides.store.html.source to true if you wish to override this behaviour.

Html in step descriptions

This is not really a new feature but rather a hidden feature that one of our users, Alex Artukh, has been experimenting with. You can pass valid HTML text as parameter to @Step methods in the step library. This will show up as formatted text in the reports on the step details page. The following screenshot demonstrates this.

HTML formatted text, if passed to a step method will be displayed as shown. This can be useful for annotating or documenting the tests with helpful information.

HTML formatted text, if passed to a step method will be displayed as shown. This can be useful for annotating or documenting the tests with helpful information.

This was achieved by creating a dummy @Step method called description that takes a String parameter. At runtime, the tests supply this method with formatted html text as parameter.


@Step
public void description(String html) {
    //do nothing
}

public void about(String description, String...remarks) {
    String html =
    "<h2 style=\"font-style:italic;color:black\">" + description + "</h2>" +
    "<div><p>Remarks:</p>" +
    "<ul style=\"margin-left:5%; font-weight:200; color:#434343; font-size:10px;\">";

    for (String li : remarks) html += "<li>" + li + "</li>";

    html += "<ul></div>";

    description(html);
}

Read here for more details.

Incidentally, this feature was broken in the last release due to some regression but has been fixed in the latest release.

Other enhancements

  • Selenium version has been updated to 2.30.0 (Selenium Release notes)
  • WebElementFacade class now has a getAttribute() method to return the value of a given attribute.
  • Continuing with our support for test count based batch strategy from last release, a new system property, thucydides.batch.strategy, has been added to configure the batch strategy. By default this property is set to the value DIVIDE_EQUALLY which divides the test cases equally among batches. Set this property to DIVIDE_BY_TEST_COUNT in order to distribute test cases across batches based on number of test methods in each test case.

Keep watching this space for more.



Viewing all articles
Browse latest Browse all 31

Trending Articles