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

Test fails on Step even though Step is marked as "Continue on Failure"

6 Answers 241 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sven
Top achievements
Rank 1
Veteran
Sven asked on 18 Jan 2021, 12:37 PM

Hi,

I want to execute the loop pictured in attachment "loop.png". Both the loop and the "Click"-command are marked as "Continue on Failure".

The button that is supposed to be clicked is the button to close a tab on the website. The loop is supposed to close all tabs. Hence, the loop is expected to have failed executions if there are less than 10 tabs open. As the step is marked as "Continue on Failure" I would assume that the test execution is not failing if these steps are failing.

When I execute the test, the loop will close all tabs on the website. Some loop iterations will fail as there are no more tabs to close. When the loop is being executed for the 10th time, the test fails. The log is attached: log.zip.

What optiosn do I need to enable to make sure that failed command executions do not result in a failed test?

6 Answers, 1 is accepted

Sort by
0
Sven
Top achievements
Rank 1
Veteran
answered on 18 Jan 2021, 12:47 PM

I noticed that it works if the 2 commands are copied 10 times in a row (as in screenshot "notloop.png").

Are you sure the "Continue on Failure" setting is respected when used inside a loop?

0
Elena
Telerik team
answered on 18 Jan 2021, 02:55 PM

Hello Sven,

Thank you for sharing details for the encountered issue. 

Based on the partial execution log you provided, it seems that the loop steps are part of a test as step. Please, let me know if this assumption is not correct. 

However, if it is, then you need to enable the ContinueOnFailure flag for the test as step in the main test as well. This is how the main test execution will continue no matter what is the outcome of the nested test run. 

I hope that this will help you to set up the tests as desired. Let me know in case of any further questions.

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
0
Sven
Top achievements
Rank 1
Veteran
answered on 19 Jan 2021, 09:23 AM
Hello Elena,

Thank you for your answer. I tried your suggestion and it works for my test case execution. Please note that this double error handling is counter intuitive because all popular programming languages don't require it. Maybe it makes sense to clarify in the documentation.

However, in the same context I still have trouble with an if-statement: The screenshot "if-else.png" is part of a test that is executed as "Execute test"-command. The commands in the if-else-statement and the "Execute test"-command are marked as "Continue on Failure". I want to click an element ("Icon Gelbe Weltkugel oben links") only if another element ("Left Hand Menu eingeklappt") is visible. 
The test continues to execute in both cases: If element "Left Hand Menu eingeklappt" is visible, the extra click is executed, otherwise only the comment appears in the log. However, if the if-condition ist not satisfied, the test execution will be marked as failed. Is there a way to prevent this? In this context, I don't care whether the extra-click was executed or not, both conditions are valid.
0
Elena
Telerik team
answered on 20 Jan 2021, 04:19 PM

Hi Sven,

Thanks for sharing your thoughts on the 'ContinueOnFailure' flag and its usage. I'll definitely keep your feedback in mind and this will be included in the documentation as soon as possible. 

In regards the if..else condition you need to adjust, should I understand that the element ("Left Hand Menu eingeklappt") is not present on the page when this is not visible? Is this what you mean when saying that the if condition fails? 

If this is so, the error you get in the test failure should be that the target element is not found and that means it is not present in the current DOM tree. Thus the execution engine does not get to the condition in the if portion at all. So, if you need to test if the element is either on the page, or not, you need to use a verification if element exists - you can create such in the Advanced verification mode. That way the if condition should not be failing. 

Let me know, if these suggestions are not relevant. Thank you for your time in our discussions.

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
0
Sven
Top achievements
Rank 1
Veteran
answered on 21 Jan 2021, 07:19 AM

Thank you for clarifying the difference between "exists" and "visible". Indeed, I am interested in whether the element exists.

After changing the varification to "exists" I get the expected result. 

0
Elena
Telerik team
answered on 21 Jan 2021, 01:21 PM

Hi Sven,

I am glad to know the provided information helped to adjust the test as needed. 

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
Tags
General Discussions
Asked by
Sven
Top achievements
Rank 1
Veteran
Answers by
Sven
Top achievements
Rank 1
Veteran
Elena
Telerik team
Share this question
or