How to use the same browser instance to run multiple tests?

Hey folks,
I’m trying to run some tests but would like the test to use current session/browser instance to continue the tests.
ex: test 1 finishes execution, test 2 picks up on the same browser instance and so forth

So I saw this question asked before…but there was really no resolution to it. Only thing I saw is “use Open browser…”
can someone throw a detailed answer here into how this can be done?

the right answer is ‘don’ t close the browser’ at the end of a testcase, but in a testsuite end listener

the open browser is just misleading, but perhaps you woul like to do that also in testsuite listener… or make sure you use it only once in the first testcase

A bit like @bionel is telling you, you need to decide what your Test Case philosophy is:


  1. Test Cases should be standalone. Each TC does exactly what it needs to do to execute the user scenario and then quit.

  2. Test Cases are always part of a Test Suite. Each TC can benefit from and rely on TCs that executed earlier in the suite.

Choose #1 or #2. Trying to do both, while not impossible, will likely cause confusion – especially if other people are using your code base – and even moreso if you’re new to testing.

Aside: you could consider using WebUI.callTestCase() which, sadly, is no longer documented for some reason. But again, you’ll need to make sure dependent TCs are suitably documented as reliant on a parent/host TC.

I get all that…
this is really for a specific sets of test suites where i’d like the tests to continue using same browser instance. I mean i don’t think this is even a big ask honestly…

I don’t want to use callTestCase() on these specific tests due to performance issues… and that’s literally why I need the first test to login and set up the data… and then bunch of other tests that would continue execution on that same instance.

and even if I choose not to closeBrowser() - the next test does not continue on that browser… that’s basically what my ask is

ok… i don’t know whether to facepalm myself or this was recently changed…
i swear i tried to do this before…and the test never did pickup the last instance…

but it looks like now it IS doing that. I hate Fridays.