From: Philip Potter

> On 6 April 2010 16:52, Bob McConnell <r...@cbord.com> wrote:
>> I have a test harness set up with a series of Selenium test scripts.
>> Each script tests a specific scenario on my web site. But I have some
>> scenarios that I want to test multiple times with different data
entered
>> each time. Currently I am using environment parameters to pass the
test
>> data into each script. But that doesn't work for multiple passes,
since
>> I have no way to save the base data and restore it after modifying
it.
>>
> [snip]
>>
>> Is there a cleaner way to pass those variables into each test script?
>>
>> How can I make this loop through some tests multiple times with
>> different sets of data each time?
> 
> I suppose you could group your variables by testcase and put them into
> a configuration file (say testcases.yml) and get each test to read in
> the configuration using Config::Any. With Config::Any you can use most
> config file formats: XML, YAML, JSON, .ini, etc.
> 
> Also you can use prove.exe to run tests under harness rather than
> using your perl one-liner. http://search.cpan.org/perldoc?prove for
> details though I normally just do "prove -bv t/*.t".

After a great deal of reading and speculation, it looks like YAML is the
way to go. I will have to move the loop inside each test script, and
iterate thorough the records read. The biggest problem is that the plan
is no longer fixed, so I do lose some auditability, but I don't see a
cleaner way to do this.

I will end up with a test.yml file (which I didn't even know existed
when I got the referenced message) defining an array of hashes, each
with input for one iteration of the test. I'll loop over the whole
scenario, stepping through the array until it is gone.

Then the next step will be to figure out how to do fuzz testing on those
forms. The response to submitting a form will change with each incorrect
input, which will present a challenge in how to detect which response is
correct and how to react to each one.

Thanks for the suggestions,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to