For unit tests should you;
Write a test. Write code to pass it. Refactor.
Or
Write all your known tests. Make one pass. Refactor.
I ask this because TDD states you stop writing code after all tests pass but this point is unclear.
Edit
One thing I think TDD focuses on more for this "rule" is in relation to stories/tasks no? Does anyone agree?
A few months later
A routine I've gotten into after seeing a screencast (I'll try and find the link) on the subject is as follows.
- Write the names of the tests/behaviour/functionality at the top of the test class.
- Cut and paste the test name.
- Complete the test.
- Repeat until the list is empty.
Example using C#, should be generic enough however.
// Login page should not allow blank password // This would be removed when cut/pasted.
// Login page should not allow blank username
...
[TestFixture]
class LoginPageTests {
[Test]
public login_page_should_not_allow_blank_password() {
// Test code...
}
}