[Webtest] Re: Configuring IfStep to fail when condition fails

Mart Toom Mart Toom <mart.toom@aqris.com>
Fri, 19 Oct 2007 15:26:34 +0300


Hi Marc,

It seems that sometimes helps when you can talk with someone or write down your problem :-)

I now redesigned my test this way that I don't need to get ifStep to fail.
I just removed wrapping <not> tag and put it inside the <ifStep> tag.

Thanks anyway and sorry for wasting your time,

Mart T

Mart Toom wrote:
> Hi,
> 
> My exact purpose is to verify that user can not go to some certain page. 
> There are two kinds of users:
> - one can not see even link to the page (link is radiobutton select field)
> - one can see the link but when following it, error message is created.
> 
> So I prepared test like following:
> 
> <not description ="user should not be able to go there">
>         <ifStep description = "If true, then..." >
>             <condition >
>                 <verifyInputField
>                     description = "Check if select is visible for user"
>                     name="SelectId"
>                     value = "${id}" />
>             </condition>
> 
>             <setRadioButton
>                 description = "Select item for editing"
>                 name = "SelectId"
>                 value = "${id}" />
>             <clickButton
>                 description = "Go to edit mode"
>                 label = "${button}" />
>             <verifyText
>                 description = "Verify text on page"
>                 text = "${label}" />
>              <verifyElementText
>                           description="Check that the name is changed"
>                           type="span"
>                           htmlId="ElementSerialId"
>                           text="${SecondName}" />
>         </ifStep>
> </not>
> 
> The script works well when the condition doesn't fail, so for second 
> type of users.
> But when the condition fails, ifStep gives always back positive answer 
> and the test fails. Even if in real life it actually works ok.
> 
> BR,
> 
> Mart T
> 
> Marc Guillemot wrote:
>> Hi Mart,
>>
>> your wish seems not very logical to me: this is exactly the aim of
>> <ifStep><condition> not to fail when the condition fails.
>>
>> Otherwise you just have to... put the content of <condition> outside of
>> the ifStep.
>>
>> The better solution would probably to have the information on the user
>> to know what has to be done for him.
>>
>> Marc.