|
||||||
| SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC | |||||
::xotcl::Object | +--::xounit::CoverageReport
Reports the documentation coverage for all methods, parameters and classes in a package.
| 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 |
prefixes |
::xounit::DocumentationCoverageReport | Prefixes of methods used to limit the documentation coverage report |
|
| 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 |
checkClassPrefix {class}
| Checks that a Class matches a prefix listed in prefixes if prefixes were specified |
checkMethodPrefix {method}
| Checks that the method matches a prefix listed in prefixes if prefixes were specified |
clear {}
| Clears all old information from the CoverageReport |
reportClass {class}
| Builds the report of coverage for all methods in class |
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 ::xounit::CoverageReport |
add, addPackage, clear, reportClass, reportPackage, reportPackages, reportSummary, start, stop,
|
| 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::DocumentationCoverageReport instproc add {class} {
}
Adds a package to be watched during coverage analysis.
package ::xounit::DocumentationCoverageReport instproc addPackage {package} {
}
Checks that a Class matches a prefix listed in prefixes if prefixes were specified.
class ::xounit::DocumentationCoverageReport instproc checkClassPrefix {class} {
my instvar prefixes
if { ! [ my exists prefixes ] } { return 1 }
foreach prefix $prefixes {
if { [ string first $prefix [ namespace tail $class ] ] == 0 } { return 1 }
}
return 0
}
Checks that the method matches a prefix listed in prefixes if prefixes were specified.
method ::xounit::DocumentationCoverageReport instproc checkMethodPrefix {method} {
my instvar prefixes
if { ! [ my exists prefixes ] } { return 1 }
foreach prefix $prefixes {
if { [ string first $prefix $method ] == 0 } { return 1 }
}
return 0
}
Clears all old information from the CoverageReport
::xounit::DocumentationCoverageReport instproc clear {} {
my passes 0
my failures 0
}
Builds the report of coverage for all methods in class.
class ::xounit::DocumentationCoverageReport instproc reportClass {class} {
if { [ string first "::test::" $class ] != -1 } { return }
if { [ my checkClassPrefix $class ] } {
if {![ $class exists #([ namespace tail $class ]) ]} {
puts "Not Covered: $class"
my incr failures
} else {
puts "Covered: $class"
my incr passes
}
}
foreach method [ concat [ $class info instprocs ] [ $class info procs ] [ $class info parameter ] ] {
set method [ lindex $method 0 ]
if { ! [ my checkMethodPrefix $method ] } { continue }
set currentClass $class
set found 0
while { "$currentClass" != "" } {
if {[ $currentClass exists #($method) ]} {
set found 1
puts "Covered: $class $method"
my incr passes
break
}
set currentClass [ lindex [ $currentClass info superclass ] 0 ]
}
if { ! $found } {
puts "Not Covered: $class $method"
my incr failures
continue
}
}
}
Builds the report summary for all classes included in this CoverageReport
::xounit::DocumentationCoverageReport instproc reportSummary {} {
my instvar passes failures
set total [ expr { $passes + $failures } ]
puts "\n\nDocumentation 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 ) } ]%"
flush stdout
}
Starts the recording of the CoverageReport
::xounit::DocumentationCoverageReport instproc start {} {
}
Stops the recording of the CoverageReport
::xounit::DocumentationCoverageReport instproc stop {} {
}