DRY Test Inheritance

Over the last two weeks, we’ve seen how Fixie can be configured to mimic NUnit and to mimic xUnit. That’s a neat little trick, but doesn’t provide much value. This week, we’ll see how Fixie’s convention API can be used to improve upon NUnit. Today’s code samples work against Fixie 0.0.1.62. The customization API is in its infancy, and is likely to change in the coming weeks. Today’s sample convention addresses two problems in NUnit: Lifecycle attributes are redundant Test class inheritance is needlessly complex. NUnit Lifecycle Attributes Are Redundant If you use NUnit, you probably see a lot of test classes like this: My [SetUp] methods are always named “SetUp”, my [TearDown] methods are always named “TearDown”, etc. It’s annoying to sacrifice whole lines to that noise. When 99% of your test fixtures use naming conventions like mine, the attributes stop telling you something. These attributes start to fill…
Read More

The Sincerest Form of Flattery

Last week, we saw how to define an NUnit-imitating convention with the Fixie test framework: when the custom Convention class was present in our test project, the default rules for finding and running tests were replaced, allowing us to write test classes with a familiar NUnit class lifecycle. This week, we’ll see how to customize Fixie to imitate the xUnit lifecycle. Today’s code samples work against Fixie 0.0.1.56. The customization API is in its infancy, and is likely to change in the coming weeks. Review: The NUnit Lifecycle With NUnit, one instance of your [TestFixture] class is constructed, and that instance is shared across all of that class’s [Test] methods. Test discovery is based on the presence of these attributes. You can identify methods as [SetUp] and [TearDown] in order to run common code before and after each individual test. You can also identify methods as [TestFixtureSetUp] and [TestFixtureTearDown], in…
Read More

Fixie’s Life Bicycle

Last week, we saw how the Fixie test framework gives you control over test discovery. This week, we’ll see my first (admittedly rough) attempt at similarly giving you control over test execution. Let’s start with a quick review of last week’s test discovery feature, and then extend the example to demonstrate Fixie’s treatment of test…
Read More

Test Discovery

Over the last few weeks, I’ve implemented some customization features in the Fixie test framework. The first of these features is now available. Today, we’ll see this feature in action. We’re going to tell Fixie what our tests look like, and Fixie will then find them and run them. Today’s code samples work against Fixie…
Read More

Enabling Change

Unit testing is meant to enable change by giving you confidence about the current state of your project. However, one of the criticisms of unit testing is that fine-grained tests (such as having one or more tests per method), locks you into implementation details. With fine-grained tests in place, you’re not free to move responsibilities…
Read More

“Just” is a Four Letter Word

I’m often guilty of this myself, but I cringe whenever I hear a software developer say that in order to implement a feature, they “Just” have to do x, y, and z. The reality is that even on healthy projects, you will face at least a little more complexity than could be anticipated in advance….
Read More

The Boiling Backlog

Software development processes tend to be too prescriptive, leading to waste. For instance, most Agile training prescribes fixed-sized iterations ending with a retrospective meeting. Blindly following this structure may waste time: either you hold an expensive meeting when there isn’t enough to discuss, or you motivate the team to hold back ideas for improvement until…
Read More

Cutting Scope

Over the last week, I’ve implemented support for async/await in the Fixie test framework. Thanks to a suggestion from Pedro Reys, I found that this project was susceptible to a serious bug, one that NUnit and xUnit both encountered and addressed back when the async/await keywords were introduced in C# 5. While developing the fix,…
Read More

Isolating Execution

In last week’s post, Dogfooding, I uncovered a bug in the Fixie test framework by trying to use it on two of my other side projects. At the end of that post, I claimed that the bug had something to do with “AppDomains” and stated that it would be fixed once I met the following…
Read More

Disabling language changes in Visual Studio

On a recent project I used a workstation given to me by the client. It was typical “big enterprise” setup with support for multiple languages. I discovered there’s a keyboard shortcut “Ctrl+Space” for changing your language that I would keep accidentally activating in Visual Studio. This post explains how to disable that. Go to the…
Read More