[cgiapp] CGI::Application Testing Methodologies

David Steinbrunner dsteinbrunner at pobox.com
Thu Feb 21 05:59:35 EST 2008


Jason Purdy wrote:

> My advice would be to factor your code such that the code is separated
> into a testable module.  If your delete_customer function works as
> expected, then all the layers above should work as well since those
> layers are independently tested.

My awareness of testing is that there are two main types, what I'll refer to
as unit testing and functional testing.  Unit testing is what Jason is
talking about above.  Having a strong base on which to build applications on
gives you confidence and is a must if you are serious about automated
testing.  The thing is, if you are dealing with a MVC
(Model-View-Controller) system then you only have your model accounted for
without coverage for the V and C bits.

Functional testing is where you test at the level of what the user interacts
with and deals with test cases your customer could specify.  For instance,
your customer wants to make sure when x is selected y can not also be
selected with out the form returning an error.  Using Test::More and
WWW::Mechanize, maybe a dash of HTML::TreeBuilder, you can automate that
type of test.  Of course, there is a little bit more to it since many
applications these days have lots of JS logic and you application likely
deals with data from a databases that you will want to have be consistent
for your tests but you can handle those for the most part if you get
creative.  It also appears that Selenium is getting a lot of attention by
developers for functional testing but I have yet to use it.  A search on
CPAN shows lots of results for Selenium, too.

In any case, I just wanted to make sure that the idea of testing both from
the bottom and the top in an automated fashion was talked about together.

--
David Steinbrunner




More information about the cgiapp mailing list