simpletest. how to see if select is given values only.

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

simpletest. how to see if select is given values only.

Post by jmut »

howto see what values can be set in a select/radio/checkbox.

From documentation I only see how you check if can set given value...but now what available values there are.

While this does not proove any security, as form is easily spoofed, it is useful to determine
what the customer will see in a drop down for example.
User avatar
sweatje
Forum Contributor
Posts: 277
Joined: Wed Jun 29, 2005 10:04 pm
Location: Iowa, USA

Post by sweatje »

not pretty:

Code: Select all

$this->dump(
			$this->getBrowser()->_page->_complete_forms[0]
		);
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

At the risk of dereailing this thread, how often do you use dump() ? And is dump() something you should run briefly, then delete from the test code, or is it something that's acceptable to leave in the tests? (Assuming the tests will be packaged as part of a project).
User avatar
sweatje
Forum Contributor
Posts: 277
Joined: Wed Jun 29, 2005 10:04 pm
Location: Iowa, USA

Post by sweatje »

I tend to use $this->dump() temporarily, in much the same manner you would use a print_r or var_dump in "old style" programming/bug hunting. Once I know the structure of what I am looking at, I will then throw in the asserts*()s that I want and remove the dump().
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

It also seems like a convenient way to help give more descriptive information to custom asserts.
Post Reply