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 🌈⭐