I think what you may probably need is to run your tests programmatically.
Read this thread,
ExUnit tests from a module instead of command line/mix
and the implementation of the test task in Mix. (look for the run/1
function)
elixir/test.ex at master · elixir-lang/elixir · GitHub