[Webtest] [webtest][JIRA] Created: (WT-139) IfStep : Specify test as a group of steps to execute

Gerald Klopp (JIRA) webtest@lists.canoo.com
Fri, 20 Jan 2006 13:46:55 +0100 (CET)


IfStep : Specify test as a group of steps to execute
----------------------------------------------------

         Key: WT-139
         URL: http://webtest-community.canoo.com/jira/browse/WT-139
     Project: WebTest
        Type: New Feature
    Reporter: Gerald Klopp
 Attachments: ifstep.zip

The test of the ifStep cannot be based on the result of the execution of other steps.
For example, I want to click on a link only if a given text is present on the page.
The follwing code doesn't work :

  <target name="testIfStep">
    <webtest name="testIfStep">
      <config 
        host="host"
        port="80"
        protocol="http"
        basepath="" 
        haltonfailure="false"
        failureproperty="failure" />
      <steps>
        <verifyText text="text to check">
        <ifStep test="${failure}" >
          <!-- Steps to execute if the text 'text to check' is not present -->
          <clickLink label="myLink" />
        </ifStep>        
      </steps>
    </webtest>
  </target> 
  
Indeed, setting the 'haltonfailure' property to false doesn't resolve the problem because the ifStep is never reached.

One solution could be to modify the ifStep and have the possibility to specify the test as a group of steps to execute.
For example :
        <ifStep>
          <test>
              <!-- Steps to execute to evaluate the test -->
              <verifyText text="text to check">
          </test>
        </ifStep>
          <!-- Steps to execute if the test is true -->
          <clickLink label="myLink" />
        </ifStep>

I made the modification for my own needs but, if you think this is an interesting feature, it could be integrated in the project.

Here is the new behaviour :
The test and unless conditions can be specified as inner tags.
It contains one or more steps to execute.
Using the nested 'test' tag, if all steps succeed, the test is true
Using the nested 'unless' tag, if one of the steps fails, the test is true

Attached find the source code I've modified.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira