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.

Last Post!

mudasobwa

mudasobwa

Creator of Cure

I am glad to introduce the first stable release, Enfiladex v0.2.0.

It has helpers to run functions on freshly spawned remote nodes via Enfiladex.peer/3 and Enfiladex.multi_peer/3 as well as spawn nodes with Enfiladex.start_peers/1 (to be stopped with Enfiladex.stop_peers/1 afterward.)

Also, it might be used as a drop-in support for both ExUnit and Erlang Common Test simultaneously (with a known limitation of freaky on_exit/2 handling when the function grabs a context, I am working on it.)

Enfiladex is tested with itself, providing both Common Test and ExUnit tests at once.

Example of using spawned node in cloister tests.

Comments, issue reports, and feature requests are very welcome.

Where Next?

Popular in Announcing Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
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
dominicletz
Hi, I thought I had posted my library before but seems I hadn’t. The project is still in early stages but it’s growing and so I think it...
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 11283 107
New
zoltanszogyenyi
Hey everyone :waving_hand: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

We're in Beta

About us Mission Statement