Search code examples
unit-testingtestingphpunittdd

Would it still TDD if I would plan and list (as comment) all test ahead?


Would it still count Tdd when I some kind of start planning before even writing test down? I mean create test files with commented test case names. In that way I could for example anticipate and simulate the app ahead, some kind pre plan the tests and at the same time create a plan. I doubt that it would still TDD but I would be happy to get some views on this.

Example:

class AuthenticationTest extends TestCase
{
    use RefreshDatabase;

    // Authentication Tests
    // ====================
    // guest_can_register_with_valid_data
    // guest_can_register_with_valid_data_and_receive_verification_sms
    // guest_can_register_with_valid_data_and_verify_sms
    // guest_can_register_with_valid_data_and_verify_sms_and_login

}

Solution

  • If you review Kent Beck's Test Driven Development by Example; all of part 1 (seventeen chapters) prominently feature a "checklist" of test ideas, some of which have already been done, others that are deferred to future.

    Putting that checklist into your IDE (as opposed to, for example, writing them down on a convenient piece of paper) is fine.

    But it's also not particularly important; TDD is red/green/refactor; it doesn't constrain the implementation details of the second brain we use to keep track of where we think we are going.


    Update: at the end of 2023, Kent Beck wrote Canon TDD, asserting that if you want to critique TDD, you should critique the "actual thing".

    The first item in his description of the actual thing is:

    Write a list of the test scenarios you want to cover