In this post I will try to describe an approach to unit testing database queries. It happened to be inspired by some testing I was doing of some C# code, but you could apply the same ideas to other languages. Note that if you’re unit testing stored procedures then I recommend using something like tSQLt, … Continue reading Unit testing database queries
Category: Testing
Mutation testing
Mutation testing is a way of judging the quality of your tests, just as tests are a way of judging the quality of your code. Usually, the tests that mutation testing works with are automated unit tests. In theory it could apply to manual and/or higher-level tests like integration or system tests, but I hope … Continue reading Mutation testing
Named parameters with default values can help unit tests
Introduction I find myself using default values much more in unit tests than in production code. That is, I do it more often, and use more parameters with defaults per method. This isn't because default values are bad, but they are often particularly useful when setting data up for unit tests. It makes the tests … Continue reading Named parameters with default values can help unit tests
Single Responsibility Principle for Automated Tests
I was writing some unit tests last week for a controller in an MVC application. As part of this I had to create a view model to pass to it, and inside the controller this was used to create a model. I had previously spent a bit of time writing unit tests for the conversion … Continue reading Single Responsibility Principle for Automated Tests
Automated testing of a website: Dealing with the database
This article proposes an approach to handling the fine-grained parts of the database parts of an automated system test of something like a website. You would need other things for the remaining jobs: To orchestrate the test, something like SpecFlow; To interact with the website, something like Selenium; To do the bulk updates to the … Continue reading Automated testing of a website: Dealing with the database
SpecFlow: To defer or not to defer
Introduction In a previous post on how to allow Gherkin authors flexibility to write the lines of a scenario in whatever order made sense to them, I suggested deferring things as a mechanism for making this happen. The costs of doing this have become more apparent to me since I wrote that, so I think … Continue reading SpecFlow: To defer or not to defer
Balancing big picture and details when coding, testing and documenting
Introduction I very much hope that this avoids being a rant. I also hope it avoids being self-indulgently clever rather than being helpful. Finally, I understand that people learn in different ways; I think I like images and like to get the big picture before getting into detail. Other people like to be led along … Continue reading Balancing big picture and details when coding, testing and documenting
Testing data preparation for a BI database
Introduction Before we can get into testing, first I will explain the BI database and how it’s created. BI is short for Business Intelligence. It can mean different things to different people, but the definition I’m going to use is some form of storing data in a way that helps people to make decisions. It … Continue reading Testing data preparation for a BI database
SpecFlow + Selenium: The engineering behind decent Gherkin files
This article is in a series about Selenium and SpecFlow Introduction Why bother? Basic plumbing Page objects The engineering behind decent Gherkin files UPDATE: please see another article I've written on the costs and benefits of the approach I describe below. Summary If you are writing the implementation of your SpecFlow + Selenium tests, you … Continue reading SpecFlow + Selenium: The engineering behind decent Gherkin files
Making SpecFlow + Selenium testing easier with Page Objects
This article is in a series about Selenium and SpecFlow Introduction Why bother? Basic plumbing Page objects The engineering behind decent Gherkin files Introduction Page Objects are things that shield the rest of your test from the details of the website under test. At one end they understand all the text boxes, selects, ids, CSS … Continue reading Making SpecFlow + Selenium testing easier with Page Objects