@euromark:
In fact, web tests are written very fast as soon as you have written a
few of them and can copy/paste together new ones. I agree with you,
it's always important to have a good cost/value balance, but it
doesn't cost nearly anything to at least write some
$this->assertGet('myapp.localhost/users/index');
(Where assertGet() is a custom method I wrote that checks for a 200
header and some other stuff a successful request should have.)
It's also nearly no work to type some data into a form like
$this->assertAndSetField('data[User][name]', 'testuser');
$this->assertAndSetField('data[User][password]', 'testpass');
...and submit it like
$this->assertAndSubmit('Login');
$this->assertText('Welcome, testuser');
By only writing these 5-10 lines of code, you can be sure that logging
into your system works, which is very crucial to any application and
needs a lot of things in the background to work, too.
In my opinion, this is a very high value for very low cost.
I guess, because CakePHP still lacks support for a testing database
for web tests, web tests aren't really used extensively. This is very
sad. Myself, I am using a pimped WebTestCase class that is able to
connect to the test database... maybe I should release this one as a
plugin, so other users could use it? (Some time ago I released one
already, but it's not up to date anymore... So if there's some
interest in this feature, tell me!)
On Sun, Jan 9, 2011 at 5:34 PM, Ma'moon <[email protected]> wrote:
> Hemmm, That is true, but i think learning PHPUnit instead of simpleTest has
> its own benefits as well, at the end when you learn PHPUnit, simpleTest
> "which is being used for Cake1.x user" will be a snap, and i believe that
> PHPUnit is going to be the standard automated testing platform adopted by
> CakePHP 2.x, above this and that i am only throwing my 5 cints :)
>
> On Sun, Jan 9, 2011 at 6:23 PM, euromark <[email protected]> wrote:
>>
>> the problem with the book is that its mainly phpunit specific
>> not a good resource for a cake1.x user which wants to start off
>> testing :)
>>
>> On 9 Jan., 11:24, "Ma'moon" <[email protected]> wrote:
>> > Here is very good book for unit testing, i suggest you start reading it
>> > instead of reading tuts or articles in a separated
>> > manner:http://www.limespace.de/wp-content/uploads/2009/12/practical-php-test...
>> > You can legally use the book and distribute it :)
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Sun, Jan 9, 2011 at 5:13 AM, netusco <[email protected]> wrote:
>> > > thanks! ok you convinced me at least to give it a try.
>> > > I guess what I would like to find is a blog that could explain well
>> > > all the parts needed to develop apps correctly, as I just find things
>> > > here and there and I have to figure out if I need to implement them or
>> > > not. Probably because I never worked for a "boss" in development
>> >
>> > > On 9 jan, 00:35, nurvzy <[email protected]> wrote:
>> > > > Testing is essential for any application you intend on maintaining
>> > > > or
>> > > > will be passing between developers.
>> >
>> > > > In regards to click testing, sure -- test your app yourself, if you
>> > > > only do it once you've saved time by not writing the test. But now
>> > > > lets say you then refactor a bit/add a new feature. Well now you
>> > > > need
>> > > > to verify all the stuff that was working before still works. So you
>> > > > hand test your app again and now you're officially wasting time.
>> > > > Had
>> > > > you just taken the extra few minutes to script your test you'd
>> > > > always
>> > > > be able to run it anytime you needed to reassure yourself (or your
>> > > > boss/client) that things are working. Say you make another change,
>> > > > and now you have to go back and test by hand again. Now you're
>> > > > wasting your time and your boss's/client's money. Your time is your
>> > > > own to waste, but you won't be in business long if you're in the
>> > > > habit
>> > > > of wasting your boss's money. By not scripting the tests you'd
>> > > > otherwise do by hand that's exactly what you're doing -- wasting
>> > > > resources.
>> >
>> > > > That's not to say 100% coverage is the only way, but certainly test
>> > > > things that have broken before, are key parts of your application,
>> > > > and
>> > > > specs written by your employer/client. At the end of the day, by
>> > > > testing your app you'll gain more confidence in your app, the fear
>> > > > of
>> > > > refactoring will be gone and you actually have something to show
>> > > > your
>> > > > boss/client that it works the way they specified.
>> >
>> > > > Testing isn't a waste of time, *NOT* testing your application is a
>> > > > waste of time.
>> >
>> > > > Nick
>> >
>> > > > On Jan 8, 8:01 am, netusco <[email protected]> wrote:
>> >
>> > > > > thanks, I appreciate the answers and I understand them but seen
>> > > > > the
>> > > > > amount of work needed on testing... isn't it faster to just test
>> > > > > your
>> > > > > app directly and debug when there's errors on it? I've been doing
>> > > > > like
>> > > > > this so far.. But I wonder if I should change that habit.
>> >
>> > > > > On 7 jan, 20:06, euromark <[email protected]> wrote:
>> >
>> > > > > > you are partly wrong
>> >
>> > > > > > for small apps the amount of time needed for complete code
>> > > > > > coverage
>> > > > > > and full web test cases
>> > > > > > is far too much compared to the value.
>> > > > > > it would be wonderful, but we simply dont have the resources
>> >
>> > > > > > so test the stuff that is tested the quickest, test the stuff
>> > > > > > that
>> > > can
>> > > > > > easily break or go wrong
>> > > > > > thats it, high coverage with low time costs.
>> >
>> > > > > > this way you have a tradeoff between those to variables
>> > > > > > and it already helps MORE than not using it at all - even if the
>> > > > > > time
>> > > > > > to write the tests wasn't that big of a deal.
>> > > > > > as soon as you have more time you can work on the coverage task
>> > > again.
>> >
>> > > > > > but testing itself is a must!
>> >
>> > > > > > On 7 Jan., 15:52, Joshua Muheim <[email protected]> wrote:
>> >
>> > > > > > > Dear netusco
>> >
>> > > > > > > I know exactly what you mean - most CakePHP tutorials about
>> > > > > > > testing
>> > > > > > > aren't that great; they expect you already have plenty of
>> > > > > > > ideas on
>> > > why
>> > > > > > > testing is good, and they only explain how in theory you can
>> > > > > > > use
>> > > the
>> > > > > > > SimpleTest library to test your CakePHP apps the same way you
>> > > > > > > have
>> > > > > > > already tested a dozen of apps before with other testing
>> > > frameworks.
>> >
>> > > > > > > YOU SHOULD REALLY DO TESTING. That's what I really want to
>> > > > > > > entrust
>> > > to
>> > > > > > > you. But I agree with you: the examples from the cook book
>> > > > > > > aren't
>> > > very
>> > > > > > > authentic. Such fine-grained testing you want to do when you
>> > > > > > > are
>> > > e.g.
>> > > > > > > creating a library that absolutely relies on every part of
>> > > > > > > itself
>> > > and
>> > > > > > > that you have written yourself, so you can't rely on the idea
>> > > > > > > that
>> > > > > > > anybody else has already done the biggest parts of testing for
>> > > > > > > you.
>> >
>> > > > > > > When using a good framework like CakePHP, you can rely on
>> > > > > > > exactly
>> > > > > > > that: most of the functionalities are tested and have proven
>> > > > > > > to
>> > > work.
>> > > > > > > So you don't really need to test *everything* in your
>> > > > > > > application,
>> > > if
>> > > > > > > you don't want to, but you should take a pragmatic approach to
>> > > testing
>> > > > > > > it in a way you have a good cost/benefit balance.
>> >
>> > > > > > > If you really don't want to much testing, then I suggest you
>> > > > > > > use at
>> > > > > > > least the scriptable browser of SimpleTest. This way you can
>> > > > > > > check
>> > > > > > > with very small effort whether the main parts of your
>> > > > > > > applications
>> > > > > > > work. You can. e.g. script the browser to register as a user,
>> > > > > > > and
>> > > > > > > after changing some parts of your application, you know with a
>> > > single
>> > > > > > > click whether it had any negative influences on the user
>> > > registering
>> > > > > > > part of your app.
>> >
>> > > > > > > I don't have time to write any more stuff, but I guess this
>> > > > > > > will
>> > > lead
>> > > > > > > you into the right direction.
>> >
>> > > > > > > On Fri, Jan 7, 2011 at 3:25 PM, netusco
>> > > > > > > <[email protected]>
>> > > wrote:
>> > > > > > > > I've been recently wondering wether to use SimpleTest or
>> > > > > > > > not...
>> > > so I
>> > > > > > > > thought to ask what does people do. As I'm learning
>> > > > > > > > programing
>> > > always
>> > > > > > > > by myself I don't know how others work... but it seems to me
>> > > > > > > > that
>> > > > > > > > using cake test for normal little applications is a pain in
>> > > > > > > > the
>> > > ass as
>> > > > > > > > for the amount of coding needed. Also to test if a function
>> > > > > > > > is
>> > > > > > > > returning correctly the format of an amount in EUR as in one
>> > > > > > > > of
>> > > the
>> > > > > > > > cookbook examples it seems to me stupid, as when I code a
>> > > > > > > > method
>> > > like
>> > > > > > > > that I try to make shure it gives back the expected result
>> > > > > > > > and if
>> > > it
>> > > > > > > > ever brakes is because I had given an invalid value or
>> > > > > > > > something
>> > > > > > > > similar...
>> >
>> > > > > > > > But I can be totally wrong as I had seen a video of mark
>> > > encoraging to
>> > > > > > > > use testing.
>> >
>> > > > > > > > So my question would be wether people use it or not and if
>> > > > > > > > people
>> > > use
>> > > > > > > > it only for big app or even for small ones.
>> >
>> > > > > > > > thanks!
>> >
>> > > > > > > > Check out the new CakePHP Questions
>> > > sitehttp://cakeqs.organdhelpotherswiththeir CakePHP related questions.
>> >
>> > > > > > > > You received this message because you are subscribed to the
>> > > Google Groups "CakePHP" group.
>> > > > > > > > To post to this group, send email to
>> > > > > > > > [email protected]
>> > > > > > > > To unsubscribe from this group, send email to
>> > > > > > > >
>> > > > > > > > [email protected]<cake-php%[email protected]
>> > > > > > > > om>For more options, visit this group athttp://
>> > > groups.google.com/group/cake-php?hl=en
>> >
>> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
>> > > others
>> > > with their CakePHP related questions.
>> >
>> > > You received this message because you are subscribed to the Google
>> > > Groups
>> > > "CakePHP" group.
>> > > To post to this group, send email to [email protected]
>> > > To unsubscribe from this group, send email to
>> > >
>> > > [email protected]<cake-php%[email protected]
>> > > om>For more options, visit this group at
>> > >http://groups.google.com/group/cake-php?hl=en
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help others
>> with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected] For more options, visit this group
>> at http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en