Comment #13 on issue 177 by [email protected]: Listener interface should be able to alter keyword, test and suite status
http://code.google.com/p/robotframework/issues/detail?id=177

Instead of passing in a dictionary that the listener can modify, can the listener interface pass in the actual suite, test or keyword object? Once we have that, that paves the way to add methods in those classes to control execution. For example, test.fail("killed by the listener") could be called to cause a test to fail.

If the objects had public methods to get at their parent, I could do something like `kw.test.fail("listener caused the test to fail")` and `kw.test.suite.fail("listener caused the entire suite to fail")`

The code to pass in the raw objects is trivial, and I would be happy to provide a patch. It's really no more than adding a few more lines to each method in listeners.py, for example:

    def end_suite(self, suite):
        ...
        if li.version == 1:
            li.call_method(li.end_suite, suite.status,
                           suite.get_full_message())
        elif li.version == 3:
            li.call_method(li.end_suite, suite)
        ...


Reply via email to