Sep 5 2007

Check out when YOU want it too

Category: Tips and TricksJoeGeeky @ 12:21

For those of you who use TFS, you know that sometimes source files get checked out in your name even though; to your knowledge; you never actually made any changes or even selected save.  If you do not pay attention to the pending checkouts panel you may not notice it until you get a call from your Source Manager or another frustrated or suspicious developer.  As it turns out, this is a configurable behaviour and the default is to auto checkout source when either you or Visual Studio edits or saves any files under source control.  If you want to change this behaviour; and I suggest you do; just enter open the Visual Studio properties and select the option that best suits your preferred behaviour.  See the image below for a sample.


Jun 3 2007

Capture Images Directly into a TFS Work Item

Category: Cool ProductsJoeGeeky @ 12:18

These two tools are pretty neat, I cannot tell you how many times I have gone through the process of capturing images and attaching them to TFS Work Items…  These two tools have taken a step closer to making this easier...  One is Free and one is based on a cost product…  I did not write these, but enjoy them all the same.

Open Source Cropper Plug-in for TFS

SnagIt Output for Microsoft Visual Studio Team System


If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.


May 27 2007

Create TFS Work Items Using Outlook 2007

Category: Cool ProductsJoeGeeky @ 18:23

If you have every read through the SSW Rules to Better... you can see how may people live within Outlook.  In fact, there was a really interesting DotNetRocks Show that spoke with one of the SSW authors, and it is worth a listen.  Recently, I found a neat Outlook 2007 plugin that lets me add TFS Work Items from within Outlook and saves me the time of entering Team Explorer.  I have been using it for a little while and it is pretty nice...  That being said, this product requires use of integrated Windows Domain credentials and does not work for people making Workgroup-style connections.

Team System Outlook 2007 Addin - v1.0

If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.


May 26 2007

Manage TFS Source From the Windows Shell

Category: Cool ProductsJoeGeeky @ 12:36

I ran across the below blog entry and was really excited...  Back in the days when we all dreaded Visual Source Safe (VSS), many of us used open source products like CVS and SVN.  One of the great tools that grew out of this community was a Source Control Client that was implemented as a Windows Shell Extension. TortoiseCVS and TortoiseSVN, are really easy to use Revision, Version, and Source control software. Until now there was no similar solution for TFS-based source control.  Dubbelbock TFS is the first project to attempt to bring a shell integrated experience to TFS users. 

Benjamin Day Consulting Blog Entry

Since it's not an integration for a specific IDE you can use it with whatever development tools you like. TortoiseSVN is free to use. You don't need to get a loan or pay a full years salary to use it. Ever heard of Tortoise SVN?  It's a great tool that lets you control Subversion source control from Windows Explorer.  Right-click on a file or folder and you can do operations like check-in, check-out, add, etc.

I use Team Foundation Server for my source control and have missed the convenience of being able to access source like that.  So, I wrote it. 

This is the official announcement of “Dubbelbock TFS“.  With Dubbelbock you can select a directory or file and do “Get Latest“, “Check in“, “Check out“, “Lock“, “Add“, “Undo“, “View Status“, “Compare to Server Version (diff)“, and “View History“.

If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.


May 23 2007

TFS Work Item Vista Gadgets

Category: Cool ProductsJoeGeeky @ 23:56

For those of you who use Team Systems here a couple of Vista Gadgets to help keep you update to date on Work Item Numbers.  Ostensibly, these are targeting the out-of-the-box Microsoft Process Template.  I am using the Conchango SCRUM Process Template so these are not 100% for the SCRUM process template.  Enjoy 

TFS Tasks 

TFS Projects

If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.


May 2 2007

How to make unit tests transactional in TFS

Category: Selfish MotivationJoeGeeky @ 17:01

At some point, all good developers make the realization that Unit Testing is not evil and is the best way to ensure your code works as you expect it to. With that said, the moment you start writing tests for methods that interact with a database you start to run into some really unique problems that can lead to a lot of unneeded code. 

Generally speaking you always want to leave the system as you found it when testing started. That means that any data you add/edit/delete during the test needs to be restored when the test has concluded.  For the longest time I would spend my time writing test rigs to manage all these functions for each data method being tested.  It didn't take me long to realize that this was a waste of time and that there had to be a way to make this easier.

With that in mind  I set out to make my unit tests transactional since transactions have rollback support. Stealing a trick from the COM world I was able to find a way to make my test transactional. Here is what you need to do. As I go though this, keep in mind that I am using TFS Unit Tests run against a Microsoft SQL Server. This same technique can be used with other technologies (Ex. NUnit) although the syntax will be different.

