gngrOrg/grinder

Try to parallelise the test running algorithm

hrj opened this issue · 3 comments

hrj commented

Currently, the test runs sequentially:

  1. Navigate to test URL
  2. Take a screenshot
  3. Compare the test and reference screenshots

If we used a simple actor system, we could do #3 in separate actor.

Down the line we could parallelize it even more:

  • Pre-fetch URLs to warm up the OS cache
  • Open more than one window in the browser, so that navigation to different test URLS could be done in parallel.
hrj commented

This could be a very cool task to pickup @atiqsayyed (when you get free).

hrj commented

@atiqsayyed

Thinking more about this: you needn't use actors; it might be simpler to use Futures with an ExecutorService. The advantage of Future is that you can chain operations together easily and let the ExecutorService do the scheduling.

This is a very high level sketch of how this would work:

  • You would create a future task for each test. This future will in turn depend on two futures: a future for getting the screenshots and a future for comparing the screenshots.
  • All the above futures would be added to a queue.
  • The main thread will pickup the first future in the queue and then wait for its completion. After completion, it will update the status (progress bar, etc) and then pickup the next future.

Hint: the webdriver object will need to be locked till both the screenshots are acquired. Alternatively, the future for getting screenshots should be scheduled on a single threaded executor-service.

@hrj this is cooooool. . . I'm picking it up!