Thanks for replies, Jon and Alex! (I've just accidentally noticed the replies, I thought I'll get notifications. It seems I forgot to subscribe)
Currently, I'm in the middle of the Rails 4 in Action book and noticed it's really time-consuming to write tests, but I understand, this will make my life easier in the long run of the application maintenance and future development. Regards, Askar On Saturday, July 25, 2015 at 12:48:49 AM UTC+9, Alex Chaffee wrote: > > This is a great question as the TDD orthodoxy was developed in a land > without HTML or CSS and often skips over the issues of testability and > brittleness and "could this really break in a meaningful way?" > > You should definitely test-drive your models and controllers. But should > you test-drive your views? Maybe if there's logic in there. But if there's > logic in the views, maybe that logic should move to the controllers where > it's easier to test. Then the controllers can either select which view to > render, or pass on variables to the view to tell it what to do. > > That's because testing HTML&CSS tends to be very brittle. You can make a > non-functional change (like changing an H2 to an H3) and break your whole > test suite. Ugh. That pain encourages you to just ignore or remove the > tests, so what's the use? > > btw your first option:"Build the basics of the app without testing, > confirm that it works visually" is what XP calls a "spike". After you do > that, you're supposed to throw it away and start from scratch with tests. > (And yeah, maybe copy some code over from your spike, but always with a red > test first.) > > -A > > > > On Jul 23, 2015, at 8:18 PM, Askar <[email protected] <javascript:>> > wrote: > > Hello! > > Nowadays I'm reading Rails 4 in Action book and I like it very much. > > They're using TDD&BDD first, then building the rest as test goes. > > I wonder which approach is better: Build the basics of the app without > testing, confirm that it works visually and then making TDD & BDD? > > Or start straight away from TDD & BDD. > > *In the book, rspec, factorygirls and capybara used.* > > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rspec/771c357b-5361-439e-83d1-51e976d0db3f%40googlegroups.com > > <https://groups.google.com/d/msgid/rspec/771c357b-5361-439e-83d1-51e976d0db3f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/598edffe-0348-4b79-be9b-98c5200fb0fd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
