Acceptance unit test cycle

With behavior-driven development, we approach development from a high level, outside-in perspective. When we need to test details, we use unit testing (testing the ‘inside’). For the majority of the boot camp course, we used Cucumber to create our acceptance tests and RSpec to test the backend. With this strategy, we tell the user story before any development happens.

After writing a user story and its scenarios, the test is run. As soon as your dealing with something that is stored in the database, you switch to unit testing/RSpec. Fetch the data via the controller and display it via the view. Everything starts with a route, then usually a controller action followed by a rendered view.

The testing process looks a bit like this:

  • You need to see test fail before you implement changes.
  • Go back and forth btw tests.
  • Run separate features til done.

An even simpler way to put it:

Red –> Green –> Refactor

Leave a Reply

Your email address will not be published.