I can think of a way to quickly test a few functions I wrote by writing an
.exs file and then running it with
mix run path/to/file.exs to get output in terminal.
I am not using tests (TDD) because the functions will fetch some http response and I need them in terminal to understand them. (and accordingly process it later)
- What are other good ways to quickly test small functions to see their output in terminal?
- lacunae of above approach.
- Anything else you want to suggest.
i too am a new Elixir programmer and here is what i do:
Write your function and all that function as explained below
defmodule Example do
def add_numbers(num1, num2) do
num1 + num2
Save the file with .exs and to run/test use command from a command shell
Hope this helps
Also, you can just alias the module directly into iex and call this function directly there. You don’t need to create another file just to run this manually.
You can also take a look at this require IEx; IEx.pry to understand how is your function behaving at every step. or you can use IO.inspect().
thanks for the awesome information.