ct_cover(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– 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 are cover_not_running and not_main_node, plus whatever term() 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