Page 1 of 1

simpletest. set radio button value

Posted: Thu Aug 24, 2006 3:45 am
by jmut
Hi
I have a form...and I am trying to choose radio button.
in the form originally on choosing radio button the form is submitted.
The idea is different drop down...on another part of the page based on the radio button choosed.
The problem is I cannot make this radio button set.
I tried.

Code: Select all

class Test extends WebTestCase {

    function testHomepage() {
        $this->assertTrue($this->get(URI));
        $this->assertField('product_id',true,'Product Id missing');
        $this->assertField('product_id',925);//this is default value for a radio type input
        //$this->assertField('form1',true,'Form1 does not exist');//howto validate the such formname exist?
        //$cookie = $this->getCookie('sid');//howto get the sessoin_id?
        $this->setField('product_id',921);//trying to set radio input field to 921 but does not work.
        $this->assertField('product_id',921);//this failes because the previous statment does not work.
        $this->clickSubmitByName('form1');
        $this->showSource();
    }

}
Edit: BTW I use Simpletest: 1.0.1alpha3

Posted: Thu Aug 24, 2006 3:51 am
by jmut
damn...now I saw something int the docu http://www.lastcraft.com/form_testing_documentation.php

Sorry for this post :(