Integration tests help you ensure dependencies behave as expected. When creating unit tests, developers go to great lengths to eliminate dependencies, but that's not our objective. The application should already have passed unit tests, before proceeding with integration tests. We want to ensure that integrating the application with its dependencies works as expected.
"Dependencies" includes other modules, APIs, frameworks, hardware, databases, networks, etc. We want to ensure the application works with these other resources as expected. This demonstration code implements constructor injection, to simplify testing. Dependency injection is essential to unit testing, but also proves useful for integration testing. The injection is important, because we want to isolate a specific dependency and inject a controlled mock object for others.
25 May 2011
12 April 2011
Unit Testing with Moles and Pex - Part 1
at
18:28
This post discusses key ways of improving the effectiveness and code coverage on unit tests, using the Visual Studio Test Framework, including the developing Moles and Pex technologies. Other frameworks and harnesses such as nUnit, Moq, etc. are not discussed in this post.
Moles is Microsoft's code instrumentation, or mock framework, used to isolate environment dependencies. Moles was created expressly to enable Pex to function. Moles is discussed in greater detail, after the break.
Pex intelligently examines the logic branches of the code to be tested, and then generates a series of input values that should or should not fail, thereby maximizing test code coverage.
Before we start talking about Moles and Pex, there are some elementary, yet vitally important topics to review about unit testing. Adhering to these rules play into the effectiveness of Moles and Pex. I strongly advise reading, before moving on to part 2, but I really can't stop you, can I? (or can I? Muahaha!)
Moles is Microsoft's code instrumentation, or mock framework, used to isolate environment dependencies. Moles was created expressly to enable Pex to function. Moles is discussed in greater detail, after the break.
Pex intelligently examines the logic branches of the code to be tested, and then generates a series of input values that should or should not fail, thereby maximizing test code coverage.
Before we start talking about Moles and Pex, there are some elementary, yet vitally important topics to review about unit testing. Adhering to these rules play into the effectiveness of Moles and Pex. I strongly advise reading, before moving on to part 2, but I really can't stop you, can I? (or can I? Muahaha!)
31 March 2011
ATOM and RSS Feeds Fixed
at
13:28
![]() |
| Yeah, my bad. Again. |
Go ahead... try clicking the ATOM and.or RSS icons, in the sidebar. They really, really work. (For real!)
24 March 2011
Active Directory Properties for C#
at
19:17
I compiled the following list of Active Directory properties, while developing a solution. This list is more comprehensive than those I found on the InterWebs.
Please submit suggestions for additions to this list, via the comment block, below! Code thrives on community feedback. (Code is posted after the jump break...)
Please submit suggestions for additions to this list, via the comment block, below! Code thrives on community feedback. (Code is posted after the jump break...)
Subscribe to:
Posts (Atom)
