On 16 March 2013 04:21, Jason Hsu, Android developer
<
jhsu8...@gmail.com> wrote:
> I'm going through Michael Hartl's Rails tutorial, and I am happy to report
> that (as of the end of section 7) I'm able to get things working. (That
> said, I skipped the section on automated testing, as Hartl warned that
> automated testing is the most likely part of his book to become outdated.)
Don't skip it. The fact that the details may change does not alter
the fact that testing is critical. The tutorial will give you the
basics even if the details change over the years.
>
> There is a heavy emphasis on the "bundle exec rspec spec" tests. I agree
> that testing is a very necessary part of development. As I go through the
> rest of this tutorial, I will continue to test when instructed.
>
> That said, how essential are the "bundle exec rspec spec" tests in most real
> world apps? My reasons for possibly not using them or not using them as
> thoroughly as the tutorial does:
> 1. I still feel more comfortable testing by accessing my web site in the
> browser and trying things out as if I were one of my users.
That is ok when your site has 5 pages. What about when it has 100?
Are you going to manually test everything every time you make a
change.
> 2. Creating the tests does add to the workload.
Only in the short term. In the long term it will pay for itself.
> 3. Garbage in -> garbage out: If you don't write the proper tests, your
> results don't matter but could cause you to needlessly obsess over something
> that actually works but you erroneously think is in error, or you could
> think something works when it doesn't.
Obviously true. That just means that you have to do your best to
design the tests well.
>
> After I finish
railstutorial.org, I will start my first Ruby on Rails web
> site, which will profile mutual funds and ETFs. How important is it that I
> do the "bundle exec rspec spec" testing as thoroughly as the tutorial does?
Vitally important. Apart from anything else it will allow you to
sleep at night being reasonably confident that the change you made to
the site today will not have messed up some other aspect of the site
that you had not considered, so you will not wake up to an inbox full
of messages from irate customers complaining.
Colin