Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I have a horde of zombies? #126

Open
IslandUsurper opened this issue Feb 18, 2015 · 9 comments
Open

Can I have a horde of zombies? #126

IslandUsurper opened this issue Feb 18, 2015 · 9 comments

Comments

@IslandUsurper
Copy link

I'm using linusnorton/grunt-parallel-behat to run up to 5 Behat tests at once, which is great for cutting down the amount of time my tests run. But once I wrote a second feature that used @javascript, I got the following error:

      Server process has been terminated: (8) [
      events.js:72
              throw er; // Unhandled 'error' event
                    ^
      Error: listen EADDRINUSE
          at errnoException (net.js:904:11)
          at Server._listen2 (net.js:1042:14)
          at listen (net.js:1064:10)
          at net.js:1146:9
          at Object._onImmediate (node_modules/zombie/lib/zombie/dns_mask.js:69:16)
          at processImmediate [as _immediateCallback] (timers.js:345:15)
      ] (RuntimeException)

I don't know if this is a limitation of zombie.js, Mink, or Behat, but I can't get away with just one @javascript test in my suite.

@aik099
Copy link
Member

aik099 commented Feb 19, 2015

It's a limitation of how we're using the Zombie. We start a NodeJS server on a specific port and then scenario connects to that port. If you run tests in parallel on a single machine, then attempt to start 2+ NodeJS servers on same port ends up with an error.

Same would go for MinkSelenium2Driver, but there you explicitly start Selenium server yourself on 4444 port so no parallel tests can be executed on same machine.

In case of Zombie it's fairly easy to overcome:

  1. track ports being used
  2. start each next NodeJS server on larger port number

@stof
Copy link
Member

stof commented Feb 19, 2015

@aik099 for Selenium2, parallel tests can actually be executed AFAIK, because Selenium2 supports opening multiple sessions in parallel (it will open a Firefox window for each of them).

@IslandUsurper what you could do is force the port used for the zombie server instead of using the default one, and using a different port for each of your test process. I don't know whether grunt-parallel-behat lets you specify per-process configuration though (it would be possible as Behat accepts being configured through an environment variable so they could implement it in the tool)

@aik099
Copy link
Member

aik099 commented Feb 19, 2015

... for Selenium2, parallel tests can actually be executed AFAIK, because Selenium2 supports opening multiple sessions in parallel (it will open a Firefox window for each of them).

@stof , won't this cause a problems in tests, that move mouse because there is single mouse and if 2 tests would try to click/move mouse then it can only work in single window, not 2 windows in parallel.

what you could do is force the port used for the zombie server instead of using the default one, and using a different port for each of your test process.

@stof , do we currently accept NodeJS server port override say via env variable? If not, then maybe we can and then update MinkExtension to set that env variable.

@stof
Copy link
Member

stof commented Feb 19, 2015

@aik099 Behat accepts the env variable when loading its configuration. and then it configures MinkZombieDriver, which allows to choose the port:


It is not about making the Mink code accept an env variable. It is about configuring Behat through env variables in grunt-parallel-behat to use a different configuration per execution process (this does not seem supported)

@stof
Copy link
Member

stof commented Feb 19, 2015

won't this cause a problems in tests, that move mouse because there is single mouse and if 2 tests would try to click/move mouse then it can only work in single window, not 2 windows in parallel.

this should be tried. But I think it works, because Selenium does not seem to take the control of the mouse at the OS level but only faking the mouse position inside Firefox. Otherwise you would not be able to use your computer at all during a Selenium run, and I am able to do it (except that each time a new page is opened, the webdriver-controlled Firefox window gets focus again instead of staying behind the window I'm using in parallel, making it annoying. I'm not sure it was doing it on Windows)

@aik099
Copy link
Member

aik099 commented Feb 19, 2015

Otherwise you would not be able to use your computer at all during a Selenium run,

Actually I can't use the computer during selenium run. For sure the focus related tests failed because while I was clicking in PhpStorm I've stole the mouse cursor from Firefox window and all failed.

@IslandUsurper
Copy link
Author

Thanks, @stof. I'll see about opening an issue with grunt-parallel-behat. Of all of the things in my toolchain, that was one that I didn't bring this up to.

@IslandUsurper
Copy link
Author

There is a problem with having grunt-parallel-behat set the port, though. Since it just calls bin/behat as a shell command, it doesn't know whether or not a feature is tagged with anything beforehand. In fact, it doesn't know if zombie is installed or not, so it shouldn't be setting anything in the environment for it.

I think a better thing to do is have a "parallel" parameter for MinkExtension, and then each driver can decide what to do, if anything, if that flag is set. MinkZombieDriver can set up several Node servers on some predefined (configurable) ports, MinkSelenium2Driver doesn't do anything since it can connect several sessions already, and so on.

@dragoonis
Copy link

@stof @everzet

You able to tell me what ENV vars are used when defining custom hostname+ports for ZombieDriver?

I have Zombie running on another docker container from my symfony2 app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants