[SOLVED, Cause: Stupidity] WebTestCase submitFormById

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
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

[SOLVED, Cause: Stupidity] WebTestCase submitFormById

Post by Nathaniel »

Hi guys,

I have:

Code: Select all

class HelpTestCase extends WebTestCase
{
	function testDefaultsToIndexOfQuestions()
	{
		$this->get('http://help.yogler.com/');
		$this->assertResponse(200);
		$this->assertWantedPattern('/yogler.com help/i');
		$this->assertField('q');
		$this->submitFormById('search');
		$this->assertResponse(200, 'If this does not pass, check that the index tests pass first. Error: %s; Current URL: ' . $this->getUrl());
	}
}
http://help.yogler.com currently spits out:

Code: Select all

<html><body>yogler.com help <form id="submit" method="get" action="/search"><input name="q" /></form></body></html>
The one fail that SimpleTest comes up with is
If this does not pass, check that the index tests pass first. Error: Expecting response in [200] got []; Current URL: at line [20]
So... it appears to me that it does not like submitting the form by the id... but why? Submitting the form manually by hitting enter when the input box is in focus works as intended.

- Nathaniel
Last edited by Nathaniel on Fri Jun 09, 2006 7:18 pm, edited 1 time in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

You are doing submitFormById('search') but the ID of your form is 'submit'.
(#10850)
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Post by Nathaniel »

... yeah.

Thanks. Please excuse the oversight :D
Post Reply