MinkSelenium2Driver icon indicating copy to clipboard operation
MinkSelenium2Driver copied to clipboard

run a test multiple times in parallel

Open engharb opened this issue 8 years ago • 6 comments

Dears, I want to execute the scenario or test twice and in parallel by opening two tabs. I need this test to check and see how that affects the created session features.

Is that possible=

I am looking to hearing from you soon.

Thank you in advance.

engharb avatar Aug 08 '17 11:08 engharb

You can start 2 sessions in parallel, but code in your test would be executed sequentially anyway. If test engine that calls Mink support parallel execution (does Behat or PHPUnit do this?) then it's possible. But even if possible it's unlikely that you can control which of tests run parallely with which other test.

aik099 avatar Aug 08 '17 14:08 aik099

@aik099 Thank you very much for responding on my issue. But I need to execute two tests/features/scenarios simultaneously or parallel. Is that possible or should I install an api or library beside?

regards,

engharb avatar Aug 08 '17 15:08 engharb

Mink can open 2 windows at same time, but ensuring that 2 particular tests run in parallel is responsibility of your test runner, e.g. Behat.

I guess you should look at Behat manual or report issue in there.

aik099 avatar Aug 08 '17 15:08 aik099

and as PHP itself is not threaded, it will require using 2 separate PHP processes running Behat (one running each test).

Behat itself has no feature to run tests in parallel btw. It has to be done on top of it, by calling Behat multiple times with different filters for scenarios

stof avatar Aug 08 '17 16:08 stof

However, using 2 selenium sessions in parallel will probably using 2 different windows rather than 2 different tabs. Note sure if that's OK for your case.

stof avatar Aug 08 '17 16:08 stof

Btw, if your test is actually about testing that changes done in one session are affecting the data displayed in the other one, you may not need to use 2 separate tests running in parallel. You could use a single test using multiple Mink sessions, and making changes and assertions in each session alternatively (so loading a page in a session, checking content, then using another session to change stuff, then assert content in first session again to see live-reloaded changes). If this is actually your use case, writing a single test might be much easier than synchronizing 2 tests running in parallel

stof avatar Aug 08 '17 16:08 stof