Moles: Mocking the Un-Mockable

Published April 26th, 2010 Under Software Testing | Leave a Comment

In this episode we are going to take at how to use Pex and Moles for .Net. Unit testing is great, but most free isolation frameworks require that your mocks implement an interface. But what do you do when the class you are trying to mock is static or sealed with no interface. If you can’t modify the class then your unit testing efforts are usually stuck. Moles, the new free isolation framework from Microsoft, supports mocking almost any CLR based class (including sealed and static classes).

http://www.dimecasts.net/Content/WatchEpisode/170

Learning how to use Manual Mocks for Testing

Published March 1st, 2010 Under Software Testing | Leave a Comment

In this episode we are going to take a look at how to use manual mocks for testing. Often times when creating unit tests we need to work in isolation in order to cover the paths we are attempting to test. When we want to test in isolation you can use a testing technique where you mock out your dependencies. When using Mocks you can either do it manually (what we are looking at) or you can use a mocking framework like Rhino Mocks. Either way you achieve the same results.

http://www.dimecasts.net/Content/WatchEpisode/164

Isolation Frameworks: Mocking Out/Ref Arguments

Published September 7th, 2009 Under Software Testing | Leave a Comment

In this episode we are going to continue our series on learning how to use an isolation framework (Rhino Mocks) to help create simpler and more reliable unit tests. We are going to focusing this episode on how to setup you mocks when you need to mock a class with either Out or Ref arguments.

http://www.dimecasts.net/Content/WatchEpisode/138

Interaction Based Testing with Rhino Mocks

Published August 28th, 2009 Under Software Testing | Leave a Comment

Beyond the simplest scenarios, all objects had collaborators that they work with. This flies in the face of testing objects in isolation. This is the problem that mock objects were created to solve. In this talk you will learn what mock objects are, how to utilize them and best practices on when / how to utilize them. Rhino Mocks is a mock objects framework for .Net whose core goals are to let the developer rely on the compiler work well with refactoring tools.

PowerMock

Published August 24th, 2009 Under Software Testing | Leave a Comment

PowerMock can be used to test code normally regarded as untestable! Have you ever heard anyone say that you should never use static or final methods in your code because it makes them impossible to test? Have you ever changed a method from private to protected for the sake of testability? What about avoiding “new”? Think again! PowerMock lets you mock static methods, remove static initializers, allow mocking without dependency injection and much much more. And it works just as well for J2EE as J2ME! This presentation will give the audience a good understanding on how to easily unit-test your code without the limitations of the common mock frameworks such as EasyMock and JMock.

Isolation Frameworks: Learning how to validate expectations

Published July 21st, 2009 Under Software Testing | Leave a Comment

In this episode we are going to continue our series on learning how to use an isolation framework (Rhino Mocks) to help create simpler and more reliable unit tests. We will focus our learning this time around on the various ways you can setup and validate expectations on your stubs/fakes. Validating these expectations will allow your to confirm in tests your dependencies are being used in the manor expected.

http://www.dimecasts.net/Content/WatchEpisode/127

Resources
Rhino Mocks Home Page
Episode Source Code

Isolation Frameworks: Learning how to Stub & Fake Data

Published July 20th, 2009 Under Coding, Software Testing | Leave a Comment

In this episode we are going to start learning how to use an isolation framework (Rhino Mocks) to help create simpler and more reliable unit tests. We will start off our learning experience by learning the basics. We will be taking a look at how to setup stubs/fakes in order to hard wire return values for our objects/methods.

http://www.dimecasts.net/Content/WatchEpisode/125

Resources

Rhino Mocks Home Page
Episode Source Code

Interaction Based Testing

Published September 1st, 2008 Under Software Testing | Leave a Comment

The 2nd Annual Google Test Automation Conference (GTAC) in New York on August 23 and 24, 2007. In the world of developer-facing automated tests, IBT is arguably one of the most controversial topics. One side claims that “pure” unit testing is a way to ensure that code behaves as specified, providing design and maintenance benefits as well. Another group claims that IBT is a great way to generate code bloat and test things that do not need to be tested. Matt and Sean will try to go beyond the clichés and hype of “Mock Always” verses “Mock Never.” Instead, they’ll strive to find the appropriate places to use IBT, and pass on some tools to help you with your ultimate decision. Along the way, they will cover some common mistakes, anti-patterns, and things to consider.