Hi Guillaume,

this was exactly this issue. You're right, it has probably more to do with WebTest. I could imagine that the Report Listener causes problems.

You can open an issue but unless you provide the patch, I fear that nothing will happen :-(

Btw: you can use the WebTestBuilder rather than the AntBuilder. It will avoid you to have the content of your groovy step as String.

Cheers,
Marc.
--
Blog: http://mguillem.wordpress.com

Guillaume Richard wrote:
Hi Marc,
  thanks for your fast reply.

I'm using Groovy 1.7.0. I've also tried to use the latest webtest build.zip released on the website (ant 1.7.0 btw), but no chance neither.

Are you refering to http://jira.codehaus.org/browse/GROOVY-1602 ? It seems to be a pretty old one to be linked to my problem... I think :-) . If it's really a bug, I would rather think it comes from the webtest 'repeat' task, since only some steps of the iteration are "replayed" (iteration is composed with 1 step groovy, 2 steps clickLink, and 1 closeWindow - only the 2 steps clickLink and step closeWindow are re-executed after the iteration) ?
Is my Webtest script malformed ? Or should I add a JIRA ?

Cheers,
Guillaume

PS: I really have to say another 'thanks' for your blog, it really helped me at the beginning... !

2010/7/8 Marc Guillemot <[email protected] <mailto:[email protected]>>

    Hi Guillaume,

    this remembers me some old bug of Groovy's AntBuilder. Which Groovy
    version do you use?


    Cheers,
    Marc.
-- Blog: http://mguillem.wordpress.com

    Guillaume Richard wrote:

        Hi,
         I'm using webtest by retrieving some files on our website, to
        check their integrity.
        To do so, we use an Axis2 WS, which embed some groovy file
        calling a webtest ant process.
        The problem I have is purely webtest side. I have this code in
        my groovy class :

        def ant = new AntBuilder()
           ant.taskdef(resource:'webtest.taskdef'){
                   classpath(){
                       pathelement(location:"$webtest_home/lib")
               fileset(dir:"$webtest_home/lib", includes:"**/*.jar")
                   }
           };

               def config_map =
                   ['host':"www.mywebsite.com <http://www.mywebsite.com>
        <http://www.mywebsite.com>",'port':"80",'protocol':"http",'basepath':"",

                   'saveresponse':"false",'resultfile':"result.xml",
'resultpath':"$webtest_work"+date,'haltonfailure':"false",
                   'haltonerror':"false",'defaultPropertyType':"dynamic"]

               ant.testSpec(name:"getFiles"){
                   config(config_map){
option(name:"ThrowExceptionOnScriptError",value:"false")
                   }
                   steps(){
                       invoke "http://www.mywebsite.com/";
                       clickLink "My account"
                       setInputField(name: "USEREMAIL", value:
        cm.getProviderUsername())
                       setInputField(description: "Set password field",
                           name: "USERPASSWORD", value:
        cm.getProviderPassword())
                       clickButton "Poursuivre"
                       repeat(xpath:"//table/tbody/tr/td[1]/a",
                           counterName:"curRow",
                           description:"iterate on all order rows") {

                           storeXPath(property:"fileName", xpath:'$curRow',
                                   propertyType:"dynamic")
                           storeProperty(name:"counter", value:"000",
                               propertyType:"dynamic")
                           clickLink(xpath:'$curRow')
repeat(xpath:"//table/tbody/tr/td[5]/a",
                               counterName:"curBill",
                               description:"iterate on all files rows") {

                               groovy (description:"Counter for
        filename", '''
                               def props = step.webtestProperties
                               def intCounter = props.counter
                               def fName = props.fileName
        //some groovy process...
                               props.putAt("counter", intCounter)
                               props.putAt("fileName", fName)
                               ''')

                               clickLink(xpath:'$curBill')
                               clickLink(xpath:"//div[4]/p[1]/a",
                                   saveResponse:'true',
        savePrefix:'#{fileName}')
                               closeWindow()
                           }
                       }
                   }
               }

        (Basically, we have a first table of our orders, and a second
        one with pdf files. We want to check integrity of each pdf, so
        we have two loops imbricated : one on orders, another on files.)

        The problem I have is my WebTestReport shows that after my
        second repeat loop, the last three steps are always re-executed
        (2 clickLink and one closeWindow) when there is only one
        iteration. For instance, let's say I have 2 orders, one with two
        files, and the other with one file.The first loop iterates on
        orders, the second one on files of these orders.
        The first iteration of the main loop will get my two files of my
        first order with no problem, but the second iteration of the
        main loop will show this :

        <step _filename="" _line="0" description="Iteration 1/1"
        duration="1924"
                                   result="completed"
        taskName="iteration wrapper">
                                   <step _filename="" _line="0"
        description="Counter for filename"
                                       duration="29" result="completed"
        taskName="groovy">
                                       <parameter name="nested text"
        value="def props = step.webtestProperties&#xa;
         blablabla props.putAt(&quot;fileName&quot;, fName)"/>
                                   </step>
                                   <step _filename="" _line="0"
        description="open file" duration="1831"
                                       result="completed"
        taskName="clickLink">
                                       <parameter name="xpath"
        value="$curBill"/>
                                   </step>
                                   <step _filename="" _line="0"
        duration="63" result="completed" taskName="clickLink">
                                       <parameter name="savePrefix"
        value="0826ATHENQYKQ_1"/>
                                       <parameter name="saveResponse"
        value="true"/>
                                       <parameter name="xpath"
        value="//div[4]/p[1]/a"/>
                                       <resultFile
        name="005_0826ATHENQYKQ_1_clickLink.pdf"/>
                                   </step>
                                   <step _filename="" _line="0"
        duration="1" result="completed" taskName="closeWindow"/>
                               </step>
                               <step description="open file"
        duration="0" result="notexecuted" taskName="clickLink">
                                   <parameter name="xpath"
        value="$curBill"/>
                               </step>
                               <step duration="0" result="notexecuted"
        taskName="clickLink">
                                   <parameter name="savePrefix"
        value="#{fileName}"/>
                                   <parameter name="saveResponse"
        value="true"/>
                                   <parameter name="xpath"
        value="//div[4]/p[1]/a"/>
                               </step>
                               <step duration="0" result="notexecuted"
        taskName="closeWindow"/>
                           </step>

        Does anyone have an idea on what can possibly produce these
        "notexecuted" steps outside my "repeat" loop? It makes my
        process fail even though my files are correctly saved... :-(.

        Thanks !
        Regards,

        Guillaume


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to