Skip to content

Posts tagged ‘jira’

31
Dec

Thucydides Release 0.9.229


There have been many releases since the last release notes were published, so this entry will summarize some of the highlights that are included in release 0.9.229 (though many came out in releases previous to that). Some of the highlights include:

  • Added support for Selenium 2.39.0
  • Testing AngularJS is made easier with support for the ng-model attribute in the Thucydides @FindBy annotation. Suppose you have this AngularJS input field:
<input ng-model="angularField" value="Model value" />

You can now find this directly using the Thucydides @FindBy:

import net.thucydides.core.annotations.findby.FindBy
 @FindBy(ngModel = "angularField")
 public WebElementFacade ngModelField;
  • Support for nested page objects – you can have page object fields inside other page objects. This makes it easier to write page objects for smaller reusable sections of the screen.
  • You don’t need to override the constructors for ScenarioSteps and PageObjects any more
  • You can provide your own webdriver instance using the ‘webdriver.provided.type’. Just implement the DriverSource interface. For example, you could implement a class like this:
package com.acme
public class MyFunkyDriverSourceImpl implements DriverSource {
    public WebDriver newDriver() {
       return new FunkyWebDriver();
    }
}

Then just run the tests with the following properties (e.g. in the thucyiddes.properties file or on the command line):

webdriver.driver = provided
 webdriver.provided.type = funky
 webdriver.provided.funky = com.acme.MyFunkyDriverSourceImpl
  • Lots of improvements to the reports, including:
    • Reports now have the option to hide the pie chart on the aggregate pages
    • Test reports now display the date and time of the report generation on each page.
    • You can use the ‘show.related.tags’ system property to display (default) or hide related tag statistics on the dashboard
    • Support for reporting on releases/versions by integrating with JIRA (there will be a full article on this feature shortly)
    • Support for integration with 3rd party test management software such as the JIRA Zephyr plugin to report on manual as well as automated tests
  • Many bug fixes

If you are still on an older version, update your dependencies today!

15
Aug

Thucydides Release 0.9.12 – jBehave Integration


A new update to Thucydides was just released – Release 0.9.12.  This release integrates a popular BDD framework, jBehave, with Thucydides.

jBehave Integration

jBehave is one of the most widely used BDD frameworks in Java.  Our latest release lets you define user stories in jBehave. These stories can then be implemented using Thucydides step libraries. When the stories are run, Thucydides will provide a rich set of reports that help you see how the stories are progressing. To learn more, check out the Writing Acceptance Tests with JBehave section of the documentation.

