Changeset 2085 for trunk/tester


Ignore:
Timestamp:
Feb 7, 2011 2:34:57 PM (9 years ago)
Author:
braffert
Message:

tester: re-adding capability to view outputs for test cases.

Location:
trunk/tester/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tester/scripts/main.tcl

    r2081 r2085  
    135135# ----------------------------------------------------------------------
    136136frame $win.testview
    137 button $win.testview.regoldenize -text "<< New golden standard" \
     137frame $win.testview.bbar
     138pack $win.testview.bbar -side bottom -fill x -pady {8 0}
     139button $win.testview.bbar.regoldenize -text "<< New golden standard" \
    138140    -state disabled -command tester_regoldenize
    139 pack $win.testview.regoldenize -side bottom -anchor w
    140 Rappture::Tooltip::for $win.testview.regoldenize \
     141pack $win.testview.bbar.regoldenize -side left
     142Rappture::Tooltip::for $win.testview.bbar.regoldenize \
    141143    "If this test result differs from the established test case, you would normally fix your tool to produce the correct result.  In some cases, however, your updated tool may be producing different, but correct, results.  In those cases, you can press this button to update the test itself to use the current output as the new golden standard for this test case."
     144
     145button $win.testview.bbar.viewoutputs -text "View outputs" -state disabled \
     146    -command tester_view_outputs
     147pack $win.testview.bbar.viewoutputs -side right
     148Rappture::Tooltip::for $win.testview.bbar.viewoutputs \
     149    "Display the outputs for this test case as they would be seen when running the tool normally.  If the test has completed with no error, the new results can be compated against the set of golden results."
     150
     151pack $win.testview.bbar -side bottom -fill x
    142152
    143153Rappture::Tester::TestView $win.testview.overview \
     
    169179$win.testrun.scrl contents $win.testrun.scrl.info
    170180
     181# Frame for viewing outputs
     182# ---------------------------------------------------------------------
     183frame $win.testoutput
     184Rappture::ResultsPage $win.testoutput.rp
     185pack $win.testoutput.rp -expand yes -fill both
     186button $win.testoutput.back -text "Back" -command tester_selection_changed
     187pack $win.testoutput.back -side bottom -anchor e -pady {8 0}
     188Rappture::Tooltip::for $win.testoutput.back \
     189    "Return to the previous window displaying the details for this test case."
     190
    171191# Load all tests in the test directory
    172192# ----------------------------------------------------------------------
     
    221241        eval $testview.overview show $tests
    222242        if {[llength $tests] == 1 && [$tests getResult] eq "Fail"} {
    223             pack $testview.regoldenize -side bottom -anchor w
    224             $testview.regoldenize configure -state normal
     243            pack $testview.bbar.regoldenize -side left
     244            $testview.bbar.regoldenize configure -state normal
    225245
    226246            # build up a detailed list of diffs for this one test
     
    270290
    271291        } else {
    272             $testview.regoldenize configure -state disabled
    273             pack forget $testview.details $testview.regoldenize
    274         }
     292            $testview.bbar.regoldenize configure -state disabled
     293            pack forget $testview.details $testview.bbar.regoldenize
     294        }
     295    }
     296
     297    # Show/hide the show outputs button
     298    if {[llength $tests] == 1} {
     299        $testview.bbar.viewoutputs configure -state normal
     300        pack $testview.bbar.viewoutputs -side right
     301    } else {
     302        $testview.bbar.viewoutputs configure -state disabled
     303        pack forget $testview.bbar.viewoutputs
    275304    }
    276305}
     
    369398    }
    370399}
     400
     401# ----------------------------------------------------------------------
     402# USAGE: tester_view_outputs
     403#
     404# TODO
     405# ----------------------------------------------------------------------
     406proc tester_view_outputs {args} {
     407    set testtree [.pw pane 0].tree
     408    set rhs [.pw pane 1]
     409    set resultspage $rhs.testoutput.rp
     410    set tests [$testtree curselection]
     411
     412    if {[llength $tests] != 1} {
     413        error "Cannot display outputs. One test must be selected"
     414    }
     415
     416    # Unpack right hand side
     417    foreach win [pack slaves $rhs] {
     418        pack forget $win
     419    }
     420
     421    # Clear any previously loaded outputs from the resultspage
     422    $resultspage clear -nodelete
     423
     424    # Display testobj, and runobj if test has completed successfully
     425    set test [lindex $tests 0]
     426    $resultspage load [$test getTestobj]
     427    set result [$test getResult]
     428    if {$result ne "?" && $result ne "Error"} {
     429        $resultspage load [$test getRunobj]
     430    }
     431
     432    pack $rhs.testoutput -expand yes -fill both -padx 8 -pady 8
     433}
     434
  • trunk/tester/scripts/test.tcl

    r2084 r2085  
    2626    public method getDiffs {}
    2727
     28    public method getRunobj {}
     29    public method getTestobj {}
     30
    2831    public method run {args}
    2932    public method regoldenize {}
     
    3639    private variable _runobj ""   ;# results from last run
    3740    private variable _diffs ""    ;# diffs with respect to _runobj
    38 
    39     # don't need this?
    40     public method getRunobj {}
    4141
    4242    private method _setWaiting {{newval ""}}
     
    221221    }
    222222    return $_runobj
     223}
     224
     225# ----------------------------------------------------------------------
     226# USAGE: getTestobj
     227#
     228# Returns a library object representing the test case.
     229# ----------------------------------------------------------------------
     230itcl::body Rappture::Tester::Test::getTestobj {} {
     231    return $_testobj
    223232}
    224233
Note: See TracChangeset for help on using the changeset viewer.