mudasobwa

mudasobwa

Creator of Cure

Elixir library to execute `ExUnit` tests as `common_test`

I wanted to release v0.1.0 of this library in 2023, that’s why it’s still very much WIP, although fully functional already.

There was an intent to bring common_test to Elixir by @hauleth, but it seems dead.

I needed to use :peer for some specific tests and I started by adopting it for Elixir users. Soon I figured out, I wanted common_test to be easily usable from Elixir and apparently we have everything already in place to make it as easy as use Enfiladex.

Usage: add :enfiladex dependency and put use Enfiladex.Suite after use ExUnit.Case in your tests to make them run by common_test with newly introduced task MIX_ENV=test iex --sname am -S mix enfiladex.

Limitations:

  • on_exit/2 callbacks with captures makes test to fail compiling with use Enfiladex (Code.with_diagnostics/2 issue),
  • Enfiladex.{peer/3, multi_peer_/3} fail from tests with an anonymous function,
  • MIX_ENV=test iex --sname am -S mix enfiladex (named node) to execute common test,
  • compiled beam files are not yet removed.

I have no issues fixing all but the first one. It’s induced by Code.with_diagnostics/2 leaving error in the compiler errors accumulator even if handled and processed when executed in compile time.

I need it to detect whether on_exit/2 might be reused as end_per_*** callbacks in common_test. If it grabs context variables, it should be discarded. I am most likely to file an issue in Elixir core, although I understand this use-case is extremely uncommon.

Everything else is kinda working, as well as exported from Enfiladex functions

  • peer(fun, callback \\ [], config \\ [])
  • multi_peer(fun, callback \\ [], config \\ [])

Both accept a function to be executed on :peer, a callback, and an optional config:

  • transfer_config :: boolean()
  • start_applications :: boolean()
  • nodes_count :: non_neg_integer()

The docs are pending. Enjoy! enfiladex v0.3.1 — Documentation

P. S. one might test it with running MIX_ENV=test iex --sname am -S mix enfiladex in enfiladex itself after git clone.

First Post!

mudasobwa

mudasobwa

Creator of Cure

Fixed some cosmetics and introduced tasks.

❯ mix enfiladex.ex_unit
...

Finished in 1.1 seconds (0.00s async, 1.1s sync)
3 tests, 0 failures

Randomized with seed 362051
❯ mix enfiladex

Common Test starting (cwd is /home/aleksei/Proyectos/Elixir/enfiladex)



CWD set to: "/home/aleksei/Proyectos/Elixir/enfiladex/ct_logs/ct_run.enfiladex@ALEKSEI-ThinkPad-X1-Carbon-Gen-9.2024-01-02_11.04.47"

TEST INFO: 1 test(s), 3 case(s) in 0 suite(s)

Testing Elixir.enfiladex.Elixir.Enfiladex.Test.Suite: Starting test, 3 test cases
...Testing Elixir.enfiladex.Elixir.Enfiladex.Test.Suite: TEST COMPLETE, 3 ok, 0 failed of 3 test cases

Updating /home/aleksei/Proyectos/Elixir/enfiladex/ct_logs/index.html ... done
Updating /home/aleksei/Proyectos/Elixir/enfiladex/ct_logs/all_runs.html ... done
[{3, 0, {0, 0}}]

... in both cases are passed tests.

Where Next?

Popular in Announcing Top

OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
New
riverrun
I’ve just released version 3 of Comeonin, a password hashing library. The following small changes have been made: changes to the NIF c...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
blatyo
The best overview for how things are tied together is this presentation. Modules and functions are pretty well documented at this point, ...
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
josevalim
Hello everyone, We have just released NimbleCSV which is a small and fast CSV parsing library for Elixir. It allows developers to define...
New
zachdaniel
Ash Framework What is Ash? Ash Framework is a declarative, resource-oriented application development framework for Elixir. A resource can...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
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
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
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
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement