Skip to content

Instantly share code, notes, and snippets.

@KaduNovoK
Created March 4, 2020 19:40
Show Gist options
  • Save KaduNovoK/7ebbfc0898c1ecb61975bdb699733654 to your computer and use it in GitHub Desktop.
Save KaduNovoK/7ebbfc0898c1ecb61975bdb699733654 to your computer and use it in GitHub Desktop.

TDD Resume

  1. Red
  2. Green
  3. Refactor (but stay green!)

Step by step

1. Write the smallest and simplest test possible

Each function should test just one use case

2. See it fail

Nothing red? So there's nothing to be done

3. Write the smallest amount of code possible to pass the test

Be punctual (and a little lazy)

4. Watch him pass

Seriously, you need this, okay?

5. Refactor

Make the code great again!

6. Watch it pass again

Of course!

7. !Task end? Go back to step 1

Here we go again!

Coverage samples

Functional controller tests

  • The route exists?
  • Whats the expected errors to this route?
    • Access errors
    • Required data errors
  • The route works?
@FeMaffezzolli
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment