RU beehive logo ITEC dept promo banner
ITEC 325
2017fall
ibarland

homelectshws
D2Lbreeze (snow day)

forms-test-handler
testing forms

We've been talking about input forms (html elements), and then php scripts to process a submitted form:

testing a form-handler

Video: easily testing a form-handler (18m38s)

Our functions have test cases, and this helps gives us confidence before we ever deploy to the web. But what about form-handlers? The result from form-handler is a long page that includes various bits from the form. It's too tedious to make this a check/expect sort of test, since the details of the html part of the output aren't relevant (and might change). Moreover, generating the page requires the POST data, that were entered by hand back in the form. But we would like to be able to check that the form-handler without going through the web, and also eyeball-check the result on certain inputs w/o having to continually re-type the inputs and call up the form.

Solution: Make a php program which simply initializes $_POST, and then require's the form-handler. Recall the sample form from last lecture (and recall what happens when it submits). Then, inspect:

Awesome sauce: We can run these handler-tests locally, or over the web. The former is useful when the latter isn't showing up as expected.
Although we use these to manually test our handler, they are not unit tests (they're not automated). Admittedly, the filename topic-handle-sample-input-N.php might be better a more descriptive name than just topic-handle-test-N.php, but we'll concede to a shorter, more convenient name.

video from distance lecture (breeze), 2017-feb-14 (1h23m), REVIEWING this info

homelectshws
D2Lbreeze (snow day)


©2017, Ian Barland, Radford University
Last modified 2017.Sep.27 (Wed)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.