|
||||||
| SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC | |||||
::xotcl::Object
CoverageReport is a collector of information about the coverage analysis and produces the formatted summary of that information
| Variables | |||
| Name | Default Value | Class | Comment |
failures |
0 | ::xounit::CoverageReport | number of methods that are not covered |
passes |
0 | ::xounit::CoverageReport | number of methods that are covered |
| Methods | |
| Name | Comment |
add {class}
| Adds a class to be watched during coverage analysis |
addPackage {package}
| Adds a package to be watched during coverage analysis |
clear {}
| Clears all old information from the CoverageReport |
reportClass {class}
| Builds the report of coverage for all methods in class |
reportPackage {package}
| Builds the report of coverage for all classes in package |
reportPackages {packages}
| Builds the report of coverage for all classes in packages |
reportSummary {}
| Builds the report summary for all classes included in this CoverageReport |
start {}
| Starts the recording of the CoverageReport |
stop {}
| Stops the recording of the CoverageReport |
| Methods from ::xotcl::Object |
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, garbageCollect, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
|
| Instproc Detail |
Adds a class to be watched during coverage analysis.
class ::xounit::CoverageReport instproc add {class} {
::xounit::Coverage add $class
my assertNotEquals [ lsearch [ $class info instfilter ] coverageFilter ] -1
}
Adds a package to be watched during coverage analysis.
package ::xounit::CoverageReport instproc addPackage {package} {
set namespace ::${package}
puts "Searching $namespace"
foreach class [ ::xox::ObjectGraph findAllInstances ::xotcl::Class $namespace ] {
puts "Watching $class"
my add $class
}
}
Clears all old information from the CoverageReport
::xounit::CoverageReport instproc clear {} {
::xounit::Coverage clear
my passes 0
my failures 0
}
Builds the report of coverage for all methods in class.
class ::xounit::CoverageReport instproc reportClass {class} {
if { [ string first "::test::" $class ] != -1 } { return }
if { "$class" == "::xounit::CoverageReport" } { return }
foreach method [ $class info instprocs ] {
if { ![ ::xounit::Coverage hasCoverage $class $method ] } {
puts "Not Covered: $class $method"
my incr failures
continue
}
puts "Covered: $class $method [ ::xounit::Coverage getCoverage $class $method ]"
my incr passes
}
}
Builds the report of coverage for all classes in package.
package ::xounit::CoverageReport instproc reportPackage {package} {
set namespace ::${package}
foreach class [ ::xox::ObjectGraph findAllInstances ::xotcl::Class $namespace ] {
my reportClass $class
}
}
Builds the report of coverage for all classes in packages.
packages ::xounit::CoverageReport instproc reportPackages {packages} {
foreach package $packages {
my reportPackage $package
}
}
Builds the report summary for all classes included in this CoverageReport
::xounit::CoverageReport instproc reportSummary {} {
my instvar passes failures
set total [ expr { $passes + $failures } ]
puts "\n\nTest Coverage Report Summary by Method"
puts "=========================================="
puts "Total: $total"
if { $total == 0 } { return }
puts "Covered: $passes - [ expr { floor ( 100.0 * $passes / $total ) } ]%"
puts "Not Covered: $failures - [ expr { ceil ( 100.0 * $failures / $total ) } ]%"
}
Starts the recording of the CoverageReport
::xounit::CoverageReport instproc start {} {
::xounit::Coverage start
}
Stops the recording of the CoverageReport
::xounit::CoverageReport instproc stop {} {
::xounit::Coverage stop
}