aa_log_result (public)

 aa_log_result test_result [ args... ]

Defined in packages/acs-automated-testing/tcl/aa-test-procs.tcl

Log a test result

Parameters:
test_result (required)
Author:
Peter Harper
Created:
24 July 2001

Partial Call Graph (max 5 caller/called nodes):
%3 test_datamodel__acs_attribute_check datamodel__acs_attribute_check (test acs-tcl) aa_log_result aa_log_result test_datamodel__acs_attribute_check->aa_log_result test_datamodel__acs_object_type_check datamodel__acs_object_type_check (test acs-tcl) test_datamodel__acs_object_type_check->aa_log_result test_datamodel__named_constraints datamodel__named_constraints (test acs-tcl) test_datamodel__named_constraints->aa_log_result test_documentation__check_deprecated_see documentation__check_deprecated_see (test acs-tcl) test_documentation__check_deprecated_see->aa_log_result test_documentation__check_parameters documentation__check_parameters (test acs-tcl) test_documentation__check_parameters->aa_log_result aa_add_rollback_test aa_add_rollback_test (private) aa_log_result->aa_add_rollback_test aa_in_rollback_block_p aa_in_rollback_block_p (private) aa_log_result->aa_in_rollback_block_p db_dml db_dml (public) aa_log_result->db_dml aa_display_result aa_display_result (public) aa_display_result->aa_log_result aa_equals aa_equals (public) aa_equals->aa_log_result aa_error aa_error (public) aa_error->aa_log_result aa_false aa_false (public) aa_false->aa_log_result aa_log aa_log (public) aa_log->aa_log_result

Testcases:
datamodel__named_constraints, datamodel__acs_object_type_check, datamodel__acs_attribute_check, documentation__check_proc_doc, naming__proc_naming, documentation__check_deprecated_see, documentation__check_typos, documentation__check_parameters, files__check_info_files
Source code:
    set test_notes [join $args ""]
    if { [aa_in_rollback_block_p] } {
        aa_add_rollback_test [list aa_log_result $test_result $test_notes]
        return
    }

    #
    # When aa_run_quietly_p exists, we run inside the testing
    # environment. Otherwise, report and return.
    #
    if {![info exists ::aa_run_quietly_p]} {
        ns_log warning "aa_log_result: called outside the testing environment."  "Test result: $test_result Test notes: $test_notes"
            return
    }
    #
    # If logging is happened whilst in an initialization class, store the log
    # entry, but don't write it to the database.  Individual testcase will make
    # their own copies of these log entries.
    #
    if {$::aa_in_init_class ne ""} {
        lappend ::aa_init_class_logs($::aa_in_init_class)  [list $test_result $test_notes]
        return
    }

    incr ::aa_testcase_test_id
    if {$test_result eq "pass"} {
        ns_log Debug "aa_log_result: PASSED: $::aa_testcase_id$test_notes"
        incr ::aa_testcase_passes
    } elseif {$test_result eq "fail"} {
        switch $::aa_error_level {
            notice {
                ns_log notice "aa_log_result: NOTICE: $::aa_testcase_id$test_notes"
                set test_result "note"
            }
            warning {
                ns_log warning "aa_log_result: WARNING: $::aa_testcase_id$test_notes"
                set test_result "warn"
            }
            error {
                incr ::aa_testcase_fails
                ns_log Bug "aa_log_result: FAILED: $::aa_testcase_id$test_notes"
            }
            default {
                # metatest
                incr ::aa_testcase_fails
                ns_log Bug "aa_log_result: FAILED: Automated test did not function as expected:"  "$::aa_testcase_id$test_notes"
            }
        }
    } elseif {$test_result ne "sect"} {
        ns_log Debug "aa_log_result: LOG: $::aa_testcase_id$test_notes"
        set test_result "log"
    }
    # Notes in database can only hold so many characters
    if { [string length $test_notes] > 2000 } {
        set test_notes "[string range $test_notes 0 1996]..."
    }

    global aa_package_key
    global aa_testcase_test_id
    global aa_testcase_id

    db_dml test_result_insert {
        insert into aa_test_results
        (testcase_id, package_key, test_id, timestamp, result, notes)
        values (:aa_testcase_id, :aa_package_key, :aa_testcase_test_id,
                current_timestamp, :test_result, :test_notes)
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: