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++; }

In reply to Testing Against Two Sites at Once with WWW::Mechanize by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.