2015-12-03 14:58 GMT+02:00 Joseph Lorenzini <
jal...@gmail.com>:
> Hi all,
>
> I was discussing an issue in the users group and I was told something that
> I'd like to verify the RF developers.
>
> I have a listener that runs at the end of each test case. The listeners
> imports the builtin module and then tags the test case with a tag based on
> test case status.
>
> See here for example code:
>
>
https://gist.github.com/jaloren/651978a1c157051a7fb3
>
> This in fact works.
I don't see anything wrong with that. Accomplish this is a lot easier
with listener v3 introduced in RF 3.0, though:
ROBOT_LISTENER_API_VERSION = 3
def end_test(model, result):
result.tags.add('PASSED' if result.passed else 'FAILED')
> However, I was told in the user group that listeners are
> never meant to interact with the robot framework and that the fact this
> worked was an accident.
>
> There is no documentation in the user guide about this one way or the other.
> Should listeners be used to interact with the robotframework or not? If not,
> then I am thinking the documentation should be updated to reflect that
> minimally.
>
> Personally, I think that would be a useful feature enhancement but I
> obviously don't know the full ramifications of that kind of change. :)
It's true that what listeners can do isn't specified that clearly. The
main problem there is that they can do so much. It is also true that
internal changes may change what listeners can do, but we try to avoid
such changes especially in minor versions. With major versions larger
changes are possible, but most that you can do via BuiltIn ought to be
safe anyway.
Notice also that if you want to alter execution results, using the
aforementioned listener API v3 is typically the easiest and safest
solution.
Cheers,
.peke
--
Agile Tester/Developer/Consultant ::
http://eliga.fi
Lead Developer of Robot Framework ::
http://robotframework.org