One last note... If you look at the line "config.TransactionTimeout = 900", this may seem like a really long time. This is set to this length to ensure you have plenty of time to step through code during tests. Adjust this as needed.

Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports System
Imports System.Configuration
Imports System.EnterpriseServices

''' <summary>
''' Abstract class defining a transactional baseline for database driven unit tests
''' </summary>
<TestClass()> _
Public MustInherit Class DatabaseTransactionTestClass
    ''' <summary>
    ''' Hold a defined in progress transaction
    ''' </summary>
    Private TestTransactionScope As TransactionScope
    ''' <summary>
    ''' Init method to setup transaction requirements
    ''' </summary>
    <ClassInitialize()> _
    Public Shared Sub TransactionSetup(ByVal testContext As TestContext)
        Dim config As ServiceConfig = New ServiceConfig()
        config.Transaction = TransactionOption.RequiresNew
        config.TransactionTimeout = 900
        config.IsolationLevel = TransactionIsolationLevel.RepeatableRead
    End Sub
    ''' <summary>
    ''' Cleanup method to roll-back all database changes
    ''' </summary>
    <ClassCleanup()> _
    Public Shared Sub TransactionTearDown()
    End Sub
    ''' <summary>
    ''' Init method to define the start of a transaction on a per-test basis 
    ''' </summary>
    <TestInitialize()> _
    Public Sub TestSetup()
        TestTransactionScope = New TransactionScope
    End Sub
    ''' <summary>
    ''' Cleanup method to close and abort the transaction
    ''' </summary>
    <TestCleanup()> _
    Public Sub TestCleanup()
        If Not TestTransactionScope Is Nothing Then
        End If
    End Sub
    ''' <summary>
    ''' Rolls back and existing test level transactions as defined by the TestTransactionScope
    ''' </summary>
    Public Shared Sub RollbackTransaction()
        If ContextUtil.IsInTransaction Then
        End If
    End Sub
End Class

Tags: ,

Apr 15 2007

Reusable Test Rigs are your friend

Category: Selfish MotivationJoeGeeky @ 06:10

I am not really sure how many unit tests I have written in my life, but on my current project I have written more then a 1000 over that last few months. One of the things I learned a long time ago is that code should only be written when it needs to because you usually need to time to do more important things, like working with customers, designing your product, architectural planning, and most importantly being with your family. One practice that can really speed things along is to write a common, reusable, late-bound, test rig. Think about it... How many times have you written a property test to see if you are setting a String value correctly, a Boolean flag, Enum, Date, etc... Honestly, how many times do you really need to write that code?

Click below to see some simple examples of reusable test rigs for thigs like string, boolean, enum, and object test rigs

samplegenerictestrigs.htm (20.75 kb)

When you are designing your test rigs keep the following in mind

  • Keep things as generic and reusable as possible
  • Consider using a late-bound approach which can provide a lot of flexibility
  • Reflect, Reflect, Reflect...  Reflection technologies can really help you write code that can adapt to the objects being passed to the rigs.

Once you have your test rigs you will find that for common testing tasks, your tests will become a lot shorter and easier to write.

    '''A test for UserAgent()
    <TestMethod()> _
    Public Sub UserAgentTest()
        Dim target As NewMyClass
        GenericTestRigs.GenericStringPropertyTest(target, "UserAgent", "123", "", True)
    End Sub

As a side note, for those of you implementing CSLA-like architectures this will also allow your to encapsulate richer testing threshholds like management of overall object state, dirty flags, etc...

Tags: ,

Jan 5 2007

Capture Bug Details and Screen Captures Directly into TFS Work Items from IE

Category: Cool ProductsJoeGeeky @ 01:16

I recently had one of those head-knocking V8 moments.  I ran across a great little open source tool that captures Bug details and screen captures directly into TFS Work Items from IE.  This is a simple idea that has a lot of tremendous benefits.  If you are a web product tester working in a TFS environment then you really need this. As stated on this Source page...

IEeee is an addin to Internet Explorer to easily allow testers / developers to raise a bug against the currently loaded page. The bug report will be automatically generated to include all the information a developer needs to reproduce and resolve the problem, including:

  • A screenshot
  • HTML source of the page and any frames and IFrames
  • Any style sheets referenced by the page
  • Any script files referenced by the page
  • Details about the user's machine and browser (OS version, browser version, screen size, ...)

If you want to see a list of other cool TFS tools, look at my TFS Tag or Checkout the Accentient TFS Widget list which I contribute to.