aa::coverage::proc_coverage (public)

 aa::coverage::proc_coverage [ -package_key package_key ]

Defined in packages/acs-automated-testing/tcl/coverage-procs.tcl

Calculates the test proc coverage of a particular package. If no 'package_key' is passed, then the system wide test proc coverage is returned.

Switches:
-package_key (optional)
The 'package_key' of the package to check.
Returns:
Dict with the number of procs (procs), covered procs (covered) and the coverage percentage (coverage).
Author:
Héctor Romojaro
Created:
2019-08-28

Partial Call Graph (max 5 caller/called nodes):
%3 test_aa__coverage_proc_coverage aa__coverage_proc_coverage (test acs-automated-testing) aa::coverage::proc_coverage aa::coverage::proc_coverage test_aa__coverage_proc_coverage->aa::coverage::proc_coverage aa::coverage::proc_list aa::coverage::proc_list (public) aa::coverage::proc_coverage->aa::coverage::proc_list packages/acs-automated-testing/www/admin/index.tcl packages/acs-automated-testing/ www/admin/index.tcl packages/acs-automated-testing/www/admin/index.tcl->aa::coverage::proc_coverage packages/acs-automated-testing/www/admin/proc-coverage.tcl packages/acs-automated-testing/ www/admin/proc-coverage.tcl packages/acs-automated-testing/www/admin/proc-coverage.tcl->aa::coverage::proc_coverage

Testcases:
aa__coverage_proc_coverage
Source code:
    set procs 0
    set procs_covered 0
    #
    # Get proc list to check
    #
    if { $package_key ne "" } {
        set proc_list [aa::coverage::proc_list -package_key $package_key]
    } else {
        set proc_list [aa::coverage::proc_list]
    }
    #
    # Count the covered procs
    #
    foreach proc_data $proc_list {
        incr procs
        if { [dict get $proc_data covered_p] } {
            incr procs_covered
        }
    }
    #
    # Return the coverage percentage
    #
    if { $procs eq 0 } {
        set coverage 100.0
    } else {
        set coverage [expr {($procs_covered / ($procs + 0.0)) * 100}]
    }
    return "procs $procs covered $procs_covered coverage [format {%0.2f} $coverage]"
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: