I was asked by a friend recently to point him in the direction of some advice on unit testing within actionscript 3. I thought it may be useful to others so here is the email with some addition descriptions: What is unit testing Unit tests are methods that run in order to verify the output of a method is what is expected when given a predefined input. This is useful as you can check if your code does what it should. There is a whole world of information on this on the internet. Check out test driven development. History ThereRead more
This is the last blog post I plan to make about the terminology around TDD. There will be real life examples from now on. I have previously discussed the terms collaborators, subject under test (SUT) and test doubles. Here, I am going to describe the three types of test doubles you can use. The Real Thing If you have a simple collaborator which only really stores and retrieves values, like a model, then is it worth replacing it for testing purposes? I personally think as long as this collaborator is unit tested then it is okay. Once there is someRead more
I have been posting about design patterns recently and I am realizing that it would be useful to post about Test Driven Development too. As a gentle introduction I am going to go through some of the vocabulary. Test Driven Development is the process; Red, Green, Refactor. That is the easy way to remember it. Below is your workflow: 1) Write a unit test. A unit test is a method that tests another method. The test calls the method that you are testing and verifies that the response is as expected. Your unit test should always use the same inputsRead more