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

If.. else question

10 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mariko
Top achievements
Rank 1
Mariko asked on 10 Jan 2012, 09:52 AM
Hi,

I'm using ur site as a scenario (http://www.telerik.com/automated-testing-tools.aspx)

IF (Test Studio Link isVisible) Then
Login
Else
Search site

The test failed because it was unable to locate the element. Question is what if the element that i'll be using for our application is not located in the other page it will fail. Is there a way to bypass this? that if the Test Studio Link(unique element) is does not exist go automatically to Else?

Thanks

10 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 10 Jan 2012, 04:45 PM
Hi Mariko,

If I understand correctly your use case, you don't want your test to fail if the element doesn't exist. If that is correct you need to change the verification in the IF statement to "Verify Exists" instead of "Verify is Visible". Please check this video. Note that I intentionally changed the Find Settings for the Test Studio link, so that it cannot be found.

Now, if I check for the element visibility I'm getting "Unable to locate Element" exception, but if I change this to Verify Exists it will go to the Else statement and the test will pass. 

Hope this helps!

All the best,
Plamen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Joey
Top achievements
Rank 1
answered on 28 Jan 2015, 03:30 PM
Thanks for the helpful video, Plamen.  

I came across this same issue, and was attempting to use your solution of a "Verify Exists" step instead of "Verify is Visible" step, but it doesn't look like that verification option is available anymore.  Now you just have "IsVisible", "Content", "Attributes", "Style", "IsEnabled", and "Image".  

Has the "Verify Exists" option been removed?  Or is there an alternate way to invoke it?

Thanks,
Joey

0
Joey
Top achievements
Rank 1
answered on 28 Jan 2015, 05:52 PM
I found a solution that worked for me and wanted to update my post...

I ended up using an "If ( wait for element exists )", which seems like it does the same thing as the Verify Exists that Plamen mentioned, but waits a specified amount of time before deciding if the object exists / doesn't exist.
0
Boyan Boev
Telerik team
answered on 30 Jan 2015, 09:01 AM
Hi Joey,

Thank you for contacting us.

Verify exists is not removed from Test Studio. You can add this step either by changing the role of the WaitForExists step or through the Step Builder.

However WaitForExists step is more reliable in some cases so I recommend to use this step as you did.

If you need further assistance please let us know.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Joey
Top achievements
Rank 1
answered on 30 Jan 2015, 01:15 PM
Thanks for the response, Boyan.  The WaitForExists step is working for me, so I'll keep my test as is for now.  But this is good info to know for next time...

Thanks!
--Joey
0
Boyan Boev
Telerik team
answered on 30 Jan 2015, 01:21 PM
Hello Joey,

I am happy I could help.

If you need further assistance please let us know.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Kris
Top achievements
Rank 1
answered on 10 Feb 2020, 07:29 PM
I am using this to confirm a successful login.  However, it makes the execution of the test very long.  We receive an error message on an unsuccessful login attempt.  I look for the error message with a Verify Contains.  I set the timeout to 3 seconds.  When I execute the test with a successful login, it waits 10 seconds + the 3 seconds to move on through the rest of the test.   How can I make this quicker?
0
Plamen Mitrev
Telerik team
answered on 11 Feb 2020, 10:44 AM

Hello Kris,

Thank you for contacting us.

It seems to me that the verification step waits for the full timeout, when you have a successful login. This is expected, because the error message is missing.

I am not sure what is causing the additional execution time. Please share the Test Studio project for me to analyze and I will try to advise you further. If you are not comfortable with sharing your working project, you can record a sample test against www.telerik.com and send that one over.

Please check the one that I attached and analyze its configurations and steps. I did change the "ExpectedString" to make the verification fail and wait for the full timeout.

I am looking forward to hearing from you.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Kris
Top achievements
Rank 1
answered on 11 Feb 2020, 03:32 PM
I found this https://docs.telerik.com/teststudio/general-information/test-execution/quick-execution.  It helped speed up the tests greatly.
0
Plamen Mitrev
Telerik team
answered on 12 Feb 2020, 12:51 PM

Hello Kris,

I assume that you have made some changes to the Execution Timeouts and especially to the "Wait on Elements" setting. Please keep in mind that this is a global configuration and will be applied to all test steps against elements.

I am glad to know that you found a way to speed up the test execution for your test scenario. Please do not hesitate to contact us again, if you need any help.

Regards,
Plamen Mitrev
Progress Telerik

 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Mariko
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Joey
Top achievements
Rank 1
Boyan Boev
Telerik team
Kris
Top achievements
Rank 1
Plamen Mitrev
Telerik team
Share this question
or