Automated Testing Isn’t Just for Business Logic

I had a conversation with Kelly Sommers the other day that was partially a short support group session on the annoying tendencies of development teams to completely lose focus on the architecture and design principles of a system and let the code base devolve into a ball of muddy spaghetti. One particular area that we discussed, and it’s one area I’ve detailed elsewhere, has to do with layers.  Our gripe was that developers seem to completely ignore layering principles once they start coding and introduce cycles, put things in the wrong layer, etc.  A brief recap of layering principles:  Types … Continue reading Automated Testing Isn’t Just for Business Logic

“Explicit” Tests with Resharper

NUnit introduced a feature called Explicit Tests (a long time ago, I believe) that basically mean a test is considered tagged as Ignore unless the test name is explicitly given to the NUnit runner. This is useful if you have tests that you don’t want run all the time.  Integration tests or tests highly coupled to infrastructure or circumstance come to mind…  But, it’s difficult to automate these types of tests because you always have to maintain a list of test names to give to the runner. The ability of NUnit to run explicit tests aside, I don’t generally use … Continue reading “Explicit” Tests with Resharper

Testing Strategies Involving Async Functions

Some things to keep in mind when writing units tests for code that use async methods: You’re not trying to test the framework’s “awaitability” and you’re not trying to test framework methods that are “awaitable”.  You want to test your code in certain isolation contexts.  One context, of course, is independent of asynchronicity–do individual units of code that don’t depend on asynchronous invocation “work”…  e.g. “Task<string> MyMethodAsync()”, you want to have a unit test that make sure this method does what it’s supposed to do (one being it returns a “valid” Task<string> object, the other being that individual side-effects occur, … Continue reading Testing Strategies Involving Async Functions

Testing the Units

In OO there’s levels of abstraction.  A class, for example, abstracts a read-world concept into a encapsulated bit of code.  A class is autonomous.  That class lives in world with other classes and interacts with them, but is autonomous. I believe development testing should account for these abstractions, not just the interactions or behaviour of the system.  One problem I see with Test-Driven Development (TDD) and Behaviour-Driven Development (BDD) is that practitioners simply just center on interaction of the parts of the system and really don’t do any “unit testing”.  They get caught up in the mantras that are TDD and BDD and fail … Continue reading Testing the Units