svilen

svilen

Author of Concurrent Data Processing in Elixir

I’m using Hound with ChromeDriver and I’ve read that it is possible to run async tests (e.g. multiple browsers executing the test cases in parallel). However, I can’t find any examples/tutorials how to do this.

There’s a question on StackOverflow that was kind of a starting point, but I was still getting DBConnection.OwnershipError exceptions or other timeout errors. Then I saw this answer in the forum saying that Wallaby/Hound support async tests through a plug found in Ecto.

Could someone provide a short example how to get this working? Thanks a lot in advance!

Elixir 1.4 / Phoenix 1.3rc

Showing Posts 1 to 7

svilen

svilen OP

Author of Concurrent Data Processing in Elixir

@josevalim Thanks for the quick response, that was very helpful! I’m surprised Hound’s README doesn’t have a link to it. However, I’m still struggling to get this to work the way I think it should be.

I’ve got two tests, and when ran individually, they take ~15 seconds each (or ~30 seconds with mix test --only integration). After I added async: true I can see two Chrome browsers starting off, but strangely the total time with the async options and changes is still ~30 seconds, same as before, which seems wrong.

How could this be, is there something I’m missing? I followed the guide in the link carefully, and only made 1 change in the setup of my IntegrationCase file, due to an error:

defmodule MyApp.Web.IntegrationCase do
  use ExUnit.CaseTemplate

  using do
    quote do
      use Hound.Helpers
      import MyApp.Web.Router.Helpers
      import MyApp.Web.IntegrationCase

      @endpoint MyApp.Web.Endpoint

      hound_session()
    end
  end

  setup do
    :ok = Ecto.Adapters.SQL.Sandbox.checkout(MyApp.Repo)
    metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for(MyApp.Repo, self())
    Hound.start_session(metadata: metadata)
    # Added :ok since `start_session/2` returns a string.
    :ok
  end
end
josevalim

josevalim

Creator of Elixir

Tests in the same module do not run concurrently. Only tests in separate modules/files. I.e. the granularity of concurrency is per module and not per test. That’s because tests in the same module/file are usually exercising the same area of the codebase and would not benefit of concurrency.

svilen

svilen OP

Author of Concurrent Data Processing in Elixir

I see — to clarify, the tests are indeed split in two separate files, and each file has its own module, e.g.:

defmodule LoginTest do
  use MyApp.Web.IntegrationCase, async: true
  # ...
end

However, they do exercise the same main web application, just doing different things (one tests logging in, the other tests creating data). Would that mean that I cannot run them concurrently?

tme_317

tme_317

Hi @svilen,

Wondering if you were able to get Hound to work with an async test suite using ChromeDriver? I’ve struggled for days trying to get this to work before punting and running everything synchronously and was reminded about it this morning: Async Hound tests failing sporadically with ChromeDriver - #2 by myobie

Thanks!

svilen

svilen OP

Author of Concurrent Data Processing in Elixir

@tme_317 No, sorry, I had to put this aside and leave them running sequentially.

myobie

myobie

I recently used Hound as part of a GenStage pipeline (and spawned about 15 of this particular stage to run concurrently) and this is the code that worked well for me. I think you could create a GenServer and do the same (spawn a process for each test so they are fully isolated).

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews