Index: openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.adp,v diff -u -r1.1 -r1.1.26.1 --- openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.adp 15 Feb 2004 12:14:37 -0000 1.1 +++ openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.adp 30 Aug 2019 17:23:18 -0000 1.1.26.1 @@ -1,9 +1,16 @@ +@title;literal@ +@context;literal@ -

-The following procs are not listed as being tested by any test cases. -

+
+
@test_coverage_percent@%
+
+
+ Procs: @test_coverage_procs_nr@
+ Procs covered: @test_coverage_procs_cv@
+ Coverage: @test_coverage_level@ +
+
+
-

-@uncovered_procs;noquote@ -

+ Index: openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.tcl 9 Apr 2018 20:11:54 -0000 1.5 +++ openacs-4/packages/acs-automated-testing/www/admin/proc-coverage.tcl 30 Aug 2019 17:23:18 -0000 1.5.2.1 @@ -1,40 +1,93 @@ ad_page_contract { - Displays procs not covered by test cases in the given package + Displays proc test coverage in the given package, or system wide - @author Peter Marklund + @author Héctor Romojaro + @creation-date 2019-08-29 } { - package_key + {package_key ""} + orderby:token,optional } -set all_proc_names [list] -foreach file_path [nsv_array names api_proc_doc_scripts] { - if { [regexp "^packages/$package_key" $file_path] } { - foreach proc_name [nsv_get api_proc_doc_scripts $file_path] { - lappend all_proc_names $proc_name +# CSS +template::head::add_css -href /resources/acs-automated-testing/tests.css + +# Choose between global and package-wise proc test coverage +if { $package_key eq "" } { + # + # System wide proc test coverage + # + set title "Global proc test coverage" + set proc_list [aa::coverage::proc_list] + set test_coverage [aa::coverage::proc_coverage] + set list_elements { + package_key { + label "Package" } } + set orderby_elements { + default_value package_key,asc + package_key { + multirow_cols package_key + } + } +} else { + # + # Proc test coverage for a particular package + # + set title "Proc test coverage of $package_key" + set proc_list [aa::coverage::proc_list -package_key $package_key] + set test_coverage [aa::coverage::proc_coverage -package_key $package_key] + set list_elements [list] + set orderby_elements { + default_value proc_name,asc + } } -set tested_proc_names [list] -foreach testcase [nsv_get aa_test cases] { - set testcase_package_key [lindex $testcase 3] +# Set context and coverage vars +set context [list $title] +set test_coverage_percent [dict get $test_coverage coverage] +set test_coverage_procs_nr [dict get $test_coverage procs] +set test_coverage_procs_cv [dict get $test_coverage covered] +set test_coverage_level [aa::coverage::proc_coverage_level $test_coverage_percent] - if {$testcase_package_key eq $package_key} { - set tested_procs [lindex $testcase 10] - if { [llength $tested_procs] > 0 } { - lappend tested_proc_names {*}$tested_procs +# Add the rest of elements +lappend list_elements {*}{ + proc_name { + label "Proc name" + display_template {@procs_mr.proc_name@} + } + covered_p { + label "Covered" + display_template { + +
Yes
+
+ +
No
+
} } } -set uncovered_procs [list] -foreach proc_name $all_proc_names { - if {$proc_name ni $tested_proc_names} { - lappend uncovered_procs $proc_name +# Add the rest of orderby elements +lappend orderby_elements {*}{ + proc_name { + multirow_cols proc_name } + covered_p { + multirow_cols covered_p + } } -set uncovered_procs [join $uncovered_procs "
"] +# Create the multirow and the template::list +template::util::list_to_multirow procs_mr $proc_list +template::list::create \ + -name procs \ + -multirow procs_mr \ + -filters {package_key {}} \ + -elements $list_elements \ + -orderby $orderby_elements + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-automated-testing/www/resources/tests.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/www/resources/tests.css,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/acs-automated-testing/www/resources/tests.css 29 Aug 2019 18:36:43 -0000 1.1.2.2 +++ openacs-4/packages/acs-automated-testing/www/resources/tests.css 30 Aug 2019 17:23:18 -0000 1.1.2.3 @@ -28,3 +28,52 @@ .very_low { background-color: rgb(255, 51, 0); } + +/* Test coverage stats */ +.coverage_stats { + margin: 22px; + display: flex; +} +.coverage_data { + height: 150px; + line-height: 150px; + margin-left: 25px; +} +.coverage_data_elements { + display: inline-block; + line-height: normal; + vertical-align: middle; + font-size: 20px; + text-shadow: 1px 1px #CBCEC2; +} +.coverage_data_level { + color: white; + padding-left: 15px; + padding-right: 15px; + text-align: center; + display: inline-block; + text-shadow: none; +} + +/* Test coverage badge */ +.coverage_badge { + width: 150px; + height: 150px; + border-radius: 50%; + border-radius: 10px; + font-size: 25px; + text-align: center; + color: white; + line-height: 150px; + border: 2px solid #CBCEC2; +} + +/* Proc list */ +.covered { + background-color: rgb(0, 204, 0); + text-align: center; +} +.uncovered { + background-color: rgb(255, 51, 0); + text-align: center; +}