Skip to main content

Thucydides Release 0.4.17 - Using Thucydides for non-web tests

Posted by johnsmart on October 27, 2011 at 6:04 PM PDT

A new version of Thucyides is out - version 0.4.17 - with some exiting new features. These include:

  • Support for using Thucydides for backend (i.e. non-web) tests
  • Thucydides archetypes
  • Improved easyb reporting
Let's take a longer look at the first point. Although Thucydides is very much focused on web testing, not all acceptance tests are web tests, and Thucydides now lets you include non-web tests in your Acceptance Test reporting. Thucydides step libraries no longer need to extend the ScenarioSteps class. Indeed, if they do not deal with web tests, they have no reason to. (If they do use web tests, they can still extend the ScenarioSteps class, but they don't have to - providing a constructor with a Pages parameter, or just having a field of type Pages, will suffice). For example, the following class could be used to model some backend steps:
public class BackendSteps {

    @Step
    public void accepts_a_sale_transaction() {...}

    @Step
    public void should_the_update_mainframe() {...}
}
You can then use these steps in your Thucydides tests. If your test doesn't use Selenium 2, you don't need to use the @Managed or @Pages annotations to define your driver and page object factories: you just need to declare the step library using the @Steps annotation:
@RunWith(ThucydidesRunner.class)
@Story(Application.Backend.ProcessSales.class)
public class WorkWithBackendTest {

    @Steps
    public BackendSteps backend;

    @Issue("#WIKI-1")
    @Test
    public void when_processing_a_sale_transation() {
        backend.accepts_a_sale_transaction();
        backend.should_the_update_mainframe();
    }
}
Alternatively, if you are using easyb, your test might look like this:
using "thucydides"

thucydides.uses_steps_from BackendSteps
thucydides.tests_story ProcessSales

thucydides.tests_issue "#WIKI-1"

scenario "Processing a sales transation", {
    when "the backend processes a sale", {
        backend.accepts_a_sale_transaction()
    }
    then "the mainframe should be updated", {
       backend.should_the_update_mainframe()
    }
}
These tests will now be executed as Thucydides tests and included in the reporting, both at the narrative level (though there are no screenshots of course), and in the overall aggregate reporting:
Related Topics >>