[twill] I wish that code 200 would call show on failure
Titus Brown
titus at caltech.edu
Thu Jan 31 11:03:31 PST 2008
On Thu, Jan 31, 2008 at 06:56:44PM +0000, Matthew Wilson wrote:
-> I have some twill tests like this:
->
-> go /somepage
-> show
-> code 200
-> find blah
->
-> I put the show in there so that in the event that the page returned a
-> 500, I get to see the debugging information.
->
-> However, if the code 200 test passes, but the find blah test fails, I
-> still see all that HTML, which isn't helpful.
->
-> How can I only execute show when code 200 fails?
Hey Matt... you can't :(. There aren't any conditionals in
twill-script, and there's no special command for doing this.
I run all of my twill tests from within a unit test framework, which
hides all output unless there's an error; that's one way to go.
Another thing you could try is to write an extension module; it would
go something like this:
--- my_ext.py
from twill.commands import *
def show_if_not_ok():
try:
code('200')
except:
show()
raise
---
cheers,
--titus
More information about the twill
mailing list