Skip to content

October 5, 2011

Thucydides Release 0.4.11 – Jira Project Definition

by lvendramini

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…

Advertisements
Read more from Releases, Tips and Tricks

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: