Forum Moderators: coopster

Message Too Old, No Replies

How to construct a test harness

for PHP modules

         

neophyte

3:35 pm on Mar 13, 2007 (gmt 0)

10+ Year Member



Hello All -

In my never-ending search to accomplish my projects more efficiently, I'm trying the "modular" approach - not object oriented, but just "plug-in" procedural modules that would execute a specific and project-specific chore.

For example, I've been building a back-end hotel reservation system (for ever!) which needs to allow the display and editing of - how many rooms are open and reserved (one module), a check-in/check-out date picker (another module), an editable credit card info display (yet another module) - etc. The "editing" aspects of each of these modules all need field validation routines as well.

I'm happy with what I'm doing so far as I've got each task split out into a specific piece (module), but the way I've been testing these modules up to this point is when they're all "included" in a called page which is getting quite tedious.

What I'd like to do during the development phase of any given module, is to "plug" it into a kind-of test-harness, if you will. This harness would provide the variables I need for that particular module and then give me an output display of the result/submit so I can easily check what I'm getting from my code and tweak/correct accordingly.

I'm happy to write my own test harnesses for each module (as I don't want it to get too complicated and time-consuming), but can anyone advise on the "best" - and simplest - way this can be done?

Neophyte

PS: sorry this was such a windy post ... I just wanted to make sure that everyone understood what I'm trying to accomplish.

cmarshall

3:57 pm on Mar 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you aware of PHP Simple Test [lastcraft.com]?

neophyte

2:08 am on Mar 14, 2007 (gmt 0)

10+ Year Member



cmarshall -

Thanks so much for the Link!

Looked at the site and, while my head started to swim immediately, I'll download it and try to make it work for me.

Are there a lot of people using SimpleTest?

cmarshall

2:19 am on Mar 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There seem to be. I've not used it, but I heard about it from a fairly popular site (don't remember which exactly), and it is a SourceForge project.