Skip to main content

Moles: No Longer Fit for Unit Tests

· 3 min read

No moles

Moles is a powerful and useful framework for unit testing. Or was. But even then, it was overused (at least by me). But no more!

The first clue that I might need to walk away from Moles was the recent difficulty another developer was having in trying to get a unit test project up-and-running on his computer. I had installed what was current in early 2011, and he had installed the current version from last 2011. Turns out there was a significant change – the config file no longer worked. We had to update the assemblies correctly on my machine, rebuild many times, and fool around with manually removing some assemblies. It got confusing and messy. I suppose that's why MS still labeled this version as < 1.0.

Breaking My Moles Habit, With MoQ

· 3 min read

jester

For several years now, I have been relying on Microsoft’s Moles for isolating one method from another in my unit tests. Recently I’ve begun to understand that this was not the best approach. I’ll dig into that more in a future post. Having come to this conclusion, I need to start ripping out Moles. Based on the user feedback across the web, and the powerful Lambda expression syntax I’ve grown used to, I’ve chosen MoQ as my replacement. Now for an exercise…

Love Thy Neighbor: Ethic for Sustainability

· One min read

In preparation for Earth Day next weekend, I was reading a bit of Love God, Heal Earth this morning. I was reminded of the passage about "love thy neighbor as thyself", and its implications for the ethics of sustainability. Who is your neighbor? Does it include someone a state away? In another country? Continent? What about the people of the future? This famous passage can be interpreted, in modern context, as a call for eco-justice, which includes leaving a sustainable way of life for future generations. Matthew, chapter 22, verses 36 - 39 (NIV)

"Teacher, which is the greatest commandment in the Law?"

Jesus replied: "‘Love the Lord your God with all your heart and with all your soul and with all your mind.’ This is the first and greatest commandment. And the second is like it: ‘Love your neighbor as yourself.’"

Using Windows CNAMEs to Reduce Server Confusion

· 2 min read

A common challenge for development teams is remembering the names for all of the different servers in an enterprise environment when the server naming convention is either not descriptive ("Deathstar", "Falcon", "XWing") or obscure ("abcDBS001", "abcDBS002", "abcWEB01"). The Star Wars names suffer from an obvious problem of mapping description to purpose. Those obscure names are commonly used to help distinguish between dozens to hundreds of different servers in an enterprise. Arguably they are helpful to the infrastructure team as they manage this motley collection. But for a developer, remembering if "abcWEB01" is the test web server or prod can be challenging; even when remembered, it would be simple enough to overlook or accidentally type "abcWEB04".

Test Naming Convention

· 3 min read

Historically I've advocated naming test methods after the method under test, in order to help find the tests when you need to modify them. Growing Object-Oriented Software, Guided by Tests has shown me that this is a relic of a code-first mentality rather than good application of test driven development, primarily in the section "Test Names Describe Features" (ch 21). "Test driven" development implies that we do not know the name of the method we're going to test. But we do know the functionality (feature) that we are going after, and that knowledge should be used when writing out a test name. For example:

Non-Discrimination in the Campus Club

· 3 min read

Vanderbilt University, a large private school in Tennessee, is enforcing rules that require all student groups receiving on campus funds to open up membership to anyone - including officer positions (story on NPR). Naturally, this is of great concern to Faith-based organizations in particular: one can easily imagine a group of atheists gate-crashing a meeting and electing their own leader to be the President/Chair/Grand Poobah of the _ <insert religion> Association_.

SSIS Deployment Headache

· 3 min read

For years I've had problems with SSIS deployments to production. In fact, I completely abandoned SSIS packages because it was so difficult to deploy to production (in SQL Server 2005): I always ended up with errors that would require me to hand-edit the file and hard-code paths. That, despite the fact that my config files have the database connection strings and file paths in them. And despite the fact that my packages usually work fine on the test server but fail in production. After years of this problem, it suddenly occurred to me that one piece in particular is probably at fault. But given that I do not have access to production such that I can investigate, it will always be a hypothesis: using a template that sets various properties with the help of variable expressions.

A Recipe for Setting Up Automated Test Projects

· 5 min read

Assuming that you are already sold on the notion of automated testing, it can be useful to put a little thought into how projects will be setup. There are many approaches to this; my approach is based on experience, the wisdom in xUnit Test Patterns, and standard coding best practices. I will try to keep this language agnostic, though my examples will be in C#.

Embracing Unity, in Grand Prairie, Texas

· 4 min read

This past Wednesday I was proud to take part in a banquet event on the theme of "Embracing Unity," sponsored by the non-profit Grand Prairie Unity Coalition, of which I am a new Board member. This was the 7th such banquet, which brought together people from many like-minded organizations, local / county / state politicians, and most importantly, around 40 students and family from the local school district. The organization's mission is to provide education and opportunities for cross-cultural association to the Grand Prairie community, and that mission was admirably pursued with Wednesday's event.

safnet logo