minkphp / MinkSelenium2Driver

Selenium2 (webdriver) driver for Mink framework
MIT License
508 stars 163 forks source link

run a test multiple times in parallel #271

Open engharb opened 7 years ago

engharb commented 7 years ago

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.

aik099 commented 7 years ago

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.

engharb commented 7 years ago

@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,

aik099 commented 7 years ago

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.

stof commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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