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

Allow running individual test files in parallel via test workers #317

Closed

Conversation

david-martin
Copy link

Added a new top level config to nightwatch.json,

defaults to being disabled, i.e. behaves as nightwatch currently does:

  "testWorkers": {}

If testWorkers are enabled, a second option can be specified, with a default value of "auto":

  "testWorkers": {
    "enabled": true,
    "workers": "auto"
  }

This workers option configures how many nightwatch workers can run concurrently.

  • "auto" - determined by number of CPUs e.g. 4 CPUs means 4 workers
  • - specifies an exact number of workers

If workers are enabled, the nightwatch cli process that is invoked initially does not run any tests.
Instead, it runs nightwatch sub-processes, reporting back on results as tests finish.

Test concurrency is done at the file level. Each test file will fill a test worker slot. Individual tests/steps in a test file will not run concurrently.

@knownasilya
Copy link

👍 would love to see this merged.

@tildedave
Copy link

Fwiw also waiting on this - I've had more luck with process based parellization than selenium's own parallel support

@baconz
Copy link

baconz commented Apr 9, 2015

+1 This would be great.

@jimmyeisenhauer
Copy link

+1

@richard-flosi
Copy link

Does this start multiple instances of selenium? How does that work? Does it use different ports?
I looked at the code, but not sure how this will work. Does it require using Selenium Grid? Would it work with Selenium Grid?

@david-martin
Copy link
Author

@richard-flosi A single running selenium server is all thats needed (nightwatch can even start/stop this for you)
This works by starting multiple nightwatch test runners, and each runner starts a browser session connected back to the one selenium server.

It should work with selenium grid.
The Travis CI job connects to SauceLabs https://saucelabs.com/selenium which is akin to selenium grid

@richard-flosi
Copy link

This sounds great and we plan on using it. When can we expect this feature to be added?

@beatfactor
Copy link
Member

The plan is to include it in v0.7. It needs a bit more work on polishing
and refactoring the code to avoid duplication and making it more readable.

On Mon, May 18, 2015 at 6:53 PM, Richard Flosi [email protected]
wrote:

This sounds great and we plan on using it. When can we expect this feature
to be added?


Reply to this email directly or view it on GitHub
https://github.com/beatfactor/nightwatch/pull/317#issuecomment-103127918
.

@david-martin
Copy link
Author

@beatfactor any pointers you have for polishing, refactoring and making it more readable would be greatly appreciated

@beatfactor
Copy link
Member

Sure, I'll add some comments on the diff.

@@ -1,6 +1,6 @@
var fs = require('fs');
var path = require('path');

var async = require('async');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to avoid using async and making use promises instead?

@beatfactor
Copy link
Member

Thanks for your contribution and sorry for not accepting this. However this feature is implemented in 0.7 based on your concept.

@beatfactor beatfactor closed this Jul 15, 2015
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

Successfully merging this pull request may close these issues.

7 participants