Skip to content
21

Introducing Thucydides

Thucydides is a tool that lets you use WebDriver-based unit or BDD tests to write more flexible and more reusable WebDriver-based tests, and also to generate documentation about your acceptance tests, including a narrative description of test, along with the corresponding screen shots, and also high-level summaries and aggregations of the test results.

How does it work

Let’s have a look at one of the most common ways of using Thucydides:

1) What are you working on?

First, you create a model of the features and user stories you intend to implement in the next iteration:

2) How do you know it’s done?

Next, describe your high-level acceptance criteria in business terms. Here, we are using easyb, but you could also use just plain JUnit (and soon, Cucumber, Fitnesse, and other popular BDD tools):

3) Details, details

Now, flesh out your acceptance criteria in terms of high level steps (but don’t worry about the implementation yet – we are still thinking “what”, not “how”). Once this is done, you will have a pending acceptance test.

Or, if you prefer JUnit, you could do this:

4) Implement the steps

Now implement the actual test steps using either WebDriver page objects or other test steps. Here you start thinking about implementation:

5) Implement the Page Objects

Next you will need to implement your page objects, if you are not reusing existing ones (which tends to often be the case). These are almost just run-of-the-mill WebDriver page objects, but with a few enhancements:

6) Check out the reports!

Now, when you run your tests, Thucydides will produce a narrative-style report describing not only whether the test succeeded, but what it did:

7) And the pretty pictures

You can also step through the test from the user’s perspective, seeing a sequence of screenshots:

7) Don’t forget the high-level view

Thucydides also provides nice high-level reporting. Here is a report showing all the acceptance criteria for a particular story:

You can also get a high-level picture of your application, in terms of features, stories and acceptance criteria:

21 Comments Post a comment
  1. jaliya sumanadasa
    Mar 14 2012

    As far as I explored, Thucydides doesn’t support to mouse event actions. It so ridiculous when going to automated projects events base on mouse events. Any solution for this other than running Jqueries or Javascript ??

    Reply
  2. I created a mvn project, added the required configuration to the settings.xml, but when I run

    mvn test thucydides:aggregate

    I see that the build is successful, but 0 tests run, though I see at least one non-pending test in the test application, it is searching_by_keyword_apple_should_display_the_corresponding_article

    It seems that the application does not start web driver. How can I fix this?

    Reply
    • Sep 18 2012

      The web tests are run during the integration-test phase, so you need to run mvn verify thucydides:aggregate

      Reply
  3. Martin
    Dec 17 2012

    Can thucydides reports be integrated in Jenkins?

    Reply
  4. Surender
    Jan 10 2013

    Our application is secured, forces user to enter NT username/password. Is there a way to automate that in firefox?

    Reply
  5. Surender
    Jan 17 2013

    I was using spring configuration with Jbehave as below, my steps have dependencies, how can I achieve the same using Thucydidies?

    @RunWith(SpringAnnotatedEmbedderRunner.class)
    @Configure()
    @UsingEmbedder(embedder = Embedder.class, generateViewAfterStories = true, ignoreFailureInStories = true, ignoreFailureInView = true)
    @UsingSpring(resources = { “org/jbehave/examples/trader/spring/configuration.xml”,
    “org/jbehave/examples/trader/spring/steps.xml” })
    public class AnnotatedEmbedderUsingSpring extends InjectableEmbedder {

    @Test
    public void run() {
    injectedEmbedder().runStoriesAsPaths(storyPaths());
    }

    protected List storyPaths() {
    String searchInDirectory = codeLocationFromPath(“../trader/src/main/java”).getFile();
    return new StoryFinder().findPaths(searchInDirectory, asList(“**/*.story”), null);
    }

    }

    Reply
  6. Abhishek
    Aug 19 2014

    Hi Sir/Mam,
    i want to automate chat application using Thucydides.

    i have Requirement like :
    1) two user should communicate using same browser but at different window-session
    2) i don’t want to use ‘New’ operator for driver instantiation
    3) using Thucydides “0.9.200” and “0.9.205” version it works fine and two different window-session opens for the same browser independently BUT with letter version it does not happen
    4) using letter version from Thucydides “0.9.205” version, second browser opens at the same window session and it overrides( which is not expected)

    Please suggest how should I automate above requirement, your help is appreciated!!

    Thanks

    Reply
    • Aug 19 2014

      You should post this on the Google Groups (https://groups.google.com/forum/#!forum/thucydides-users), possibly with some sample code describing what you want to do.

      Reply
      • Abhishek
        Aug 19 2014

        Thanks jfsmart, will post there soon..

    • Abhishek
      Aug 19 2014

      i am trying using a single-browser only

      Problem:
      second-chat-window gets overridden on the first-chat-window session only.

      i want to have two different window-session independently using single-Browser(without using New Keyword)

      Thanks in advance!!

      Reply
      • Martin
        Sep 4 2014

        Easy fix. Use two different browsers – one for each chat, so sessions are not shared. Else you properly have to use 2 different virtual display or selenium grid to run two seperate sessions in the same browser type.

  7. Larisa
    Apr 19 2016

    Hello John

    I am currently using a framework which is built with Serenity, jUnit and Gradle, to write automated tests for a web application. The framework is parametrized, in a way that each test method runs with four different parameters, and for this I use “@Concurrent” annotation at the beginning of the test class that I want to run. My concern is that even if the number of threads specified in annotation is greater than 4, only 4 browsers will be opened.
    Either Serenity is limited when it comes to run parametrized tests in parallel (it will open as many threads as the number of parameters), or some other changes needs to be done in the code. Do you have any suggestions?

    Thank you!

    Reply
    • Apr 26 2016

      Hi Larisa,

      You might want to ask this question on the Serenity BDD Google Groups mailing list, but there shouldn’t be any arbitrary limit to the number of threads. I often have 6 or 8 running simultaneously. However, beyond 4 browsers, the browsers themselves sometimes become unreliable, so your milage may vary.

      Reply

Trackbacks & Pingbacks

  1. Новости » Blog Archive » Нирвана для тестировщика — Nerrvana
  2. Selenium WebDriver – тестування web-сторінок з Java – JUGLviv

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments

%d bloggers like this: