0

I am new in ruby on rails development. I have read a book named ruby on rails tutorials written by Michael Hartl. He writes a test before implementing the function using rspec. However I don't think it a good idea. Since I have already known what content should the page have, why should I write the code like ' it should have ...' this kind of unnecessay stuff. I am planning to write a blog to practise my rails skills but I doubt if I should write TDD or BDD and will it bring me some profits

Daniel
  • 869
  • 2
  • 7
  • 19
  • Possible duplicate of [Why should I practice Test Driven Development and how should I start?](http://stackoverflow.com/questions/4303/why-should-i-practice-test-driven-development-and-how-should-i-start) – Dave Schweisguth Feb 05 '16 at 13:45

1 Answers1

2

Let say you have a large application and and there are many developers contributing on that application concurrently. Plus you have hundreds of modules and theres a lot of validation and calculation and all that. Will you test it manually and will the tests are exhaustive enough?

Here is where TDD with automation comes really crucial. I am once happened be like you and still (part of me). But time by time I realize that I cannot do testing perfectly as I tend to forget something and thorough testing does really consume time. Of course we try not to hire a tester to save the development cost.

Here are the benefits that you will enjoy from TDD (BDD) in the long term :

fewer defects, better design, better APIs, simpler design, lower complexity, increased productivity, more maintainable code etc. source : http://scrumology.com/the-benefits-of-tdd-why-tdd-part-3/

As for me, I think able to do integration testing from outside rails environment to the development & production server and to test the output is enough since I am a solo developer. But in the future, when I work with a team I know I will need unit testing and all other test instead.

I would like to suggest you to do Unit Testing (which is shipped with Rails) and cucumber for ease of selecting dom element. And later when you think you want to test your front-end with ajax you can use selenium/webdriver.

I hope this would answer your question.

Yakob Ubaidi
  • 1,846
  • 2
  • 20
  • 23