ct_cover(3)
π ct_cover β bestie's guide to Common Test code coverage π
ok so this is ct_cover, the Common Test framework code coverage support module, and it lives in section 3 of the manual (that's the library-functions girlies). no cap, she's here to help you figure out how much of your code your tests actually touched. π¦
β¨ DESCRIPTION β¨
So like, this module exports help functions for performing code coverage analysis. that's the whole vibe. it's the little helper squad that makes cover work inside Common Test, and honestly? iconic. π
πΈ FUNCTIONS πΈ
add_nodes(Nodes) -> {ok, StartedNodes} | {error, Reason}
when
Nodes :: node() | [node()],
StartedNodes :: [node()],
Reason :: cover_not_running | term().
okay so this one adds nodes to the current cover test. π«Ά
heads up bestie: this only works if cover support is active. if it's not? you get cover_not_running and a little "no π" from the system.
and listen, for it to actually do anything, you have to call this from init_per_suite/1 (you know, the one over in ct_suite) β and you gotta do it before any tests are performed. before. not during, not after. before. β
cross_cover_analyse(Level, Tests) -> ok
when
Level :: overview | details,
Tests :: [{Tag :: atom(), Dir :: file:name_all()}].
this one accumulates cover results over multiple tests</c>. yes, multiple. she's collecting receipts across your whole test run. πβ¨
Level can be either overview or details β those are your two flavour options, periodt.
if you wanna know more, go read the section called Cross Cover Analysis in the User's Guide. iykyk. π
remove_nodes(Nodes) -> ok | {error, Reason}
when
Nodes :: node() | [node()],
Reason :: cover_not_running | not_main_node | term().
and this is the breakup function: removes nodes from the current cover test. π
call this when you wanna stop cover test on nodes you previously added with ct_cover:add_nodes/1. closure, finally.
oh and the best part β results on the remote node are transferred to the Common Test node. so you don't lose the data, she just moves it home. slay. π₯
quick reminder: the errors you might see floating around here arecover_not_runningandnot_main_node, plus whateverterm()the universe throws at you. no guessing, that's just what's on the list. π
and that's the whole page, bestie!! this was brought to you by Ericsson AB π’π, from common_test version 1.31.1 β¨, and this manual page is ct_cover(3) β go forth and cover your code, you absolute main character. ππΈπ¦π
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms