This is a migrated thread and some comments may be shown as answers.

if...else.. logical step seems not working properly

5 Answers 293 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mariko
Top achievements
Rank 1
Mariko asked on 12 Jul 2011, 08:28 AM
Hi,

I've tried using if...else.. logical step. The 'if' part just works fine but when I tried the scenario for negative test and supposed to be the 'else' part will execute, the test failed.

pseudo code goes like this:
Scenario 1
1. Navigate to application URL
2. Handle Log on dialog box (Valid Username and Password)
3. IF (Checks if application page is visible)
4. Navigate to each sections of the page and verifies each controls.
5. ELSE (Checks if page contains '<Error message>') -->> Not Executed

so, this test passed

Scenario 2
1. Navigate to application URL
2. Handle Log on dialog box (Invalid Username and Password)
3. IF (Checks if application page is visible) -->> since the page will not load, the IF part fails.
4. Navigate to each sections of the page and verifies each controls. -->> this will not be executed
5. ELSE (Checks if page contains '<Error message>') -->> this ELSE part also fails.

so for this scenario, the overall test execution fails which is not the expected result. I think the IF part and step 4 should not be executed so that the ELSE part could proceed.

I've attached screenshots of what I am doing.
Scenario1.jpg
Scenario2.jpg

Also, the above scenarios are executed separately. I've noticed that when I try to make the scenarios Data-Driven(Iteration 1 and 2), Iteration 2 being the negative test, it does not behave what is expected. Iteration 2 behaves like the Iteration 1. Invalid user can log on to the page. I think this is because Test Studio do not close Browser on every end of Iteration so even though I've added a 'Clear Cache' step at the end of the test, the credentials for Iteration 1 is still active for Iteration 2. I've also tried to set the Behavior Property ClosesBrowser = True but it has the same result. 

I've attached the Log file with a note inside. (deleted some project releted text).

Thanks!
Mariko
 

5 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 12 Jul 2011, 10:22 PM
Hi Mariko,

Thank you for the screen shots and the log. Here's a line I pulled from it for the failed iteration:

"Log on did not display because the credentials are still in the memory cache due to not closing the browser?"

Instead of using a "Clear Browser Cookies" step at the end of your IF condition, insert a Logout step. If you still need the "Clear Cookies" step, I would move that to step 1, before the "Navigate to" step, completely outside of the IFE or ELSE steps.

I agree the failure indicators are misleading for the failed iteration. The red and white "X" should be by the "Handle Logon dialog" step since that dialog never appeared and thus was not handled.

Regards,
Anthony
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
Mariko
Top achievements
Rank 1
answered on 13 Jul 2011, 03:00 AM
Hi Anthony,

Sorry for the confusion. I've created another post for Data-Driven part. Here is the link.

For this topic, kindly disregard the Data driven part. Each Scenarios are executed separately.

Our real concern was the IF and ELSE part.
The IF part works fine during the Normal processing scenario(see Scenario1.jpg) but executing the Negative test, the IF part fails and thus the ELSE part also fails(see Scenario2.jpg).
Isn't it that the IF part should be "Not Executed" and the ELSE part should be the ones to execute?
Or, is the condition inside the "IF" is not correct? are we missing something?
By the way, the verification for the IF part is checking if the Application page was visible/ enabled. The Else part is checking the error page if visible/ enabled.

Thanks,
Mariko   
0
Accepted
Anthony
Telerik team
answered on 13 Jul 2011, 04:31 PM
Hi Mariko,

I understand that you originally reported two scenarios, one without data binding and one with it. However, the screenshots and log you provided are from the data driven scenario, so that's all I had to go on (see the Iteration drop-down next to the Pass/Fail message above step 1).

You are correct; if the IF condition is not met, it and all its nested steps should be skipped (not failed), and the ELSE and its steps should execute and pass.

I suspect the reason the iteration with the invalid credentials fails on the IF is because of the Verification the IF is based on. If you double click the red and white "X" for that step's failure details, I would guess it failed with the "Unable to locate element" message. When the logon fails, the element does not exist to verify on the failure page as it does on the successful page (your actual application).

So, you'll need to find a common element that exists on both pages so it can be located and verified on successful and failed attempts. This might be difficult or not possible, depending on how your application is built.

All the best,
Anthony
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
0
Mariko
Top achievements
Rank 1
answered on 14 Jul 2011, 01:23 AM
Thanks Anthony! :)

Yup, you were right. Our application page contains the silverlight controls while the error page is just a generic error page with labels. I will bring this up to the design team to come up with the design so that Main page and error page could have a common placeholder or something.

Hmmm.. just for a "nice to have", maybe you should improve the logic for Test Studio's Logical steps. Most of us(testers) are not very good in codes so we have this tendency to mark it as fault.

Thanks again! Hope you'll never get tired answering our future questions! ^^,

Cheers,
Mariko
0
Anthony
Telerik team
answered on 14 Jul 2011, 03:55 PM
Hello Mariko,

Thank you for the feedback. I agree that the Logical Steps could be made more user friendly and logged a Feature Request.

Please contact us again if you have further questions.

Best wishes,
Anthony
the Telerik team
Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

Have you looked at the new Online User Guide for Telerik Test Studio?
Tags
General Discussions
Asked by
Mariko
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Mariko
Top achievements
Rank 1
Share this question
or