Category Archives: testing

Strategies for isolating the database in tests

One of the keys to having maintainable tests are to make sure that tests are isolated and reproducible. For unit tests, this is easy as long as we stay away from global variables, static classes and in general global state. … Continue reading 

| 8 Comments

On Testing “Trivial Code”

I can’t resist jumping on the band-wagon and telling people that they’re wrong, so here goes… Mark “Ploeh” Seemann wrote a post on testing trivial code. There have been several responses saying he’s wrong and that you shouldn’t test trivial … Continue reading 

| Leave a comment

Are your unit tests still hard to read ? – Should Assertion Library

I created the Should library to fill a gap in the testing ecosystem in the .Net space.  Simply put, I took what I liked about using extension methods to make a more readable set of assertions, but made the library … Continue reading 

| 15 Comments

Own Your Work

This post is mostly here to share a link. Jeremy Miller posted ‘“Code Complete” is a polite fiction, “Done, done, done” is the hard truth‘. Before clicking through I thought I was going to disagree. After reading through, I agree … Continue reading 

| Leave a comment

Testing with queries and repositories (a simple example)

Not being much of a fan of the Repository pattern, or better yet, not a fan of applying it as a universal data access strategy, one question that comes up often is “but what about testing”? But the question should … Continue reading 

| 14 Comments

JavaScript Unit Tests: Jasmine vs Mocha

Someone recently asked me whether I prefer Jasmine or Mocha for unit testing JavaScript. My answer is: Jasmine and Mocha are both great. I use both, depending on the project and team. There’s a great community around both, and you’ll … Continue reading 

| 6 Comments

Isolating database data in integration tests

Databases in tests is an annoying, yet necessary component if you truly want to create accurate integration tests. I’m not too much of a fan of employing alternate databases in tests (SQLite in place of SQL Server), simply because I … Continue reading 

| 32 Comments

Asynchronous Unit Tests With Mocha, Promises, And WinJS

Before I get in to the guts of this post, you need to read Christopher Bennage’s post on how we have our Mocha test suite set up for our Win8 / WinJS project. It’s not the best setup, but it … Continue reading 

| 11 Comments

Jasmine-BDD: A Screencast On The Standalone Test Runner

My 2nd screencast at WatchMeCode.net is now online, and is free! WatchMeCode Episode 2: The Jasmine Standalone Runner In this episode, I cover the basics of JavaScript testing with the Jasmine-BDD test framework, showing how to install and use the … Continue reading 

| 2 Comments

Custom Jasmine Matchers For Clarity In Testing Backbone.js Models

I’ve been writing some Jasmine specs for a sample Backbone.js application that I’m building. The application is a simple image gallery, and one of the features is the ability to navigate to through the image list with ‘next’ and ‘previous’ … Continue reading 

| Leave a comment