Programmers Only - Do you write unit tests first?
I write unit tests during the code development if that's what you mean. On a large project, different people are working on different parts of the project. If I want to test that the data layer is working correctly before the business layer and the presentation layer is ready (or the business layer, if it's finished before the aforementioned) unit testing is really useful.
For unit- and integration testing, I use NUnit and FluentAssertions.
_________________
“He who controls the spice controls the universe.”
Actually my question is more specific. Sorry my communication skills let me down*, but the poll asks about writing unit tests before writing the code to be tested. Namely the Test-Driven Development methodology in which you are supposed to write a test against phantom code then actually run the test and record the fact it failed on the first go so that everything after represents improvement.
Google TDD and you'll find numerous discussions on the topic.
*Theory of mind and all that.
Actually my question is more specific. Sorry my communication skills let me down*, but the poll asks about writing unit tests before writing the code to be tested. Namely the Test-Driven Development methodology in which you are supposed to write a test against phantom code then actually run the test and record the fact it failed on the first go so that everything after represents improvement.
Google TDD and you'll find numerous discussions on the topic.
*Theory of mind and all that.
In early stages, I use test driven development.
_________________
“He who controls the spice controls the universe.”
Yes, when I have a large project in mind, I usually test certain assumptions first for "proof-of-principle," which I think are basically unit tests. Like when I wrote the SMB3 Map Editor, the first thing I tested was loading the tiles, the palettes, and the sprites, along with using the tile maps specified in the game data and the Win32 API (SetDIBitsToDevice() was the function to actually draw the bitmap data on the window) to display World 1 of the game on a window. With that, I learned how to do a very important part of the program I needed to write and I showed myself I could make it work, and I started a new project with that in mind. Despite that, it took 3 attempts total (each attempt representing a separate project) to finally succeed in making the SMB3 Map Editor work.
It also occurs in smaller programs, where they aren't functioning as suspected. I start to dig through the code for any possibly erroneous assumptions I may be making about how, say, a library function call works, and then I do unit tests surrounding things like that library function call to test my assumptions--almost always in a separate project devoted just to tests. I find out where my assumptions are erroneous and then correct them, which results in the program working after much testing and debugging.
| Similar Topics | |
|---|---|
| Anyone else own a TENS unit? |
21 Aug 2007, 11:43 am |
| Was anyone in a unit like what I was in at school |
23 May 2007, 10:30 am |
| Finding the motivation to write, when you love to write? |
08 Sep 2009, 6:39 pm |
| Add a hydrogen unit to your car for only $2000 |
01 Oct 2011, 12:00 am |

