ex_unit_release v0.1.0 ExUnitRelease
Package and run ExUnit tests with an Elixir generated OTP release.
Including tests
Test files need to be included in the release so they are available at runtime. To include test files, you need to
add &ExUnitRelease.include/1
to your release steps. Here is an example of
how to include these tests when the release is being built for the test env:
def project do
[
app: my_app,
version: "0.1.0",
elixir: "~> 1.9",
# ...
releases: [
my_app: [
steps: [:assemble] ++ ex_unit_release(Mix.env)
]]
]
end
defp ex_unit_release(:test),
do: [&ExUnitRelease.include/1]
defp ex_unit_release(_),
do: []
Running tests
ExUnitRelease tests can be run by calling ExUnitRelease.run/1
at runtime.
Any options passed to this command will be sent to ExUnit.configure/1
.
iex> ExUnitRelease.run
{:ok,
{"[32m.[0m
Finished in 0.1 seconds
[32m1 test, 0 failures[0m
Randomized with seed 262631
",
%{excluded: 0, failures: 0, skipped: 0, total: 1}}}
Link to this section Summary
Link to this section Functions
include(release)
include(Mix.Release.t()) :: Mix.Release.t()
include(Mix.Release.t()) :: Mix.Release.t()
Includes tests in an Elixir release
This function is intended to be added to the elixir release steps:
def project do
[
app: my_app,
# ...
releases: [
my_app: [
steps: [:assemble, &ExUnitRelease.include/1]
]]
]
end
The default include path for tests is rel/test
. This can be changed in the
application config
config :ex_unit_release
include_path: "other/path"
run(opts \\ [])
Runs tests in the release
Any options passed to this command will be sent to ExUnit.configure/1