Sorry - here is the original post and response

Dierk Koenig <[EMAIL PROTECTED]> writes:

>
> Hi Marco,
>
> great you care about your test code!
>
> Each testSpec opens a new session.
> Therefore you cannot use the ant features as you are trying to.
>
> In your case building "modules" is the way to go.
> Modules can be realised with xml entities. &definition; and &config; are
> examples.
> Make a new file
>  "login.xml"
> place your code
>               <invoke stepid="login screen"
>                 url="WelcomeForm.aspx"
>                 save="LoginScreen"/>
>               <verifytitle  stepid="verify title"
>                 regex="true"
>                 text="Welcome"/>
>              <verifytext stepid="verify Join Up link on page"
>                 text="Join Up"/>
> into that file.
>
> Refer to that module like
>       <testSpec name="${testid}">
>         &config;
>         <steps>
>               &login;
>               <clicklink stepid="click on I forgot my Password link"
>                                 label="I forgot my Password"
>                                 save="request_new_password_form"/>
>         </steps>
>   </testSpec>
>
> In order to make xml (and thus ant and webtest) aware of that
> entity, you have to define it. This can be done inside your
> test.xml file or in the dtd you refer to. see
> http://webtest.canoo.com/manual/samples.html#Including%20Files
> The selftests that come with webtest show how to use
> entities through dtd definitions. This seems to be a little bit
> easier to manage when the number of modules grows (and modules
> again call other modules,etc.).
>
> cheers
> Mittie
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Marco Neri
> Sent: Montag, 22. November 2004 6:15
> To: '[EMAIL PROTECTED]'
> Subject: [Webtest] re: targetB depends on targetA. how to continue session
> from one target to another ?
>
> Hi Mittie/Dierk
> I have an ant file login.xml. I want to use this as a re-usable module (
> similar to the example notes modules/login.xml )
> i could get this to work if i copy the examples and declare an entity module
> for it. The notes say "As soon as you find yourself using code a second
> time, don't copy but refactor. Put it in a property, an own ant file, a
> separate target, or a module (external entity)."
> How would i set it up to call the ant file from another file and it maintain
> 'state' between the running of 1st target and 2nd. for example.
> <target name="main" depends="login,test"/>
>
>  <target name="login">
>         &definition;
>         <testSpec name="${testid}">
>          <!-- configure target host system -->
>         &config;
>                 <steps>
>           <invoke stepid="login screen"
>                 url="WelcomeForm.aspx"
>                 save="LoginScreen"/>
>               <verifytitle  stepid="verify title"
>                 regex="true"
>                 text="Welcome"/>
>              <verifytext stepid="verify Join Up link on page"
>                 text="Join Up"/>
>          </steps>
>       </testSpec>
>   </target>
>
>   <target name="test">
>   <!--&definition;-->
>         <testSpec name="${testid}">
>         &config; <-- must have this or error says  Required nested element
> <config> is not set!
>         <steps>
>         < *** at this point here I need to do an invoke or else i see error
> in the result.xml. i want to be able to continue from
> where login finished.  ***>
>
>         <clicklink stepid="click on I forgot my Password link"
>                                 label="I forgot my Password"
>                                 save="request_new_password_form"/>
>
>         </steps>
>   </testSpec>
>   </target>
> the error is com.canoo.webtest.engine.StepExecutionException: Last response
> not valid. Is a previous invoke missing?, Step: ClickLink at.
> is there anyway to maintain the state  between the 1st target and the 2nd. I
> must include a &Config or i see an error saying &Config not declared.
> what im trying to do is call one ant target and then call the other with
> assumption that the last response is saved so when i try to use click link
> it is still referencing the login page.
> is there any example of how to do this or the only way is to use entity
> module? each ant target is a discreet build with no way to pass
> state/session to another?
> for example. alluseCasesTestSuite.xml
> <property name="start.page" value="myStartPage"/>
>
> <target name="testSuite">
>         <ant antfile="UseCases/LoginAndStep.xml"/>
>         <ant antfile="UseCases/UseCase2.xml"/>
> </target>
> </project>
>
> how does this work if usecase2.xml has to start off where loginandstep.xml
> finishes?
> danke ( I'm sorry for 2 emails in 1 day!!! )
> Marco
>

On 1/11/06, Mike Danifo <[EMAIL PROTECTED]> wrote:
> Hello,
> I realize this post is over a year old, but it discusses exactly the problem I
> am currently facing.
>
> I am trying to implement a similar scenario, trying to implement a reusable
> login module.
>
> The limitation of the solution below is that I'm trying to make the login 
> module
> an ant macro, with an attribute of login.name and login.password, and the 
> below
> solution does not offer a way to call the module and dynamically pass in the
> login.name and login.password attributes.
>
> So, instead of using
>
> <!DOCTYPE project SYSTEM "../WebTest.dtd"[
>         <!ENTITY login SYSTEM "login.xml">
> ]>
>
> and calling the entity
>
> &login;
>
> I am trying to do:
>
> <import file="${webtest.script.home}/modules/login.xml"/>
>
> and calling the macro contained in login.xml
>
> <login login.name="webtest" login.password="password"/>
>
> Yet any actions after calling the macro are throwing the error is
> com.canoo.webtest.engine.StepExecutionException: Last response not valid. Is a
> previous invoke missing?
>
> Any ideas for a solution to this problem?
>
> thanks
>
> -Mike
>
>
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to