PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Dec 18, 2018 9:32 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Aug 09, 2005 8:35 pm 
Offline
DevNet Resident
User avatar

Joined: Fri Aug 16, 2002 8:57 am
Posts: 1834
Location: Watertown, MA
I'm having an issue with a multipage acceptence test. Here's the start of the test case:
Syntax: [ Download ] [ Hide ]
class ResultTrackerLoadTest extends WebAuthTestCase {

  function ResultTrackerLoadTest() {

    $this->WebAuthTestCase('Result Tracker Import Tests','siteadmin-tester',

                           'results/import_cib.php');

  }



  function testImportProcess() {

    // Page 1 Generall Inforamtion

    $this->assertTrue($this->setField('compUnix','Foo'));

    $this->assertTrue($this->setField('compName','FooBar Ballroom Dance Competition'));

    $this->assertTrue($this->setField('compURL','http://example.net/redacted/'));

    $this->assertTrue($this->setField('compType','US Collegiate'));

    $this->assertTrue($this->setField('firstdayMonth','April'));

    $this->assertTrue($this->setField('firstdayDay','2'));

    $this->assertTrue($this->setField('firstdayYear','2005'));

    $this->assertTrue($this->setField('lastdayMonth','April'));

    $this->assertTrue($this->setField('lastdayDay','3'));

    $this->assertTrue($this->setField('lastdayYear','2005'));

    $this->clickSubmitByName("submit");

    $this->assertPattern("/import_cib_2/",$this->getUrl());

    $this->assertTrue($this->setField('resultURL','http://example.com/redacted'));

    $this->showSource();

    $this->clickSubmitByName("submit");

    $this->setConnectionTimeout(600);

    $this->showSource();

    echo $this->getUrl();

    $this->assertPattern("/import_cib_3/",$this->getUrl());

   

  }

}


The last assertPattern is failing, the URL still points to the second step and the showSource returns nothing. This step is slurping up a lot of data, normally takes about 2-3 minutes (when not run in testing), hence the 10 minute timeout I set. When I cut and paste from the test case into the form, it works. I've viewed source to make sure I have exact matches on the field names.

Any clue as to why it would fail in the multipage test? I had a problem before when the simple browser wasn't propagating the HTTP_REFERER, but I no longer require/check that.

[Edit:

Changing the second submission to:
Syntax: [ Download ] [ Hide ]
$postTo=CIB_URL."results/import_cib_2.php";

    $postParam=array("resultURL"=>'http://example.net/redacted',

                     "submit"=>"Get Results");

    $temp=$this->post($postTo, $postParam);

works. But that's turning the test into something not quite an acceptance test -- its not using the website the way a "person" would in setting fields and clicking buttons....]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 12:26 pm 
Offline
DevNet Resident
User avatar

Joined: Fri Aug 16, 2002 8:57 am
Posts: 1834
Location: Watertown, MA
OK I have a working multipage load test. (Still has the funny issue from the OP) but the 5-page form is filled out and then a few of the generated pages are tested. I'll need to write one more of these to finish wrapping the form's functionality. After that I'll have confidence that the wizzard's user-facing functionality has been correctly wrapped.

I have three reported bugs to fix in it. The five pages are basically pure procedural. I want to fix the bugs and refactor to an Application Controller, Domain Model, etc.

I think it makes sense to do the refactoring before the bug hunts as that will allow for finer granularity of testing, etc. Does this make sense?

Any suggestions on initial refactoring's to start converting an existing procedural script to a more object model. I'd prefer to take it incrementally -- not just implementing a second version in parallel.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 4:26 pm 
Offline
DevNet Master

Joined: Thu Jan 30, 2003 9:26 pm
Posts: 2893
Location: Glasgow, Scotland
If you can live with the bugs for now I think I'd probably refactor first.

How to start? Good question.. If you've got an idea by now what the new OOP application framework code will look like, this should show you where to make the cuts. It can be quite difficult to separate out responsibilities when everything is mixed up - depends just how bad it is. If it's not too tangled, maybe you can do it in stages, without regressing. If it's really bad maybe it won't be possible to keep it working while you edit. It'll all have to be done in one massive effort.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group