Tag | Unit Testing Posts

For the past couple of years, the Model View Presenter pattern has gotten a lot of attention on the .NET platform and more in particular to ASP.NET. For a thorough introduction on MVP with ASP.NET, read the article on CodeProject by Billy McCafferty. Recently, it has come to play that many now favor the Model View Controller (MVC) pattern over MVP. If you're confused about the differences between the two, check out this post which will explain it well. The basic gist is that the MVP pattern gives ...
I've been playing around with mock objects using Rhino.Mocks for the last few months, but today was the first time that I had an unfettered coding win and became a true convert. I was introduced to NUnit about five years ago from a co-worker (thanks Dewayne) and gradually became a true believer. Unfortunately, I was a late-bloomer in the area of mocking, so by the time I finished my last big project I had left a suite of about 500 database driven tests that took almost 2 hours to run and were a maintenance ...
The Rockville .NET User Group (ROCKNUG) will hold it's meeting on 12/12 from 6:30-9PM. This month will cover MbUnit, a favorite tool of mine, by Jay Flowers. Listed below are the details: Release 1.6 Wednesday, December 12, 2007 6:30-9:00 PM Montgomery College, Rockville Humanities Building - Room 103 MbUnit by Jay Flowers In this talk Jay will introduce you to some advanced unit testing techniques. MbUnit offers easy ways to create parameterized unit tests. He will explorer fixtures like the RowTest ...
Behavior Driven Development (BDD) has been a big interest of mine lately and the way I tackle software design and development. If you're looking for a good introduction as to what it is, follow the links plus a good introduction from Dan North and one from Tom Adams. Just in case you've been living under a rock or off on some distant planet, you may ask, "Well, what is it?". Well, in a way, it inherits from Test Driven Development and Domain Driven Design. TDD had a failing by just performing tests ...
Lately a lot of my work has focused on BizTalk for some custom solutions. I'm a big fan of BizUnit as a unit testing tool for BizTalk, as it is pretty much the only option. But, what happens when you call custom components (dlls) through Expression or Message Assignment Shapes? Take for example this custom code snippet public class OrchestrationHelper { public static void ProcessDocument(XLANGMessage bizTalkMessage) { Stream bizTalkStream = (Stream)bizTalkMessage[0].R... // ...
Earlier Jeff Brown posted some comments on some new features of MbUnit v3, which I responded to by how to answer the NUnit critics concerning isolation of test fixtures. Jeff responded with what I think is a pretty good answer. I'll have to think it through for a bit. I believe that my original question was not so much a question of the validity of the approaches, but that after reading the book, I found that I had not considered the original issue of isolation via new test fixture classes. I started ...
We had a practice which included unit testing for a while now, but it entailed Nunit and MBunit with various build frameworks such as CruiseControl and VisualBuilder. We are running VS2005, and wanted to include running the tests on developer boxes as part of a build, so that failed tests will flunk the build. Using a post build event, this is easily done: In the Post Build Events, enter: CD $(TargetDir) "$(DevEnvDir)MSTEST.exe" /testcontainer:$(TargetFile... The quotes around the MSTEST full path ...
Some time ago I posted my Unit Testing ASP.NET Applications notes. This post is to put togeter a few links that I found useful about general Unit testing frameworks. MbUnit vs. NUnit Vs. Team System Unit Testing - Choosing a unit test framework NUnit vs Team System Unit Test In our solutions we are using both NUnit and VSTS Unit testing. I like VSTS for the ability to generate test stubs code. But our build server has only VS Professional installed, that doesn't allow to include VSTS projects to ...
Here's another problem I had when trying to get the Microsoft Enterprise Library - exception logging working. The following error was caused because I did not add references to all the assemblies used. MyApp.UnitTests.BuildHelper... : Microsoft.Practices.Enterpr... : The type 'Microsoft.Practices.Enterp... Microsoft.Practices.Enterpr... ...
I have quite complicated class and I wanted during debugging/testing to validate that the data in the class is consistent. So I created a method Validate and used it in unit testing class MyComplexClass oClass= MyComplexClass.CreateClass(); Assert.IsTrue(Validate(oCla... But then I understood, that it would be better to call this function in the code to ensure that validation happens in the application, not only in unit testing. So I've added Validate method to the end of my CreateClass() method ...
Recently, I completed a project for a video game prototype course that involved pathfinding. With Flash Player 9's speed gains over Flash Player 8, I thought Flash would be a good medium to demonstrate pathfinding in an online setting. If you've never heard of Test Driven Development (TDD), it is a programming practice whereby the programmer writes tests for objects in his program before writing a single line of code. He writes his tests based on his expectations of how the objects should behave. ...
Thanks to Andrew Stopford and everyone else who works on MbUnit development. MbUnit 2.4 was just released. If you are not unit testing or practicing TDD in your projects, I don't know how you could choose plain old NUnit over MbUnit. If you are using regular NUnit it is very simple to convert your projects MbUnit, they use the same [Test] attribute. MbUnit has: Row Testing: [RowTest] [Row("Hello")] [Row("Goodbye")] public void TestString( string myString ) { // do your tests in here... }More row ...
I have been working on a CSLA project for the last few months. We are working on refining our unit testing now that we have implemented our authorization rules. All good. We are working VS2005. Honestly, I like CSLA in many ways, but there are few gotchas we've seen along the way. This post outlines one of them. However, we noticed something today. We establish our starting conditions in our ClassIinitalize in the TestClass. When we have only one TestMethod in the class, this works fine. We recently ...
After waiting several months now, I finally got my hands on this new book. The author has a nice blog on game development and he has created a series of videos on game development in directx where he created the rocket commander game. I'm hoping that Benjamin can create the videos on how he created the rocket commander game with XNA. One bonus for this book is that it's not just about coding games using XNA. The author adds input to his own experiences on creating games and emphasizes making a plan ...
Here's the culmination of my research into CI Factory and how I'm not using it to develop my open source RapidDB libraries. This is a fairly personal setup, as it only has a single developer (me), two development machines (currently an office desktop PC and a roaming laptop) and a build server which is not publicly accessible via the Internet. An MSDN and Microsoft Partner Action Pack subscription are busy covering my software license requirements. Summary: Development PC 1 : Desktop, XP Pro SP2, ...
Pragmatic Unit Testing in C# with Nunit I'm currently reading this book (just finished the 3rd Chapter) and it's been fantastic so far. Although, I practice Unit Testing in my code but a lot of things that I void (till date) to do (e.g writing tests that must fail). Clearly, this book is for any C#/ASP.Net developer who wants to know things about and around Unit Testing. I still don't know how this book deals with Unit Testing of ASP.Net but will update later... It's a must for your book-shelf if ...
I've recently been involved with a project that involves a BizTalk 2006 application. I've been focusing most of my time on improving the testing infrastructure, and trying to automate alot of the deployment and configuration tasks with the goal of getting to the point where we can setup a Continuous Integration environment. I'm happy to say that I think we're pretty much there, but not without having to overcome some hurdles along the way. This is my first encounter with BizTalk and it was a great ...
I try to maintain 100% code coverage in my non-UI classes, especially my state objects that just hold data. I recently ran into a situation that I'm having trouble writing an automated test for. We have a ContactInformation class that holds information about how to contact a person (home phone, cell phone, email), and in that class I have a .SendEmail and .VisitWebSite methods: public void SendEmail() { if (!string.IsNullOrEmpty(_ema... { System.Diagnostics.Process.... ...
Test Driven .NET (the famous tool that helps integrate most common unit testing frameworks into Visual Studio) has a new release, 2.4. It's still a BETA though. You can read the official announcement for the release, as well as the release notes, or just get it downloaded. Personal Notes on the release: It supports NUnit 2.2 and 2.4 RC2. It supports Orcas (that's in the installer, I haven't tried myself) - since 2.2 Supports Reflector 5 - since 2.2. If you're new to Test Driven .NET (or never heard ...
Chris Burrows has an illustrated post on how to setup TFS to support Continuous Integration, Automated Unit Testing, and Automatic deployment. Link: http://blogs.madtechnology.... Technorati tags: TFS, CI, Continuous Integraion, Unit Testing, Automated Deployment Cross-posted from tariqayad.com ...
Hello everyone, I've decided to conduct a Full day workshop on VSTS/TFS on Saturday March 24th. We will cover a lot of things ranging form sizing and installation to source control practices all the way to unit testing and performance. It should be a very cool day. If you live in Montreal (or around) and would like to join us in that experience please follow this link for all the information. I will animate in French but if we have questions in English there shouldn't we'll be more than happy to ...
We are approaching the registration limit of 600 so get registered now! Info: http://codecamp.fladotnet.com Register: https://www.clicktoattend.c... Sessions: .NET Reflective and Adaptive Programming :: 20 Tips Every Developer Should Know About The CLR :: Using 3rd Party tools with CSLA :: Active Reports :: Advanced Code Generation using CodeSmith 4.0 :: Agile Development for Microsoft Technologists :: Amazon Elastic Compute Cloud :: Amazon Simple Storage Service :: The ...
I believe in having 3 layers of testing: Unit Tests, Acceptance Tests, and Exploratory Testing. Each of these layers is somewhat independent of the other and each layer alone essentially attempts to validate that the entire system works. However, none of these layers alone is perfect, but having all 3 in place simultaneously makes the situation much better. Unit TestsUnit tests are the tests that the programmer writes as he develops the software. We develop using TDD and the unit tests are automatically ...
OK let me preface this by saying by and large, I’m actually a pretty big fan of Visual Studio Team System. One of the things I don’t like is the breakdown of functionality between the different SKU’s of Team Edition. Case in point… Our current environment has a separate build server. When we got to the point where we wanted to run unit tests as part of the built process, our QA guy had to install the Tester edition on the build server in order for it to run…that was a few weeks back and now we’re ...
There has been a lot of “buzz” around Ruby on Rails for a while now. I have been following it since it hit the street. I have to admit I have not done much with Rails except for reading and dreaming about it, but I hope to work with it someday. However, in the back of my mind, I always wondered if I could build a real world application using this framework. Now a day, everyone is building so called “Enterprise” (What is enterprise anyways?) applications. If I use Rails, can ...
Name: More logging than a lumberjack Description: On one project our team inherited a BizTalk solution which had a lot of logging in it. I feel that with both BizTalk and also standard .net projects when you see code with excessive logging in it is because the developer needed all of this information to be able to write the code and know what is happening. This logging usually masks the fact that the code was very buggy during development and also probably has no unit tests or has very low code ...
Been working with, and did quite a few demos during my short stint with Microsoft, VS 2005 Db Pro. The tool is Microsoft's 1st real entry into bringing the Database team into the Visual Studio experience. So, if anyone believes that DB Projects in VS as they exist prior to DB Pro were real tools, I'm suggesting you take a look at this immediately. The tool takes advantage of Per User Instancing of SQL Express in the design time part of using the Tool. So, all validation is done direct against a working ...
As a developer I use a lot of additional tools to get my work done in the most efficient and accurate way possible. That involves a lot of things, such as unit testing, code analysis and additional productivity inside the Visual Studio 2005 IDE. I have seen a lot of blog posts extolling the virtues of one tool or another, but there were not many (at least that I could find) that provided a semi-comprehensive list. (I say "semi-comprehensive" because there is always going to be a new tool available ...
The folks at TypeMock have written a page on how TypeMock makes your unit testing easier and more reliable. Mock objects help when unit testing code that has dependencies (often external) that make SetUp/TearDown difficult. Like the rest of XP (Agile), mocking is something you're probably going to have to "sell" to the decision makers. Print out this article and give it to them. Even if they don't go with TypeMock, at least they'll understand the reasoning behind mocks ...
I have recently received an inquiry from a client that wants to migrate his NUnit test to VSTS. They had heard that VSTS unit tests performed worse than NUnit. My answer (some info comes from MSFT): It is true that running a set of empty tests using NUnit is faster than running them using VSTS (about 20% faster), but if these tests are not empty and have something in them, then this difference reduces. Performance using VSTS will be best if you run the tests from the command line and using the /noisolation ...
On November 9th the Greater Charleston .NET User Group is hosting my good friend Theo Moore who will be speaking to the group about Unit Testing in Visual Studio Team System. Some of you may remeber Theo from both of the South Carolina Code Camps. Theo also recently won a stupid prize ;) Go Theo! Location of Meetings: Starts at 6PM - Blackbaud, on Daniel's Island, South Carolina. Check out this link to find out how to get there. Directions to the meeting ...
This is my week for information about unit testing against databases, apparently. MassDataHandler is available from CodePlex: The MassDataHandler is a framework to assist with Database Unit Testing. The framework makes it very easy to insert test data into a database, which in turn makes it very easy to write database unit tests. The user merely needs to specify their relevant data in a simple XML fragment, and then the framework uses knowledge of the database schema to do all the grunt work and ...
A couple of months ago, two to be exactly, I finished reading the book "Test-Driven Development in Microsoft.NET". This book was first published by Microsoft Press early 2004 which is immediatly the biggest con of the book. The authors James W. Newkirk and Alexei A. Vorontsov did a great job explaining the basics of TDD (and I expected a lot more on TDD <disappointed/>), Refactoring, the NUnit framework, the difference between Programmer and Customer Tests (using the FIT framework) ...
Team Foundation Server does not have Continuous Integration (C.I.) facility out of the box. I believe this will be incorporated in a future release. In the meantime, we have successfully implemented Continuous Integration using TFS Integrator coupled with Team Build (MSBUILD) and Automated Unit Testing in VSTS. We are running TFS in a single server installation and Team Build is running on a separate machine. Details of TFS Integrator can be found at Mitch Denny's Blog. For those wanting to know ...
BizUnit is a unit testing framework for BizTalk. This post will demonstrate how to test any schema you create using BizUnit to help you do this. Problem So the problem is that you have a schema which may change over time and you want to ensure it will always validate messages as you expect. In BizTalk you have a context menu which allows you to validate this schema and also validate instances of messages against the schema. The problem however is you want to do this as part of your unit tests so ...
last week my project manager asked me to do training for our colleagues on Unit testing with Nunit. So I thought better to use VS 2005 with new inbuilt unit testing capabilities. I had installed VS Professional edition and I knew that Unit testing is not coming with that edition. I knew that we have VS team edition for architects also and I installed it. But after I installed it I couldn’t found built-in unit testing there. I thought this may be an installation problem or I haven’t to configure VS ...
Scott Sehlhorst has another good blog post on Functional Testing over at Tyner Blain. Actually, this is part of a larger Foundation Series which is all good. Anyway, in this post, he covers what’s right and wrong with both unit testing and functional (system) testing, and how to get the most out of each. Highly worth a read. ...
This article provides a nice introduction to Test-Driven Development (TDD) and a fair assesment of its advantages and disadvantages: http://www.developer.com/de... It also included this nice little reference list of unit testing tools available for different programming languages: C++ cppUnit .Net csUnit C CUnit Borland Delphi DUnitDelphi JUnit extension for database projects DBUnit Java JUnit .Net library for database projects NDbUnit Oracle Unit Tester OUnit PHP PHPUnit Python ...
Friday night, my presentation congealed into garbage. This was not a good thing. I had to skip Jeff Levinson's “Test Driven Development with Team System” in order to work on my presentation. I was competing with “Poker Bots for Fun and Profit”, with Jeff Berkowitz, Stuart Celariar's “Understanding Subversion“, Rory's “An introduction to WCF for the complete beginner“and 4 others. There was a part of me that was hoping that no one would show up, because ...
I don't know about you, but I have an attention span that is about 20 minutes long. If I can get your sample working, doing something (anything) in the first 20 minutes, I may be playing with it when the sun comes up. You just have to capture my attention QUICKLY. In that light, I wanted to post a utility that I wrote to make unit testing mo-bedda (read : easier) This consists of the class, and the unit tests to exercise the class. If all goes correctly, you should be able to copy these into new ...
For the past year or so, Martin Fowler has included the pattern Model-View-Presenter, or MVP, in his upcoming addendum to Patterns of Enterprise Application Development. Due to apparent confusions between MVC and MVP, Fowler has now split this pattern into what he's calling “Passive View” (http://martinfowler.com/ea... and “Supervising Controller/Presenter” (http://martinfowler.com/ea... (Now what am I to do! ;) Passive View ...
I was reading a post on Rob Caron's blog where he links to a few posts by Sachin Rekhi (a program manager from the Data Dude team). There are a number of posts about how the new database unit testing features work, and he walks you through implementing a database unit test. My opinion is that the database unit testing functionality isn't very valuable as it stands today. It appears targetted to allow you to test a very limited set of conditions: the row count, a scalar value returned, a empty/non-empty ...
So on a lark, I threw my hat into the ring for Portland Code Camp 2.0, I didn't expect to get accepted, there were already a few sessions on unit testing and nunit but I figured, what the heck, let's gear it for beginners, and do it in VB.Net. Now I'm in the process of getting ready and I figured I should blog about things and or techniques as they came up. For my first trick, testing a private method. First rule of thumb: Don't do this. No really, Don't. You are locking the internals of your code ...
I found a little light reading entitled "Java Succumbing to .NET in my Organization" by Neil Chaudhuri in which a local Federal Government contractor is moving towards .NET. If you really want to hear arguments on both sides of the aisle, this is it! Talk about light reading... As for me, I prefer .NET technologies which is why I'm starting with Microsoft in about a week. I make no qualms about being an advocate for Microsoft products including .NET, BizTalk, SharePoint, etc. I've done both and I ...
I was poking through Jason Haley's blog today when I came across one of his interesting links (which are usually pretty interesting btw). It pointed to a post by Phillip Haack titled A Testing Mail Server for Unit Testing Email Functionality. I generally enjoy reading about other’s unit testing experiences as I often gain quite a bit of perspective (and get to see a lot of problems I may not otherwise get to see). Basically what he has done is taken an open source SMTP server and used it for ...
We all are familiar with the layered architecture which represents the different layers of the application. Most of the application consists of the 3 layer architecture which includes Presentation Layer, Business Layer and the Data Access Layer. Since, Unit Testing is extremely beneficial for the developement of the application I think it should be considered a layer. This means that along with the 3 layer there should be one more layer added to the application which will be known as the Unit Testing ...
Date:Wednesday, May 24, 2006 Topic:Unit Testing in VB.NET Speaker:Dave Lloyd, ObjectSharp Consulting Dave Lloyd from ObjectSharp Consulting will cover Unit Testing with VB.Net. Whether you are using VS 2005 Team System or a previous version of Visual Studio .net. Dave will show you how to implement unit tests so you can regression test your code and make changes with confidence. NUnit – See NUnit added to a test project and learn how to execute the Nunit GUI right from Visual Studio, Dave will ...
Okay, let's chat a bit about class design and the pattern I will be using in Spaceballs. I will be using an in-memory, message-driven architecture. Messages will be the nervous system of the game engine. Nearly all communication will take place through messages. The "brain" of this nervous system is the MessageProcessor. The MessageProcessor is responsible for broadcasting a message to all listeners that are interested in listening to that type of message. But how does the MessageProcessor know which ...
Seeing that George is so willing to be open about his plans and progress, I've decided to follow you suit. After all, this should make it more enjoyable for you readers out there (is there anybody out there?). So, on to a progress report, shall we? In order to help manage the scope of this project due to the time frame, I have decided that Spaceballs will be a 2d game instead of 3d. This should simplify many aspects of the coding by minimizing the sheer amount of code that needs to be written. The ...