[Elixir]about parameterized test with Elixir(Eng ver)

Previously, I published support library to do parameterized test with Elixir on hex and WordPress. See here, but it in Japanese.

The library is simple macro. So, anyone can use it easily.
See readme and docs if you would like to know more

Example


defmodule ExParameterizedTest do
use ExUnit.Case, async: true
use ExUnit.Parameterized
test_with_params "add params",
fn (a, b, expected) ->
assert a + b == expected
end do
[
{1, 2, 3}
]
end
test_with_params "create wordings",
fn (a, b, expected) ->
assert a <> " and " <> b == expected
end do
[
{"dog", "cats", "dog and cats"},
{"hello", "world", "hello and world"}
]
end
test_with_params "fail case",
fn (a, b, expected) ->
refute a + b == expected
end do
[
{1, 2, 2}
]
end
end

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.