Josh’s Magical Unit Tester

Josh has just released a new unit testing library onto CodePlex. The idea behind this to to save you having to write all the boilerplate unit tests for testing simple implementations of property accessors, constructors, etc ... If you find yourself writing unit tests to test something like:

public String ProductId { get; set; }

or if you aren't in the C# 3.0 world just yet:

private String m_ProductId;

public String ProductId {
     get { return m_ProductId; }
     set { m_ProductId = value; }

just so you can get your code coverage results up - you do have code coverage targets for you code right? If you don't check out this video to see how easy it is to measure how much of your code base your unit test are actually testing. Sorry, back to the point - Josh's Unit Testing library will automatically test your classes for you! No more writing boilerplate unit tests, just spend your time testing the more complex parts of your types. All you need to do is:

public void TestPersonProperties()

     PropertyTester tester = new PropertyTester(new Person());

and Josh will magically test your class for you using randomly generated values. You can also configure it to ignore some properties, test constructors and check that the correct notifications are fired if you implement INotifyPropertyChanged.

For more information, check out Josh's Magical Unit Tester on CodePlex - ok, so that's not its real name, but I like it better than his informatively named "Automatic Class Tester".



Comments (0)

Skip to main content