Monday, August 17th, 2009
Here's some essential unit-testing posts I've written recently. While some of them have examples in PHP, they should still be useful in other languages as well.
Unit testing PHP series
Unit testing introduction
Writing and running tests
Writing tests for exsisting code
Mock Objects and testing code which uses the database
Test-driven development
General testing topics
Unit-testing JavaScript
How ...
Posted in Programming | 3 Comments »
Friday, August 14th, 2009
Image by Jim Frazier
I've recently been working on a code-base which wasn't designed with test-driven development methodologies, or with unit testing in mind. As I implemented unit-tests to this code, there were some modifications I had to do on the code.
Some modifications popped up more than others. There were a ...
Posted in Programming | 16 Comments »
Tuesday, August 4th, 2009
I've recently been looking into some JavaScript unit testing frameworks. There are many alternatives, and while many of them seem good, very few of them actually matched my requirements:
Must be able to run tests from the commend-line
Tests should be relatively easy to write
Posted in Programming | 4 Comments »
Saturday, July 4th, 2009
In this post I'll introduce the methodology known as test-driven development, and how to use it in your projects.
The difference between "normal" and test-driven development (TDD) is that when doing TDD, you write unit tests for your new code before writing the code itself. This way you ensure good test ...
Posted in Programming | 6 Comments »
Friday, June 26th, 2009
After learning to write tests and some good testing practices, it's now time to look at mock objects.
When testing a class which needs an instance of another class to work, you do not want to depend on the other class too much. This is where mock objects come in - ...
Posted in Programming | 14 Comments »
Wednesday, June 17th, 2009
Now that you know what unit testing is and how to write and run tests, it's time to look at writing tests in more depth.
Today we'll take an example class and write tests for it. We'll also introduce some common testing methodologies.
Posted in Programming | 10 Comments »
Wednesday, June 10th, 2009
Continuing from the unit test introduction, we will now continue and take a look at how to write tests and ways to run the tests.
Posted in Programming | 14 Comments »
Friday, June 5th, 2009
Due to popular demand, I'll be writing a bunch of posts on unit testing.
In this post I'll introduce unit testing: What it is, when it's a good idea and when it might not be. I'll also discuss a bit about what makes for a good unit test.
Next week I'll post ...
Posted in Programming | 19 Comments »
Thursday, December 11th, 2008
Here are some thoughts and observations regarding application design and unit testing in the quiz-project I recently wrote about.
When I was writing the Amazing Programming Language Guessing Script, I didn't first write any unit tests. Partially because I just wanted to test something quickly, partially because I didn't think there ...
Posted in Programming | 2 Comments »
Wednesday, August 27th, 2008
When testing code which uses the database, you would usually want to make sure the database stays pristine for each test - All tables should be empty, as any extra data could interfere with the tests.
You could probably write an extended Testcase class which automatically does this before each test ...
Posted in Programming | 11 Comments »