|
I've just started digging deeper into Zend_Form and I'm interested in
how to go about unit testing them. I've looked through the PHPUnit docs, zf-general archives, and Pádraic Brady's blog (briefly) but haven't found anything extremely useful. So can anybody here point me in the direction of any articles that deal with this? Cheers, -- Steven -- スティーブン |
|
On Tue, Jan 5, 2010 at 7:56 PM, Steven Szymczak
<[hidden email]> wrote: > I've just started digging deeper into Zend_Form and I'm interested in how to > go about unit testing them. I've looked through the PHPUnit docs, > zf-general archives, and Pádraic Brady's blog (briefly) but haven't found > anything extremely useful. So can anybody here point me in the direction of > any articles that deal with this? Are you trying to use Zend_Test or just PHPUnit by itself. Personally, the built in support for PHPUnit and ZF MVC rocks, though, like every ZF Component, takes a little of work to get started. The best resources I've found for this are: Unit Testing with the Zend Framework with Zend_Test and PHPUnit http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/comment-page-1/ I know it's a drag, but really, read every line in the manual, and work along with the examples: http://framework.zend.com/manual/en/zend.test.html - jake > > Cheers, > -- Steven > > -- > スティーブン > > |
|
I'm not too fussed about whether the testing is carried out using
Zend_Test or standalone PHPUnit. I'm just trying to be conscientious about testing; and, since I'm working on a user control module at the moment, I'm interested in testing Zend_Forms specifically. Jake McGraw wrote: > On Tue, Jan 5, 2010 at 7:56 PM, Steven Szymczak > <[hidden email]> wrote: >> I've just started digging deeper into Zend_Form and I'm interested in how to >> go about unit testing them. I've looked through the PHPUnit docs, >> zf-general archives, and Pádraic Brady's blog (briefly) but haven't found >> anything extremely useful. So can anybody here point me in the direction of >> any articles that deal with this? > > Are you trying to use Zend_Test or just PHPUnit by itself. Personally, > the built in support for PHPUnit and ZF MVC rocks, though, like every > ZF Component, takes a little of work to get started. The best > resources I've found for this are: > > Unit Testing with the Zend Framework with Zend_Test and PHPUnit > http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/comment-page-1/ > > I know it's a drag, but really, read every line in the manual, and > work along with the examples: > http://framework.zend.com/manual/en/zend.test.html > > - jake > >> Cheers, >> -- Steven >> >> -- >> スティーブン >> >> -- スティーブン |
|
Hello,
try also Selenium. It is an additional testing, especially for forms. Greetings Andreas Am Mittwoch, den 06.01.2010, 01:45 +0000 schrieb Steven Szymczak: > I'm not too fussed about whether the testing is carried out using > Zend_Test or standalone PHPUnit. I'm just trying to be conscientious > about testing; and, since I'm working on a user control module at the > moment, I'm interested in testing Zend_Forms specifically. > > > Jake McGraw wrote: > > On Tue, Jan 5, 2010 at 7:56 PM, Steven Szymczak > > <[hidden email]> wrote: > >> I've just started digging deeper into Zend_Form and I'm interested in how to > >> go about unit testing them. I've looked through the PHPUnit docs, > >> zf-general archives, and Pádraic Brady's blog (briefly) but haven't found > >> anything extremely useful. So can anybody here point me in the direction of > >> any articles that deal with this? > > > > Are you trying to use Zend_Test or just PHPUnit by itself. Personally, > > the built in support for PHPUnit and ZF MVC rocks, though, like every > > ZF Component, takes a little of work to get started. The best > > resources I've found for this are: > > > > Unit Testing with the Zend Framework with Zend_Test and PHPUnit > > http://www.zendcasts.com/unit-testing-with-the-zend-framework-with-zend_test-and-phpunit/2009/06/comment-page-1/ > > > > I know it's a drag, but really, read every line in the manual, and > > work along with the examples: > > http://framework.zend.com/manual/en/zend.test.html > > > > - jake > > > >> Cheers, > >> -- Steven > >> > >> -- > >> スティーブン > >> > >> > -- Kraftl EDV - Dienstleistungen Linux, Linuxschulungen, Webprogrammierung Autofabrikstraße 16/6 1230 Wien |
|
In reply to this post by Steven Szymczak
Hi, Steve.
I just wonder if you have found any good ways of testing Zend_Form classes? Dmitry. |
|
You should only need to unit test your forms if they are adding
functionality to Zend_Form. The built in Decorators, Filters, Validators, etc should already be tested. If you're using a custom Decorator, Filter, Validator, or View, you should test those separately from the form. With that said, your integration tests only need to test that $form->getValues() returns the expected filtered values and blocks values you expect to reject. You would essentially setup a list of inputs that are valid, loop over them and pass them to the form, and make sure it validates. Then pass it a set of bad values, loop over them, and assert that they do not validate. You're actually testing the configuration of the form here, not the form classes themselves. I can mock up a quick test if that doesn't make sense. On Tue, Apr 6, 2010 at 12:33 PM, dmitrybelyakov <[hidden email]> wrote: > > Hi, Steve. > > I just wonder if you have found any good ways of testing Zend_Form classes? > > Dmitry. > -- > View this message in context: http://n4.nabble.com/Unit-testing-Zend-Forms-tp999542p1753068.html > Sent from the Zend Framework mailing list archive at Nabble.com. > -- A.J. Brown Software Engineer, ZCE blog : http://ajbrown.org talk : (937) 540-0099 chat : IntypicaAJ |
|
This post was updated on .
Hi A.J.! On the contrary - that makes a lot of sense. I was first thinking of an approach to test forms through the corresponding controllers, but i like yours one better. I think its more logical to do it this way - thanks a lot for the hint! Good luck, Dmitry. |
|
On Wed, Apr 7, 2010 at 12:09 PM, dmitrybelyakov
<[hidden email]> wrote:> > On the contrary - that makes a lot of sense. I was first thining of an > approach to > test forms through the corresponding controllers, but i like yours one > better. > I think its more logical to do it this way - thanks a lot for the hint! For the list of inputs you can take advantage of PHPUnit's @dataProvider annotation. You can also test end-to-end with Zend_Test to check, for example, that the form sends to the right action with the right method. -- Giorgio Sironi Piccolo Principe & Web Engineer http://giorgiosironi.blogspot.com http://twitter.com/giorgiosironi |
| Powered by Nabble | Edit this page |
