debugging - How to debug erlang code during rebar3 eunit? -


i have created release app rebar3 (beta-4). added eunit tests , wrote code.

for have debug 1 test case see have add make implementation work properly.

i found articles using dbg erlang console , found how write debug info eunit. need info code have test (the actual implementation(logic)).

is there way debug erlang code (actual source code, not test one) when rebar3 used eunit argument?

thanks


currently i'm using tracing in terminal there: https://aloiroberto.wordpress.com/2009/02/23/tracing-erlang-functions/

one way use rebar3 run shell under test profile, start debugger , set breakpoints , such:

$ rebar3 test shell ... 1> debugger:start(). {ok, <0.67.0>} 

this pop debugger gui. once debugger set , ready, run test under eunit:

2> eunit:test(your_test_module,[verbose]). ======================== eunit ======================== your_test_module: xyz_test_ (module 'your_test_module')... 

assuming set suitable breakpoint in debugger, hit it, you'll run problem approach: default, eunit tests time out after 5 seconds, doesn't give time debugging. need specify longer timeout test, why example above shows what's running test fixture named xyz_test_, wraps actual test long timeout. such fixture pretty simple:

-include_lib("eunit/include/eunit.hrl").  xyz_test_() ->     {timeout,3600,      [fun() -> ?assertmatch(expected_value, my_module:my_fun()), ok end]}. 

here, actual test anonymous function, matches return value my_module:my_fun/0, example represents business logic under test. example fixture sets test timeout 1 hour; can of course set needed application.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -