Geeks With Blogs

News View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn
Michael Stephenson keeping your feet on premise while your heads in the cloud

Problem

We have been having a little bit of a problem recently on one of our projects.  The symptoms were a little inconsistent and difficult to get your head around but it was something like this.

Application Description: We have an integration project which exposes a web service which allows a client to pass a message which is then pushed to the database of a 3rd party system.

Testing Info: We are using BizUnit to test this process.  We do not own the database it is hosted for us by the team who maintain the external system.  In addition to adding our message we also have permission to remove the messages by the given identifier for the message to clean up after each test.  We can also search that our message is in the database.  The test steps are as follows:

1. Check message id not in database

2. Call BizTalk

3. Check message id in database

4. Remove message from database by id

In theory this should all work fine, and on the development machines it has been good.  We were having some problems on the build server however.  We kept getting indicated that there was a unique constraint violation. 

As a work around i had arranged to clear the whole table before each test but i was still getting this issue but only on the build server.

Cause

I think the real cause of this is that the messages have some duplicate data in them, but my assumption was that by removing the message after the test the next test would be fine.

What i actually found when watching what was happening with DebugView monitoring the trace is that the tests werent running sequentially. And test 2 was trying to add a message with a duplicate key before test 1 had finished and cleaned up.

Solution

What i have done is to use the ordered test feature within the Visual Studio Team Test projects.  I will create an ordered test containing the tests i want to run sequentially and this will resolve the problem.  There are a couple of things to note however:

1. I have moved my ordered tests to a different project as when i run them in my build from the command line i will specify the testcontainer to be the ordered test file rather than the assembly path.  I need them in a different project as there are other tests which still need to run and dont need to be sequentially.

 

 

Posted on Friday, June 29, 2007 10:38 PM BizTalk | Back to top


Comments on this post: BizUnit Tests - Ordered Tests

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Stephenson | Powered by: GeeksWithBlogs.net