|
Hi
1st time newbie post.
below is part of a script I'd put together based on
the user guide examples.
begin
assert($ie.contains_text(AttendanceHomeProperties::Reports) ) puts("Found test string " + AttendanceHomeProperties::Reports ) assert($ie.contains_text(AttendanceHomeProperties::UnknownPerson) ) puts("Found test string " + AttendanceHomeProperties::UnknownPerson ) result = 'TEST
PASSED.'
#rescue => e #rescue Test::Unit::Error => e rescue Test::Unit::AssertionFailure=> e $ie.screen_capture(prefix_test_name(@@test_name, 'assertion failure.jpg') , true, false) puts("TEST FAILED." + e.message + "\n" + e.backtrace.join("\n")) ensure puts(result) $ie.close() puts " " puts "## finish test: "+ @@test_name end I have 3 scenarios.
1. if i use rescue => e then when for eg 2nd
assertion fails execution steps into the rescue block and the screen capture and
TEST FAILED and back trace are output to console. but this results in 1
tests, 2 assertions, 0 failures, 0 errors. obviously not what I want 0 failure
and 0 error isn't correct.
2. if i use rescue Test::Unit::Error => e then
when 2nd assertion fails execution seems to bypass the rescue block ( no screen
capture ) but it does report 1 tests, 2 assertions, 0 failures 1 error ( or the
other way round 1 failure 0 error can't remember off the top of my
head )
3. if i use rescue
Test::Unit::AssertionFailure=> e its the same behaiviour as for 2. but
it reports the opposite 1failure, 0 error.
which method should I use to capture a failed
assertion ( rescue => e captures everything but breaks the test
unit count of the failures and errors? ) and still have it execute the code
in the rescue block?
I'm hoping someone has come up against this before
and thought up a better solution as I only started trapping
Test::Unit::AssertionFailure based on a comments I'd read in the ruby rdoc re
Test::Unit::Assertions.
thanks
Marco
|
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
