praveenperera

praveenperera

Wallaby vs Hound?

Theres a new tool for acceptance testing called Wallaby, I was wondering if anyone has experience with it. I was specifically wondering how it compares to Hound, as that’s what I am using right now.

From this blog post it seems like it might be faster because it takes advantage of Ecto 2.0 features and runs all the tests concurrently?

Most Liked

keathley

keathley

Sorry for the late reply. I’ve been traveling for a few days.

Hound and Wallaby are similar in a lot of ways but different in a few key areas. I’ll try to break down what I think are the key differences and highlight why we wanted to build Wallaby in the first place.

Api

This is the biggest difference between the two libraries. Both Wallaby and Hound use Webdriver to talk with the browser. So under the hood its using a lot of the same functionality. The key differences are in the developer experience.

Wallaby’s api was designed in the same spirit of Capybara’s api. It defaults to finding elements by css and allows you to interact with form elements by their label text, name, or id. Under the hood it uses xpath to do more these dynamic selections. This allows you to write interactions like:

find(".user_form")
|> fill_in("First Name", with: "Chris")
|> fill_in("last_name", with: "Keathley")

I find that writing tests in this way conveys more meaning in your tests both for yourself and other people working with you.

By default, Wallaby will only allow you to interact with elements that a user would see. If a element exists on the page, but its not visible to a user Wallaby will block until it either becomes visible or until it times out and raises an error.

Hound’s api is a bit more explicit then Wallaby’s. For instance with finders you specify the “strategy” that you want to use to select elements on the page:

find_element(:name, "message")
find_element(:css, ".message")
submit_element(element)

As far as I know Hound will allow you to select any element on the page even if its not visible to the user. I hope that HashNuke or tuvistavie will correct me if I’m wrong about this.

Browsers

Wallaby (currently) only supports PhantomJS. However, we manage Phantoms for you. When Wallaby starts up we start a pool of Phantoms. Each test case checks out one of the Phantoms before it runs. That way we get test isolation between browsers and don’t pay startup costs for starting and stopping phantom.

Hound supports multiple browser tools (Selenium, PhantomJS, etc.). However it doesn’t manage any of these for you. You have to start up the driver and tell Hound what you’re using.

Concurrency

Wallaby and Hound BOTH support concurrent tests with Phoenix using the SQL Sandbox plug in phoenix_ecto. The difference is that Wallaby uses multiple browsers simultaneously. I haven’t benchmarked Hound and Wallaby so I can’t speak to the relative performance benefits of either.

There are pros and cons to both tools. I have a ton of respect for the work that HashNuke and tuvistavie are doing. Neither tool is necessarily better. They just have different design goals and opinions. I recommend that you check out both of them and go with the one that makes the most sense for you and your team.

25
Post #4
keathley

keathley

Totally! In fact the majority of applications I’ve worked on with Wallaby have been large JS clients in front of a phoenix api.

AstonJ

AstonJ

@keathley is a member here so hopefully he will spot this and add his thoughts :003:

sublimecoder

sublimecoder

I like the way wallaby tests read and the concurrent testing is super attractive as well. Hound doesn’t seem as readable to me though both get the job done.

imetallica

imetallica

Sorry to bring back this old post but, does Wallaby support testing of SPAs?

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement