mcdcorp / opentest

Open source test automation tool for web applications, mobile apps and APIs
https://getopentest.org
MIT License
447 stars 107 forks source link

Finally block in OpenTest #515

Closed StepanovPlaton closed 2 years ago

StepanovPlaton commented 2 years ago

Build: 1.2.4 Sep 15, 2:52 Commit: 0aa4a9d288d4

Hey! I need an analogue of "Finally block" in OpenTest. If any piece of the test fails, I want to execute the prepared macro anyway. I know about $ checkpoint: true but it takes too long, because if a 15-action test breaks in 5 actions, I have to wait 10 * 10 seconds. It is too long.

How can I implement this?

adrianth commented 2 years ago

I think I understand what you are describing and it's a feature that I've been thinking to implement, but I'm not sure it will solve your problem. So let's say you have a 15 action test that breaks in 5 places because it cannot find some of the UI elements you're trying to interact with, but you need to continue running the test whether those actions pass or fail. If I understand correctly, you'll still have to spend 10 seconds for each one of those actions waiting for those elements to appear in the page (otherwise you might be failing an action just because the application was a little slower than expected). Having a "finally" block in OpenTest will just allow you to execute some logic when the test fails - for example you might want to put some additional information in the session log to help with troubleshooting a failed test. However, you'll still have to wait 50 seconds (5 * 10 seconds) for the failing actions. Am I not understanding this correctly?

StepanovPlaton commented 2 years ago

No, I'm talking about the case when I have 15 steps and the test broke at step 5. In this case, I need to go to the Finally block and skip the rest of the steps because I know they will be wrong.

As I understand it, there is no Finally block yet?

(Sorry for my English, I use a translator)

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.