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

tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
mspanc
I am pleased to announce an initial release of the Membrane Framework - an Elixir-based framework with special focus on processing multim...
New
dbern
I’m excited to announce that TaxJar has developed and open-sourced DateTimeParser. We developed it because we found a need to parse user ...
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. https://github.com/bryanjos/elixirscript/blob/master/CHANGELOG.md Most of the chan...
New
bryanjos
Hi, I wanted share a small library we at Revelry Labs made for rendering react components from the server side. There are instructions fo...
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
blatyo
The best overview for how things are tied together is this presentation. Modules and functions are pretty well documented at this point, ...
New
sbs
Only 650 LOC, wrote for fun :slight_smile: https://github.com/sunboshan/qrcode
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 10858 107
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
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
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
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
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

We're in Beta

About us Mission Statement