Reputation: 59
Firstly I understand you write tests firstly in order to fail so that they give you adequate information on how to make them pass and what will make them fail if I'm correct.Then after they pass you write the actual code and then tests to test the actual code and then if that passed you're finished.
(If I'm wrong in any part of the above please tell me I've only just started reading up on this)
1. Once your starting tests pass , do you delete them or keep them in code (The same goes for the actual tests)
2. Also is RSpec (for rails) the right way to do testing
(If you have any resources to point me to about TDD with rails that would help aswell) Currently I'm looking at this: http://everydayrails.com/2012/04/07/testing-series-rspec-controllers.html
Upvotes: 0
Views: 78
Reputation: 1021
In strict TDD, you first write your tests, so they will obviously fail as you don't have code in your functions. Then you write the function so they pass the test.
You keep all the tests. They are part now of your "test suite". In the future, if you have a big Rails app, you will probably have a CI engine that will run all your tests everytime you update your codebase.
There are other tools: MiniTest as an alternative to RSpec. Cucumber to describe behaviour more as a "human way" (with words). You can also run tests simulating a browser with Selenium or Capybara.
To sum up: You need to do some research about RSpec, Cucumber, MiniTest, Capybara, Selenium... and choose your tools.
Upvotes: 1