7

I got to refactor a module of OPA5-tests, because most of the test-cases fail currently. While trying to find the reason for the failing I found out that most of the tests aren't erroneous.

When you run them in isolation they work just fine. The problem occurs when you run them as a module. This means you run them as a group. One test after the other.

The problem occurs when one test fails. Normally you execute iTeardownMyAppFrame() as the very last method of the test. To remove the used iFrame. So that the following test finds an untouched environment in which it can run.

Now when a test fails at some line, then the test stops, and the following invocations aren't done. iTeardownMyAppFrame is never executed and the following test starts in the environment of the previous (the failed) test. So it might fail too because the environment isn't as expected.

Is there a way to make sure that every test starts in a new iFrame?

Something like "try-finally" with the iTeardownMyAppFrame in the final block. So that it is executed in any case. No matter if the test has worked or it has failed.

Greg Malewski
  • 577
  • 1
  • 7
  • 19
cluster1
  • 4,968
  • 6
  • 32
  • 49
  • 1
    Can't you catch the error the failed test throws and handle the iTeardownMyAppFrame in the catch statment ? – Lumpenstein Aug 13 '19 at 05:57
  • 1
    You need a more flexible test runner for this. Wdio does an excellent job. you need a real webdriver to manipulate the browser state – Benedikt Kromer May 04 '21 at 23:01

0 Answers0