Builds, tests and debugging

A course program is one file; a project is a folder that rebar3 builds, tests and releases. This part starts with that project, writes a test module, and reads the report Erlang EUnit prints line by line.

After the two test frameworks the part turns to the checks that keep a build honest: typespecs that state a contract, Dialyzer that proves it, Elvis that checks the style, and xref that proves every call has a target. Each one is a tool the reader runs, not a rule to remember.

Debugging comes last, because the tools are easier to trust after a test has failed in a way the reader can reproduce. The debugger, dbg and the trace flags then answer the question a test cannot: what is a running process doing right now.

6.1 Rebar3 builds new, compile and eunit, rebar.config, and the layout of the project Open 6.2 Testing with EUnit a test module, the _test functions, and the report eunit:test prints Open 6.3 Debugging the debugger, dbg, tracing, and the process that is stuck Open 6.4 The rebar3 project layout src, ebin, the .app.src file, and rebar.config Open 6.5 Common Test a suite, all/0, ct_run, and the report of a run Open 6.6 Typespecs -spec, -type and -callback, and the contract a caller can read Open 6.7 Dialyzer the PLT, success typing, and the warning that names the line Open 6.8 Elvis the config, the rules, and the parsable report Open 6.9 xref and static checks rebar3 xref, compiler warnings as errors, and the loop a CI job runs Open

Lessons