A test is not a unit test if:
Writing tests around legacy code is another big challege. Being that my project is defined as legacy code because it doesn't have unit tests, I have the task in front of me in getting it covered by tests. It won't happen without quite a bit of refactoring!
I watched a video on Behavior Driven Development or BDD. It is essentially doing TDD well. The focus of BDD is focusing on testing the behavior of a system not necessarily having your tests mirror the exact structure of the classes you are testing. In this way your tests become the specification for your production code.
Here are some points/tips I've observed:
- Testing first helps you to think critically about what you are trying to write.
- It is impossible to know everything upfront. Do what you know now, thinking decently far in context but not to far.
- Don't over engineer.
- Agile & TDD allows for tight collaboration with the customer... a good thing!
- Tests are the "glue" that holds an application together.
- Unit testing is testing the smallest components which are classes/methods.
- Customer is in control which is very motivating for them.
- Solve the RIGHT problem RIGHT!
- Over the long term effort required to write tests will pay off vs having to maintain untested code.
- Developer can feel confident about work.
- Refactoring is changing structure without changing what the code does.
- Keep unit tests as simple as possible.
- Tests are atomic and isolated.
- Create "test list" from requirements, from this we can know if we are "there yet".
- Tests are like examples.
- Concentrate on testing the behavior of your program not necessarily mirror the exact structure of the class you are testing.
All in all I believe TDD is a superb idea and a process I am adopting in my projects.
In my last blog post I wrote about moving and pursuing a degree. We arrived in Gosport, IN on August 4. Originally I was planning on starting school on Sept. 1 but since our apartment was not quite ready I pushed it off another month. So I am scheduled to begin my degree program on Oct. 1 with WGU.