Getting started with Laravel Testing

TDD is essentially a cycle of 3 events:

  1. Writing a test case. Because there’s no code to run, this test will fail and is also referred to as the RED phase of TDD.
  2. Write code to pass the test (No more, no less). This is known as the GREEN phase of TDD
  3. Refactor the code. This could be in the form of removing duplications or restructuring to conform to best practices. This is also referred to as the Blue phase of TDD.


php artisan make:test StoriesTest 
We are going to replace the contents of StoriesTest with seven different test methods.
public function testGettingAllStories()
            $response = $this->json('GET', '/stories');