COBERTURA-INSTRUMENT(1)
π COBERTURA-INSTRUMENT β like, the manual page π
okay bestie, gather round, because we're talking about cobertura-instrument from the General Commands Manual (that's section 1, iykyk) π
β¨ NAME β¨
cobertura-instrument β no cap, its whole job is: add coverage instrumentation to existing classes. that's it. that's the girl. π
πΈ SYNOPSIS πΈ
cobertura-instrument [--basedir dir] [--datafile file] [--destination
dir] [--ignore regex] classes [...]
π¦ DESCRIPTION π¦
so here's the vibe: cobertura-instrument takes your already-compiled Java classes and inserts instrumentation instructions directly into them. like it's moving in, rent free, into your .class files π β¨
and then, when the Java Virtual Machine encounters those instructions while running, the inserted code bumps a bunch of counters. which is the whole point β those counters are how you can tell which instructions have been encountered and which have not. it's giving surveillance but make it β¨coverageβ¨.
π OPTIONS π
first things first, bestie: classes can be specified individually, or as a directory tree containing multiple classes. your choice, your world π
--basedir dirβ this is where you tell it the base directory that contains the classes you wanna instrument. β οΈ important: this command line parameter should appear before any classes. and if you're instrumenting classes that live in different directories? then you specify multiple basedirs, one per directory. stack 'em, queen π--datafile fileβ name the file you want used for storing the metadata about your classes. this is a single file containing serialized Java classes, and it holds info about the names of classes in your project, their method names, line numbers, etc. it gets updated as your tests are run, and the Cobertura reporting command will reference it later. default value is literally this:"./cobertura.ser"π--destination dirβ the output directory for the instrumented classes. but heads up, and this is a big one: if no destination directory is specified, then the uninstrumented classes will be overwritten with their instrumented counterparts. yes, OVERWRITTEN. original flavor gone. so know what you're doing before you skip this flag π--ignore regexβ hand it a regular expression to filter out certain lines of your source code. super useful for ignoring logging statements, for example. and you can have as many<ignore/>statements as you want. by default, no files are ignored. periodt π--auxClasspathβ add any classes/jars that cobertura is unable to find during instrumentation. the little rescue squad for when it can't find its stuff π«Ά
π SEE ALSO π
junit(1), cobertura-check(1), cobertura-report(1), cobertura-merge(1). go read the whole friend group, they're all icons π
π AUTHOR π
this manual page was written by Miguel Landaeta <miguel@miguel.cc> for the Debian system (but may be used by others) π«Ά permission is granted to copy, distribute and/or modify this document under the terms of the terms of GNU General Public License, Version 2 or any later version published by the Free Software Foundation.
on Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL π
and that's the whole page, babe π
thanks for coming to my TED talk β this was COBERTURA-INSTRUMENT(1) from the General Commands Manual, mwah, go instrument something responsibly πβ
π¦ where this page comes from
- debian bookworm: cobertura 2.1.1-2 Β· GPL-2.0-or-later
- debian trixie: cobertura 2.1.1-2 Β· GPL-2.0-or-later
- ubuntu jammy: cobertura 2.1.1-2 Β· GPL-2.0-or-later
- ubuntu noble: cobertura 2.1.1-2 Β· GPL-2.0-or-later
- ubuntu resolute: cobertura 2.1.1-2build1 Β· GPL-2.0-or-later
- ubuntu stonking: cobertura 2.1.1-2build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms