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

asynchronous execution when a new browser is connected #370

Closed
manevpe opened this issue Feb 28, 2013 · 3 comments
Closed

asynchronous execution when a new browser is connected #370

manevpe opened this issue Feb 28, 2013 · 3 comments

Comments

@manevpe
Copy link

manevpe commented Feb 28, 2013

In the current behaviour, if Testacular is executing against a browser, and a new browser connects to the server, the latest is put into idle wait, until the running execution finishes. After that the execution is run for all browsers from the beginning.

My proposition is - in such a case, start execution with the new browser immediately, and report for all browsers after that. No need to wait for the first one to finish.

In my CI setup, I'm starting testacular with no browsers, then using WebDriver to start some browsers and connect to Testacular, and when everything is done close all browsers and stop testacular. This execution is slow, because it is executed twice - once for the first browser to connect, and then again for all browsers at once. This could be avoided with this proposition.

Ideally, it would be possible to close a browser that has finished and still get the report for it.

@vojtajina
Copy link
Contributor

Yep, your proposal is right. We should decouple the execution, there's already an issue (https://github.com/testacular/testacular/issues/57) for it, so I'm closing this as duplicate.

In the meantime, as a workaround, you could let Testacular to start the browsers (a custom launcher to do whatever you want - eg. start it using WebDriver; current master already has support for plugins and I hope we gonna have a WebDriver launcher/plugin soon).

Another workaround could be - start Testacular with --no-single-run and --no-auto-watch, so that it does not trigger the run automatically. Capture all the browsers you want and do testacular run.

@drkibitz
Copy link

Maybe this issue should be reopened?

I'm currently using karma-webdriver-launcher, selenium grid, and ios-driver. Everything is working fairly well, except one thing.

The problem is that karma waits to execute tests until all browsers are connected. The reason this is a problem is because there is only one iOS Simulator, and even though ios-driver is capable of using it for multiple targets, it can't use it at the same time. In particular, it is capable of sessions for both iPhone and iPad, but they are meant to be handled successively.

The problem arises when I want to test both iPhone and iPad in the simulator. It goes like this:

  • Run Karma with Single run, and targeting both iPhone and iPad simulators
  • Karma sends a request to the grid for iPhone and iPad nodes
  • The grid sees that both nodes are available even though they are on one machine
  • The first target launches, lets say iPhone simulator (this depends on which one was first in the config)
  • iPhone simulator connects to Karma server
  • It then waits for next browser (iPad), which will never launch

I can't figure out how to launch ios-driver without it giving both iPhone and iPad as an available browser, but I don't know if this is the right behavior anyway. ios-driver works great with other desktop browsers, and a single ios target. This just happens when running 2 or more simulator targets, and those targets live on the same machine.

I initially questioned what this issue was or if it is an issue at all. Maybe it is just the way my grid is set up. But after thinking about it, I really wandered if it was necessary for Karma to work like this? Does it really have to wait for a connection on all browsers before running any tests? Can't it just start the run on the browser that connected, then compile the data of all the runs after all of them have completed? I would think this was the way it would work to run faster and with more parallelism.

Maybe this is instead an issue with karma-webdriver-launcher, but I haven't looked at the guts of it thoroughly yet.

@drkibitz
Copy link

Ok had a look and this is definitely the way Karma works:
https://github.com/karma-runner/karma/blob/master/lib/executor.js#L18

So I am still wondering as to why?

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

3 participants