How do I log to stdout or stderr from an Erlang common test suite?

905 views Asked by At

I'm using common_test and just want to log values to stdout or stderr.

How????

I've tried:

  • ct:comment
  • ct:log
  • io:format

The state of the art seems to be manually combing through html files. But I'm on a server and I don't care about anything except my log line, I only want stdout. And I never want to look at an HTML file when writing tests, so advice on how to avoid that generally would be really helpful.

1

There are 1 answers

2
José M On BEST ANSWER

You should use ct:print or ct:pal (print and log), I'd recommend using the later, though.

(You can always use erlang:display, which is a low-level access to stdout)

Keep in mind that if you use Rebar3 with the default configuration and ct values. ct:print is only shown with --verbose, whereas, ct:pal is only shown if the test fails.