Serenity Core 1.0.38 Released
Serenity Core 1.0.38 includes a number of bug fixes and improvements, including:
- The CSVReader can now parse special characters like \n,\t etc.
- Fixed a bug with requirements reporting for @pending Cucumber scenarios
- Updated to Selenium 2.45.0
- Fixed an issue in which tests were slowed down after a failing step because Serenity continued to try to take snapshots.
Keep tabs on the latest releases on Bintray!
Handling work-in-progress with Thucydides and JBehave using @pending and @wip tags
Thucydides version 0.9.268 has just been released, with a few very interesting new features. Thucydides is an open source reporting library that helps you write more effective BDD-style automated acceptance criteria, and generate richer test reports, requirements reports and living documentation. In this article, we will look at some of the new ways this version lets you handle work-in-progress or pending scenarios with Thucydides and JBehave. Read more
New Thucydides release: 0.9.260
This new release integrates Selenium 2.42.2, has improved reporting, a number of improvements to the internal APIs, and addresses a number of issues and improvements. Some of the more notable ones include:
- THUCYDIDES-242 – Need some way to obtain current TestStep within custom StepListener: You can get (a copy of) the current test step by calling
StepEventBus.getEventBus().getCurrentStep()
- THUCYDIDES-192 – Fixed a reporting issue when multiple features or stories had identical names
- THUCYDIDES-232 – get page source on step failure: You can retrieve the page source of the latest step using the
StepEventBus.getEventBus().getCurrentStep()
method. - THUCYDIDES-148 – Thucydides.ignoredStep should not be marked as pended: Thucydides now handles failed assumptions (e.g
Assume.assumeThat(true, is(false))
) in JUnit correctly. Tests with failing assumptions are marked as skipped and reported with an “assumption violation” error. - THUCYDIDES-35 – Allow using multibyte charactor in class name and method name.
- THUCYDIDES-151 – Report aggregate – Running test with parametrized test data seems to have a limitation of 10 parameter pairs
- THUCYDIDES-177 – Report groups test cases for data-driven tests using a CSV file
- THUCYDIDES-214 – thucydides-jira-plugin produces wrong test ID in link posted back to JIRA when using ParameterizedRunner
- THUCYDIDES-235 – Incorrect result appears in log in case if one “Step” using another “Step” (substep)
- THUCYDIDES-227 – Show/hide tags on the main report page
Other fixes/improvements include
- THUCYDIDES-88 logback.groovy in thucydides-core breaks application logging configuration
- THUCYDIDES-239 Better exception reporting in ResizableImage
- THUCYDIDES-228 Don`t write qualifier in console log for DDT Tests
- THUCYDIDES-240 BeanMatcher throws IllegalArgumentException for field names containing dots (or opening parenthesis / square bracket)
Enjoy!
Thucydides version 0.9.235 Released
A new version of Thucydides is out (version 0.9.235), with bug fixes and new features!
Bug fixes
The bug fixes include:
- THUCYDIDES-226 and THUCYDIDES-224: You can now pass arbitrarily complex chrome switches in the ‘chrome.switches’ property, containing spaces, commas etc, e.g.
–user-agent=Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B)AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 MobileSafari/535.19 - THUCYDIDES-215 – Provided drivers can take screenshots
- THUCYDIDES-225 – The webdriver.timeouts.implicitlywait system property now works to configure the timeout value of a PageObject.
- THUCYDIDES-223 – You can now pass absolute path values in the thucydides.driver.capabilities system property.
- Session data and step libraries are cleared between unit tests: A bug in previous versions of Thucydides meant that session data (accessed via the Thucydides.getCurrentSession() method) and step libraries were preserved between session states. This could occasionally cause problems, so session data is now cleared between each test in both JUnit and JBehave. This can be deactivated by setting the ‘thucydides.maintain.session’ property to true. Step libraries are now always reinitialized between scenarios or tests.
THUCYDIDES-215 deserves some more detail. You can add your own custom WebDriver provider by implementing the DriverSource interface. First, you need to set up the following system properties (e.g. in your ‘thucydides.properties’ file):
webdriver.driver = provided webdriver.provided.type = mydriver webdriver.provided.mydriver = com.acme.MyPhantomJSDriver thucydides.driver.capabilities = mydriver
Previously, it was hard to configure Thucydides to take screenshots using provided drivers. Now, you implement the DriverSource interface (as before), but with the new takesScreenshots() method:
public class MyPhantomJSDriver implements DriverSource { @Override public WebDriver newDriver() { try { DesiredCapabilities capabilities = DesiredCapabilities.phantomjs(); // doesn't work :( capabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true); return new PhantomJSDriver(ResolvingPhantomJSDriverService.createDefaultService(), capabilities); } catch (IOException e) { throw new Error(e); } } @Override public boolean takesScreenshots() { return true; } }
This driver will now take screenshots normally.
New Features
And two cool new features:
Custom messages for WebElementFacade assertions
Normally, to check the state of a WebElementFacade, you do something like this:
@FindBy(css=".whatever") WebElementFacade myfield; ... myField.shouldBeVisible();
But in this case, the error message was always the same. Now you can also do this:
myField.expect("My field should be visible").shouldBeVisible();
This will work for any of the "should"-style methods (shouldBeVisible, shouldContainText, etc.).
Clever reuse of screenshots
In previous versions, Thucydides recorded a different set of screenshots for each test run. This could lead to a lot of screenshots and the need for very large disks. Now, if screenshots are identical (i.e. if they have the same MD5 digest), the same file will be used.
Thucydides Release 0.9.125
We made several minor releases in the last two months. The latest release version is 0.9.125 which is now available for download. Here is a list of some of the key features and bug fixes added recently.
More flexible Examples tables for data-driven tests on the details page
Examples table now supports pagination, sorting of columns and text search.
Better handling of foreign characters in reports
Reports now display non-English characters properly.
Test results can be downloaded
The main report page now has a link to download test results in CSV format.
Fluent field entry using into a WebElementFacade
A new method has been added to provide a more fluid way to enter data in a web element facade. The following code snippet will explain.
... page.enter("some value").into(facade); ...
Support for GivenStories in jBehave stories
jBehave style GivenStories
keyword can now be used in .story files. GivenStories
is used to specify pre-requisites for a story in jBehave. This is a very useful feature of jBehave that helps organize the stories better and reduces duplication. See here for examples.
Filter tests by tag in jUnit
You can now filter tests by tag while running Thucydides. This can be achieved by providing a single tag or a comma separated list of tags from command line. If provided, only classes and/or methods with tags in this list will be executed.
Example:
mvn verify -Dtags="iteration:I1"
or
mvn verify -Dtags="color:red,flavor:strawberry"
Support for jUnit Assumptions
If steps include junit style assumptions
, then those steps where the conditions under assumptions fail are marked as PENDING instead of ERROR. Subsequent steps are also marked as PENDING.
Bug Fixes
- Thucydides-146: Fixed a bug that caused chromedriver to fail with error message “Error communicating with the remote browser. It may have died” when
@Managed(uniqueSession)
was set to true. - Thucydides-149: Fixed a bug due to which test where no steps were executed due to error was reported as pending in the aggregate report.
- Thucydides-150: Tests where no steps ae executed due to errors now show relevant exception cause in the report. Earlier the test was reported as error but no details were provided.
- Thucydides-152 : XML reports now support UTF-8 encoding.
- Thucydides-155: Fixed a bug that prevented webdriver from correctly restarting for parameterized tests even when
thucydides.restart.browser.frequency
property is set to 1 - Thucydides-158 : Fixed a bug that was causing reports to throw errors for data-driven tests when
@TestData
contained an array.
Thucydides Release 0.9.103 – Improved reporting, other enhancements and bug fixes
Thucydides Release 0.9.103 adds some useful new features and enhancements.
Reports distinguish between errors and failures
Test reports now distinguish between test errors and failures. The following screenshot will make this clear.
Detailed report will not show screenshots column if there are no screenshots in the test
Tests that do not have any screenshots will no longer show an empty screenshots column in the details page.
Injecting WebElementFacades in Page objects
Instead of declaring WebElement variables in Page Objects and then calling element()
or $()
to wrap them in WebElementFacades, you can now declare WebElementFacade
variables directly inside the Page Objects. This will make the Page Object code simpler more readable.
So, instead of writing
@DefaultUrl("http://en.wiktionary.org/wiki/Wiktionary:Main_Page") public class DictionaryPage extends PageObject { @FindBy(name="search") private WebElement searchTerms; private WebElement go; //variable name matches element id or name public DictionaryPage(WebDriver driver) { super(driver); } public void enter_keywords(String keyword) { element(searchTerms).type(keyword); } public void lookup_terms() { element(go).click(); } public List getDefinitions() { WebElement definitionList = getDriver().findElement(By.tagName("ol")); List<WebElement> results = definitionList.findElements(By.tagName("li")); return convert(results, toStrings()); } private Converter<WebElement, String> toStrings() { return new Converter<WebElement, String>() { public String convert(WebElement from) { return from.getText(); } }; } }
you can write
@DefaultUrl("http://en.wiktionary.org/wiki/Wiktionary:Main_Page") public class DictionaryPage extends PageObject { @FindBy(name="search") private WebElementFacade searchTerms; private WebElementFacade go; //variable name matches element id or name public DictionaryPage(WebDriver driver) { super(driver); } public void enter_keywords(String keyword) { searchTerms.type(keyword); //directly use facade } public void lookup_terms() { go.click(); //directly use facade } public List getDefinitions() { WebElement definitionList = getDriver().findElement(By.tagName("ol")); List<WebElement> results = definitionList.findElements(By.tagName("li")); return convert(results, toStrings()); } private Converter<WebElement, String> toStrings() { return new Converter WebElement, String>() { public String convert(WebElement from) { return from.getText(); } }; } }
Switching to another page object
A new method, switchToPage()
has been added to PageObject
class to make it convenient to return a new PageObject
after navigation from within a method of a PageObject
class. For example,
@DefaultUrl("http://mail.acme.com/login.html") public class EmailLoginPage extends PageObject { ... public void forgotPassword() { ... forgotPassword.click(); ForgotPasswordPage forgotPasswordPage = this.switchToPage(ForgotPasswordPage.class); forgotPasswordPage.open(); ... } ... }
Other minor enhancements and bug fixes
- Selenium version updated to 2.31.0.
- Added
containsOnlyText
andshouldContainOnlyText
methods toWebElementFacade
. These methods are similar tocontainsText/shouldContainText
methods but check for exact match. - Modified
shouldContainText
method inWebElementFacade
so that error message shows both the expected text, and the text found in the element. - Fixed a bug in the error message of the method
WebElementFacade.shouldNotContainText
. - Now you can both activate and deactivate native events for Firefox by setting the
thucydides.native.events
property totrue
orfalse
. - Thucydides-141: Fixed a bug due to which when trying to open a page with slash in the end of url, browser tried to open page without slash.
Thucydides Release 0.9.98 – Better screenshots management
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.
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 valueDIVIDE_EQUALLY
which divides the test cases equally among batches. Set this property toDIVIDE_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.
Thucydides Release 0.9.95 – Example reporting for junit tests
Example reporting comes to Junit tests
Our latest release (0.9.95) brings the example reporting format changes (released last month for jBehave) to parametric junit tests. A few cosmetic changes have also been done for better organization of information and improved readability.
Let’s look at these changes in detail.
As the screenshot above demonstrates, the test table on main report page reduces clutter by showing test results at a test-method level instead of a separate row for each parameter set.
The details page will list all parameter sets in a table. By default, the parameters are names “Parameter 1”, “Parameter 2” and so on. But this can be configured with a comma separated list of column headings passed as an attribute to the @TestData annotation.
@TestData(columnNames = "Word,Definition") public static Collection<Object[]> testData() { return Arrays.asList(new Object[][]{ {"apple", "A common, round fruit"}, {"banana", "An elongated curved fruit"} }); }
Further, the steps section will show a collapsed view with a row for each parameter set. The icon can be clicked to expand the top level step to reveal all the steps and corresponding screenshots. Failed test examples will be highlighted in red.
Support for Firefox preferences
A new property firefox.preferences
can be used to supply a semicolon separated list of Firefox configuration settings. For ex.,
-Dfirefox.preferences="browser.download.folderList=2;browser.download.manager.showWhenStarting=false;browser.download.dir=c:\downloads"
Integer and boolean values will be converted to the corresponding types in the Firefox preferences; all other values will be treated as Strings. You can set a boolean value to true by simply specifying the property name, e.g. -Dfirefox.preferences=app.update.silent
.
For the lazy, here’s a complete reference to Firefox’s configuration settings – http://kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries
Support for test count based batch strategy
Thucydides makes it possible to split the web tests into smaller batches, and to run each batch on a different machine or different virtual display. This is achieved by specifying two parameters when you run each build: the total number of batches being run (thucydides.batch.count
), and the number of the batch being run in this build (thucydides.batch.number
).
For example, the following will divide the test cases into 3 batches (thucydides.batch.count
), and only run the first test in each batch (thucydides.batch.number
):
mvn verify -Dthucydides.batch.count=3 -Dthucydides.batch.number=1
However, this strategy divides the test cases equally among batches. This could be inefficient if some of your test cases have more tests than others. This release adds a new batching strategy based on number of tests in the test cases. The strategy is implemented with the help of a TestCountBasedBatchManager
which evenly distributes test cases across batches based on number of test methods in each test case.
Thucydides Release 0.9.94 – More improvements to reports and some bug fixes
We released version 0.9.94 of Thucydides over the weekend.
Improved reports home page
Reports home page now shows two pie charts, one with the overall tests count and another with the test count weighted by number of steps.
The first pie chart gives an overall status of the tests as it shows how many tests have passed, failed or are still pending. The second pie-chart gives the test status weighted by number of steps which could be used to deduce the nature/criticality of test failures.
There are also some minor improvements to the requirements reporting page.
Updated Selenium version to 2.29.0
Selenium version has been updated to 2.29.0 (Selenium Release notes)
Minor enhancements and bug Fixes
- #Thucydides-122: Added
thucydides.verbose.steps
property, that provides more detailed logging of WebElementFacade steps. - #Thucydides-125: Fixed a bug that caused reports to fail for parameterized tests with new line characters in the test data.
- #Thucydides-130: Fixed a bug due to which PageObject.upload was not working for files on classpath.
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.
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,
@Test @BlurScreenshots("HEAVY") public void looking_up_the_definition_of_pineapple_should_display_the_corresponding_article() { endUser.is_the_home_page(); endUser.looks_for("pineapple"); 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.