Lawrence_elixir

Lawrence_elixir

16) ElixirConf EU 2019 - A Whirlwind Tour of Testing in Elixir - Daniel Caixinha

@dcaixinha - Software Engineer, author and Meetup co-organiser

A Whirlwind Tour of Testing in Elixir

Talk in three words: Write maintainable tests.

Abstract
Tests are an integral part of any application. They are a safety net to refactor applications and also great living documentation. Beginning with unit tests, we’ll see how to write thorough but also maintainable tests, and how the key to do so is to focus on the message-passing. Moving up the pyramid, we will then go through end-to-end tests, but also component and contract tests. These last two are becoming increasingly important, since it’s hard to maintain end-to-end tests in microservice architectures.

Objectives
The objectives of this talk are three-fold:

  • discuss some best practices for testing Elixir applications;
  • show how to create unit tests that are descriptive and maintainable, while also avoiding redundant coverage;
  • explore service-level and end-to-end tests, and demonstrate how the former helps in the maintainability of the latter.

Audience
This talk should appeal to anyone writing Elixir applications, regardless of the domain. Testing is a cross-cutting concern, and the principles discussed in this talk will apply to pretty much all areas of development, whether it’s a web application or an embedded system.
Read the full abstract:

The speaker
Daniel Caixinha is a software engineer at Onfido, where he is using Elixir to build resilient systems that can handle the high growth of the business. After graduating from Instituto Superior Técnico, he joined the startup world, mainly using Ruby, but he also got the chance to play around with Elixir. Upon joining Onfido, he got the chance to take Elixir more seriously, which made him fall in love with functional programming in general, and Elixir in particular. Besides building Elixir applications, he is fostering the use of Elixir, and being a co-organiser of the Lisbon Elixir meetup.

All will be added to the ElixirConf EU 2019 Talks List or via the #elixirConfEU2019 tag.

Most Liked

Fl4m3Ph03n1x

Fl4m3Ph03n1x

What an interesting talk!
And I think he may even be Portuguese (orly?) !!

I have so many questions:

  1. what is his stance on behavioral testing?
  2. does he start inside out or outside-in?
  3. what is his take on DDD?
  4. what type of layered architecture does he use in his apps?
  5. When doing unit tests, does he create a behaviour for every unit he is testing? (because th SUTs are supposed to communicate with the collaborators via interfaces so Mox can take advantage of them)
  6. Why doesn’t he mention constructor dependency injection of the witness pattern?

Really wish I could have a talk with him. Also, really wish I could have a calendar for the next events, he did mention they occur monthly iirc.

dcaixinha

dcaixinha

Hey @Fl4m3Ph03n1x, sorry for taking so long to respond, somehow I didn’t get notified for this thread. Yes I’m indeed Português :portugal: Trying to answer your questions:

  1. By behavioral testing you mean BDD? If so, I’m not against it, I just feel that they aren’t scalable and should be created taking this into consideration.
  2. I usually start inside-out, but this heavily depends on the codebase and whether I’m familiar with it or not!
  3. I can’t say I know much about DDD. I’ve just experimented with the Bounded Contexts that Phoenix encouraged, but I haven’t really developed an application where that is followed consistently.
  4. I usually tend to create something along the lines of the Clean Architecture or the Hexagonal Architecture.
  5. Yeah, I do! For every mock that I need, I go and create a behaviour that establishes the contract of that module. Note that you don’t need to create a separate module for this, as you can do it inline on the original module.
  6. I don’t know what you mean by that :sweat_smile: In the talk I mention dependency injection, which is what I used to inject the mocks on the test.

I’d be happy to discuss this in person :slight_smile: you can find the meetup page here, and our next edition was just announced, which is happening two weeks from now.

Where Next?

Popular in Talks Top

blatyo
Looks like videos have started to go up for ElixirConf US 2018. Here’s the playlist of ones available so far. I expect it’ll get updated ...
New
axelson
by @chrismccord My summary: Chris gives an update and copious demos of Phoenix LiveView which is now released on hex.pm. Demos on: ...
New
CodeSync
Code Sync: Fast IP Address Matching in Elixir (…) & Persistent Term | Michael Lubas | Code BEAM America 2022 Comments welcome! View ...
New
axelson
ElixirConf 2017 - Implementing a MQTT client in Elixir - @gausby Elixir has excellent support for binary pat...
New
axelson
ElixirConf 2017 - Perhap: Applying Domain Driven Design and Reactive Architectures to Functional Programming - by @Version2beta ...
New
axelson
ElixirConf US 2018 – Meet Virtuoso: The Chatbot Orchestration Framework Built with Elixir – Justus Eapen (@justuseapen) ...
New
axelson
ElixirConf US 2018 – Docker and OTP: Friends or Foes? – Daniel Azuma (@dazuma) Docker is the hot deployment technology a...
New
axelson
Consistent, Distributed Elixir - @keathley Elixir and Erlang provide powerful mechanisms for building systems that are alw...
New
kokolegorille
Lonestar Elixir 2018 videos are starting to pop up :slight_smile: https://www.youtube.com/channel/UCOy-_b9bqjokoWX9Hg5ZgUg Day 1 Chris ...
New
ElixirConf
ElixirConf: ElixirConf 2023 - German Velasco - Using DDD concepts to create better Phoenix Contexts Comments welcome! View the <span cla...
New

Other popular topics 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
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
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
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New

We're in Beta

About us Mission Statement