hesco has asked for the wisdom of the Perl Monks concerning the following question:

Greetings all:

Today I'm working on a test script to test the interaction between two applications we're working to integrate.

I'm using WWW::Mechanize to submit my data.

Using Test::DatabaseRow I have determined that the new app we're developing now is successfully writing its data to the backend used by the existing application we're integrating with.

I then use WWW::Mechanize to log in to the existing application to check that the data we just inserted with our app under development is actually visible to the existing application its being integrated with.

I've even gone so far as to create a new WWW::Mechanize object, so that $agent-> methods are used to exercise our application under development and $agent2->methods are used to interact with the existing application we wish to integrate with.

Even so, I keep getting errors which suggest that its not finding the login form it's supposed to for the existing application, on the second test case. Before that error shows up, though, after successful tests showing that the form I post my data to is properly rendered, my database insertion tests fail, on the second iteration, after everything worked fine on the first $test_case.

We haven't tried to integrate the authentication methods for these two apps yet. A unified login is still a pretty low priority for the client. Each time I have WWW::Mech switch back and forth I have it negotiate the authentication again. It seems willing to do this, logging in first to our new app, then to the existing app, then back to the new app, before dying. The test results suggest this is working well to this point.

Any ideas on what I might look for would be appreciated.

-- Hugh

UPDATE:

Coming back to this issue after a break, having framed this question, a solution became obvious.

I just wrote an additional loop to handle all the interactions with the application we're integrating with, which is distinct from the loop which is interacting with the application we are developing. I'm storing the relevant state information needed by the second loop in the %test_case hash. And my first test just completed as I wrote this, in:

real 3m43.213s user 0m0.720s sys 0m0.020s
It had been bombing out after about thirty seconds before. Now on to read the results and see what we've got.

if( $lal && $lol ) { $life++; }