Tests and issue trackers – how to manage the integration

In highly disciplined teams when a bug is discovered the following happens:

  • test (or most likely a set of tests) is written that fails exposing the bug
  • a ticket in issue tracking system is created
  • a developer fixes the bug, runs all the tests including the new ones and if everything is green, the ticket is resolved

 

My question is what if some time later (say several weeks after) a developer wants to find which issue relates to the tests he’s looking at, or which tests were documenting the bug he’s looking at. How do you manage the link between the tests and issues in your tracker?

Solution one – file per ticket

Quite common solution to this problem is to have a special folder in your test project and for each ticket have a file named after the ticket’s ID like this:

folder

That works and is quite easy to discover. However the downside of this solution is that it introduces fragmentation. If a bug was found in a shipping module does it really make sense to keep some tests for shipping module in ShippingModuleTests class and some other in CRM_4 class merely because the latter ones were discovered by a tester and not original developer?

Solution two – ticket id in method name

To alleviate that another solution is often used. The tests end up in ShippingModuleTests bug the id of the issue is encoded in the name of the test method. like this:

[Test]
public void CRM_4_Gold_preferred_customer_should_have_his_bonus_applied_to_net_price()
{
   //some logic here
}
 
[Test]
public void CRM_4_Silver_preferred_customer_should_have_his_bonus_applied_to_net_price()
{
   //some logic here
}

That’s a step in the right direction. It makes the link explicit and you can quickly navigate the relation either direction. However I don’t like it very much, because most of the time I couldn’t care less about the fact that this test documents a long fixed bug. Yet I am constantly reminded about it every time I run my tests.

tests

Solution three – description

The solution I found myself using the most recently is to leverage the description most testing frameworks let you associate with your tests.

[Test(Description = "CRM_4")]
public void Gold_preferred_customer_should_have_his_bonus_applied_to_net_price()
{
   //some logic here
}
 
[Test(Description = "CRM_4")]
public void Silver_preferred_customer_should_have_his_bonus_applied_to_net_price()
{
   //some logic here
}

 

 

This still makes the association explicit and searchable, but doesn’t remind me of it constantly where I don’t care.

tests2

What about you? What approach do you employ to manage that?


Posted 03-01-2011 5:54 AM by Krzysztof Koźmic

[Advertisement]

Comments

zdeslav wrote re: Tests and issue trackers – how to manage the integration
on 03-01-2011 3:39 AM

I have a custom attribute, like this:

[Test]

[Issue(123456)] // or [Issue("some description")]

public void Bla..

this is nicely integrated into build toolset

Yann Trevin wrote re: Tests and issue trackers – how to manage the integration
on 03-01-2011 6:46 AM

The 3rd solution is clearly better. But as zdeslav has suggested already, some testing frameworks let you define (or at least let you create) more specialized metadata attributes to hold that sort of info. An IssueAttribute or CrmAttribute is probably the best solution.

Matt wrote re: Tests and issue trackers – how to manage the integration
on 03-01-2011 6:30 PM

The Jenkins/Hudson team has a @Bug attribute which is comparable to what @zdeslav described.  wiki.hudson-ci.org/.../Unit+Test

frantisek wrote re: Tests and issue trackers – how to manage the integration
on 03-15-2011 11:00 AM

We run on TFS with SCRUM template and each changeset (set of the changes we made to the code) is connected to the workitem which is in this case a BUG with it's full description.  

TFS supports searching in bugs, annotations of the code so you can see the changesets applied to the code.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)