Other minor enhancements and fixes

  • Jira issues can now be specified using both full and abbreviated JIRA links (e.g. MYPROJECT-123 and #123).
  • Multiple file paths can now be specified in the @UseTestDataFrom annotation for data driven tests. Earlier, this annotation supported only a single path. You can now specify several paths (separated by the usual path separators – colon, semi-colon or comma).
  • Reports now open Jira links in a new window or tab.
  • The HtmlTable class can now be used to read tables without headers (i.e., <th> elements) . Earlier  this was not possible.  But you can now specify your won headings using the new withColumnsmethod. For example,
    List<Map<Object, String>> tableRows =
                        HtmlTable.withColumns("First Name","Last Name", "Favorite Colour")
                                 .readRowsFrom(page.table_with_no_headings);

Thucydides is a very active project with frequent releases. Keep watching this space for more announcements. Meanwhile, if you have any queries, shoot us an email using the official mailing list or report a bug in Jira.

21
Oct

Thucydides Release 0.4.15 – 2-way JIRA integration


A new version of Thucydides is out – version 0.4.15 – with some exciting new features, updates and improvements. Thucydides is a library designed to make it easier to write automated acceptance criteria on top of WebDriver/Selenium 2 (see this article for a general introduction).

An overview of the highlights of this release are presented here:

  • Two-way integration with JIRA, including support for custom workflows
  • Better support for parallel testing in JUnit and easyb
  • This version uses Selenium 2.9.0
  • Easyb integration uses the latest version of easyb (1.4) from Maven Central (no messy custom repository configuration required)

In the rest of this article, we will concentrate how you can integrate JIRA with your automated acceptance tests using Thucydides.

When you are using Thucydides with JUnit or easyb, tests or scenarios can implement acceptance criteria for particular user stories. A common strategy for organizations using JIRA is to represent story cards, and/or the associated acceptance criteria, as JIRA issues.

To set up JIRA integration with Thucydides, you need to add the thucydides-jira-plugin to your Maven dependencies. The dependencies you will need (including the normal Thucydides ones) are listed here:

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-junit</artifactId>
        <version>0.4.15</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.thucydides.easyb</groupId>
        <artifactId>thucydides-easyb-plugin</artifactId>
        <version>0.4.15</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.thucydides.plugins.jira</groupId>
        <artifactId>thucydides-jira-plugin</artifactId>
        <version>0.5.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>1.8.2</version>
    </dependency>         
    ...

Note that the JIRA workflow integration needs Groovy 1.8 or higher to work properly.

You will also need an slf4j implementation, e.g. ‘slf4j-log4j12’ (if you are using Log4j) or ‘logback-classic’ (if you are using LogBack) (see here for more details). If you’re stuck, just add slf4j-simple:

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.1</version>
    </dependency>

In Thucydides, you can refer to a JIRA issue by placing a reference to the corresponding JIRA issue number either in the name of the test (using the @Title annotation, for example), or, more simply, by using the @Issue or @Issues annotation as shown here:

    @RunWith(ThucydidesRunner.class)
    public class SearchByKeywordStoryTest {

        @Managed(uniqueSession = true)
        public WebDriver webdriver;

        @ManagedPages(defaultUrl = "http://www.wikipedia.com")
        public Pages pages;

        @Steps
        public EndUserSteps endUser;

        @Issue("#WIKI-1")
        @Test
        public void searching_by_unambiguious_keyword_should_display_the_corresponding_article() {
            endUser.is_on_the_wikipedia_home_page();
            endUser.looks_up_cats();
            endUser.should_see_article_with_title("Cat - Wikipedia, the free encyclopedia");

        }
    }

In this example, the test will be associated with issue WIKI-1.

Alternatively, you may want to associate an issue (such as a story card) with all of the stories in a test case by placing the @Issue (or @Issues) annotation at the class level:

 
        @RunWith(ThucydidesRunner.class)
        @Issue("#WIKI-1")
        public class SearchByKeywordStoryTest {

            @Managed(uniqueSession = true)
            public WebDriver webdriver;
            
            @ManagedPages(defaultUrl = "http://www.wikipedia.com")
            public Pages pages;

            @Steps
            public EndUserSteps endUser;

            @Test
            public void searching_by_unambiguious_keyword_should_display_the_corresponding_article() {
                endUser.is_on_the_wikipedia_home_page();
                endUser.looks_up_cats();
                endUser.should_see_article_with_title("Cat - Wikipedia, the free encyclopedia");

            }
        }

Thucydides can use these annotations to integrate with the issues in JIRA. The most simple JIRA integration involves adding links to the corresponding JIRA issues in the Thucydides reports. To activate this, you simply need to provide the *jira.url* command line option. You do however need to pass this option to JUnit using the maven-surefire-plugin, as shown here:

 
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.10</version>
            <configuration>
                <argLine>-Xmx1024m</argLine>
                <systemPropertyVariables>                              
                    <jira.url>http://jira.acme.com</jira.url>                               
                </systemPropertyVariables>     
            </configuration>
        </plugin>
        ...

For tighter, round-trip integration you can also use thucydides-jira-plugin. This will not only include links to JIRA
in the Thucydides reports, but it will also update the corresponding JIRA issues with links to the corresponding
Story page in the Thucydides reports. To set this up, add the thucydides-jira-plugin dependency to your project
dependencies:

    <dependency>
        <groupId>net.thucydides.plugins.jira</groupId>
        <artifactId>thucydides-jira-plugin</artifactId>
        <version>0.5.4</version>
        <scope>test</scope>
    </dependency>    

You also need to provide a username and password to connect to JIRA, and the URL where your Thucydides reports will be published (for example, on your CI server). You do using by passing in the jira.username, jira.password and thucydides.public.url system parameters.

 
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.10</version>
            <configuration>
                <argLine>-Xmx1024m</argLine>
                <systemPropertyVariables>                              
                    <jira.url>http://jira.acme.com</jira.url>                               
                    <jira.username>${jira.demo.user}</jira.username>
                    <jira.password>${jira.demo.password}</jira.password>
                    <thucydides.public.url>http://localhost:9000</thucydides.public.url>
                </systemPropertyVariables>     
            </configuration>
        </plugin>
        ...

Thucydides also generates aggregate reports grouping results for stories and features. To include the JIRA links in these reports as well, you need to set the jiraUrl configuration option in the
maven-thucydides-plugin, as illustrated here:

        
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.0-beta-3</version>
        <configuration>
            <reportPlugins>
                <plugin>
                    <groupId>net.thucydides.maven.plugins</groupId>
                    <artifactId>maven-thucydides-plugin</artifactId>
                    <version>@project.version@</version>
                    <configuration>
                         <jiraUrl>http://jira.acme.com</jiraUrl>              
                     </configuration>
                 </plugin>
            </reportPlugins>
        </configuration>
    </plugin>         

If you do not want Thucydides to update the JIRA issues for a particular run (e.g. for testing or debugging purposes), you can also set thucydides.skip.jira.updates to true, e.g.

    $mvn verify -Dthucydides.skip.jira.updates=true

You can also configure the plugin to update the status of JIRA issues. This is deactivated by default: to use this
option, you need to set the thucydides.jira.workflow.active option to ‘true’, e.g.

 
    $mvn verify -Dthucydides.jira.workflow.active=true

The default configuration will work with the default JIRA workflow: open or in progress issues associated with successful tests will be resolved, and closed or resolved issues associated with failing tests will be reopened. If you are using a customized workflow, or want to modify the way the transitions work, you can write your own workflow configuration. Workflow configuration uses a simple Groovy DSL. The following is an example of the configuration file used for the default workflow:

 
    when 'Open', {
        'success' should: 'Resolve Issue'
    }

    when 'Reopened', {
        'success' should: 'Resolve Issue'
    }

    when 'Resolved', {
        'failure' should: 'Reopen Issue'
    }

    when 'In Progress', {
        'success' should: ['Stop Progress','Resolve Issue']
    }

    when 'Closed', {
        'failure' should: 'Reopen Issue'
    }

You can write your own configuration file and place it on the classpath of your test project (e.g. in the src/test/resources directory). Then you can override the default configuration by using the thucydides.jira.workflow property in the Maven pom.xml file or directly on the command line e.g.

 
    $mvn verify -Dthucydides.jira.workflow=my-workflow.groovy

Alternatively, you can simply create a file called <jira-workflow.groovy and place it somewhere on your classpath. Thucydides will then use this workflow. In both these cases, you don’t need to explicitly set the thucydides.jira.workflow.active property.

You can also integrate JIRA issues into your easyb Thucydides stories. When using the Thucydides easyb integration, you associate one or more issues with the easyb story as a whole, but not with the individual scenarios. You do this using the thucydides.tests_issue notation:

 
    using "thucydides"

    thucydides.uses_default_base_url "http://www.wikipedia.com"
    thucydides.uses_steps_from EndUserSteps
    thucydides.tests_story SearchByKeyword

    thucydides.tests_issue "#WIKI-2"

    scenario "Searching for cats", {
        given "the user is on the home page", {
            end_user.is_on_the_wikipedia_home_page()
        }
        when "the end user searches for 'cats'", {
            end_user.looks_up_cats()
        }
        then "they should see the corresponding article", {
           end_user.should_see_article_with_title("Cat - Wikipedia, the free encyclopedia")
        }
    }   

You can also associate several issues using thucydides.tests_issues:

                                 
    thucydides.tests_issue "#WIKI-2", "#WIKI-3"

To use easyb with Thucydides, you need to add the latest version of thucydides-easyb-plugin to your dependencies if it is not already there:

     
    <dependency>
        <groupId>net.thucydides.easyb</groupId>
        <artifactId>thucydides-easyb-plugin</artifactId>
        <version>0.4.15</version>
        <scope>test</scope>
    </dependency> 

As with JUnit, you will need to pass in the proper parameters to easyb for this to work. You will also need to be using the maven-easyb-plugin version 1.3 or higher, configured to pass in the JIRA parameters as shown here:

 
        <plugin>
        <groupId>org.easyb</groupId>
        <artifactId>maven-easyb-plugin</artifactId>
        <version>1.3</version>
        <executions>
            <execution>
                <goals>
                    <goal>test</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <storyType>html</storyType>
            <storyReport>target/easyb/easyb.html</storyReport>
            <easybTestDirectory>src/test/stories</easybTestDirectory>
            <parallel>true</parallel>
            <jvmArguments>
                <jira.url>http://jira.acme.com</jira.url>                               
                <jira.username>${jira.demo.user}</jira.username>
                <jira.password>${jira.demo.password}</jira.password>
                <thucydides.public.url>http://localhost:9000</thucydides.public.url>
            </systemPropertyVariables>     
            </jvmArguments>
        </configuration>
    </plugin> 

Once this is done, Thucydides will update the relevant JIRA issues automatically whenever the tests are executed.

5
Oct

Thucydides Release 0.4.11 – Jira Project Definition


Thucydides version 0.4.11 is now released and available in all of the Maven repositories.  This version
adds the ability to define the jira project, allowing for jira integration to be even easier.  Now the user
only needs to specify the project within the pom file, and the jira number within the @Issue and
@Issues annotations (e.g. ‘@Issue(“#1234”)’) in the unit test class.

The jira project needs to be defined within the Surefire plugin for it to be used within the unit tests.
e.g.

<properties>
    <jira.url>http://my.jira.server&lt;/jira.url>
    <jira.project>MYPROJECT</jira.project>
</properties>
...
<build>
 <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.7.1</version>
    <configuration>
        <includes>
            <include>**/Sample*.java</include>
            <include>**/*Test.java</include>
        </includes>
        <systemPropertyVariables>
            <jira.url>${jira.url}</jira.url>
         <jira.project>${jira.project}</jira.project>
        </systemPropertyVariables>
    </configuration>
   </plugin>
   ...

You also need to provide this to the Thucydides Maven report for the aggregation:

<plugin>
    <groupId>net.thucydides.maven.plugins</groupId>
    <artifactId>maven-thucydides-plugin</artifactId>
    <version>@project.version@</version>
    <configuration>
        <jiraUrl>${jira.url}</jiraUrl>
        <jiraProject>${jira.project}</jiraProject>
    </configuration>
</plugin>

@Issue annotation is used when there is only 1 jira card associated to a unit
test class or scenario, and @Issues is used when multiple jira cards are
associated with a unit test class or a scenario.

Example 1:
Here is an example of using @Issue for when there are multiple cards associated
to the unit test class, and the user wants to specify which of those scenarios
are associated to each scenario. All of the associated jira links will be
automatically associated to the unit test class. 

public class MarketingFeeControlStory
{
....
    	@Test
        @Issue("#3754")
	public void when_a_fixed_amount_is_selected_then_text_box_is_enabled()
	{
		...
	}

	@Test
        @Issue("#3754")
	public void when_none_is_selected_then_the_text_box_should_be_disabled()
	{
		...
	}

	@Test
        @Issue("#3111")
	public void when_at_cost_is_selected_then_the_text_box_should_be_disabled()
	{
               ...
	}

	@Test
        @Issue("#2789")
	public void when_at_cost_is_selected_and_text_box_is_disabled_and_fixed_amount_is_selected_then_text_box_should_be_enabled()
	{
		...
	}
....
}

The report with jira integration will look something like this…

Example 2:
Here is an example of using @Issue to associate a jira card to all
the scenarios by defining the associate jira card at the class level.
Each scenarios within the story will automatically be associated to the
jira card.

@Issue("#3754")
public class MarketingFeeControlStory
{
....
    	@Test 
	public void when_a_fixed_amount_is_selected_then_text_box_is_enabled()
	{
		...
	}

	@Test
	public void when_none_is_selected_then_the_text_box_should_be_disabled()
	{
		...
	}

	@Test
	public void when_at_cost_is_selected_then_the_text_box_should_be_disabled()
	{
                ...
	}
....
}

The report with jira integration will look something like this…


Example 3:

Here is an example of using @Issues to associate jira cards to a
scenario by defining the associate jira cards at the scenario level.
The unit test class will automatically be associated to the jira cards.

public class MarketingFeeControlStory
{
....
    	@Test 
        @Issues({"#3754", "#1211"})
      	public void when_a_fixed_amount_is_selected_then_text_box_is_enabled()
	{
		...
	}
	@Test
	public void when_none_is_selected_then_the_text_box_should_be_disabled()
	{
		...
	}

	@Test
	public void when_at_cost_is_selected_then_the_text_box_should_be_disabled()
	{
               ...
	}
....
}

The report with jira integration will look something like this…

28
Sep

Thucydides Release 0.4.9 – improved issue tracking and JIRA integration


A new version of Thucydides – version 0.4.9 – is now available in the Maven repositories. This release provides support for the new Selenium 2.6 ExpectedConditions (see here for details), and also focuses on new features for integration with your issue tracking system. Read more »