--removekeywords wuks

463 views
Skip to first unread message

Rob Bovill

unread,
May 6, 2013, 4:34:46 PM5/6/13
to robotframe...@googlegroups.com
It appears this flag removes all but one failure from the report, even if Wait Until Keyword Succeeds (WUKS) ends up passing.  Does this sound correct to anyone?  If WUKS passes, that's all I care about.  I don't need log information about the intervening failures.  Our tests use this keyword pretty extensively, and our failure checks (keyword Run on Failure) include capturing the page source and taking a screenshot.  This means our logs are huge, littered with irrelevant page sources and screenshots.

Pekka Klärck

unread,
May 6, 2013, 5:19:36 PM5/6/13
to rbo...@gmail.com, robotframe...@googlegroups.com
2013/5/6 Rob Bovill <rbo...@gmail.com>:
> It appears this flag removes all but one failure from the report, even if
> Wait Until Keyword Succeeds (WUKS) ends up passing. Does this sound correct
> to anyone? If WUKS passes, that's all I care about. I don't need log
> information about the intervening failures.

The current functionality is by design, but obviously the design can
be changed if we agreed it isn't optimal. How should this option work
in your opinion? Should it remove all failed rounds from Wait Until
Keyword Succeeds if there finally was a passing round? I'm fine either
way, but because the change could be considered backwards
incompatible, there needs to be a larger consensus before the feature
can change.

> Our tests use this keyword
> pretty extensively, and our failure checks (keyword Run on Failure) include
> capturing the page source and taking a screenshot. This means our logs are
> huge, littered with irrelevant page sources and screenshots.

You are using Selenium2Library, right? Have you considered using Wait
Until keywords provided by it? They would handle waiting internally
and shouldn't thus create that much noise to log files. Alternatively
you could use --RemoteKeywords PASSED to get even more unnecessary
information removed.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Rob Bovill

unread,
May 6, 2013, 5:50:54 PM5/6/13
to robotframe...@googlegroups.com, rbo...@gmail.com
     I assumed that RemoveKeywords WUKS removed all but the last round, leaving either a Failed or a Passed step.  We use WUKS because we're waiting for an error popup or loading message to go away and Selenium2Library does not offer a "Wait Until Page Does NOT Contain" option.

I have no idea how other people might use WUKS, and you are correct, in that changing the behavior would not be backwards compatible.   However, I am very curious to know how other testers handle waiting for errors to disappear, windows to finish loading or for hidden elements.

Rob

immo

unread,
May 7, 2013, 4:06:49 PM5/7/13
to robotframe...@googlegroups.com, rbo...@gmail.com
Hi,

I wouldn't support changing the behavior...
We used this WUKS functionality and need to have a look to the last passed result. So I think its better to used removekeyword passed to get away of the passed cycles too.

Kevin O.

unread,
May 7, 2013, 5:11:07 PM5/7/13
to robotframe...@googlegroups.com, rbo...@gmail.com
No one has actually requested this keyword be added to the library. I suggest you create an issue.
There are several ways to extend libraries. Whatever way you go it is best to import libraries (at least ones that do not come with RF) through a resource file. The benefit is realized when you can go to that resource and add a library like the one in this post and it is available to many test suites with one change.
Anyways, here is an example of a library that adds a keyword to S2L that you feel ought to be there. Some private methods are called, but this way does not rely on patching. Note that a big difference between the waiting here and Wait Until Keyword Succeeds is that all but fatal errors are ignored with WUKS whereas with this custom library, any error will cause the keyword to stop waiting and fail.
By the way Markus has implemented this keyword as Wait Until Page Not Contains Element in the Java port.

from robot.libraries.BuiltIn import BuiltIn
from Selenium2Library.keywords.keywordgroup import KeywordGroup


def _get_s2l():
    return BuiltIn().get_library_instance('Selenium2Library')

class S2LExt(KeywordGroup):

    def _run_on_failure(self):
        _get_s2l()._run_on_failure()

    def wait_until_page_does_not_contain(self, text, timeout=None, error=None):
        """Waits until `text` is not present on current page.

        Fails if `timeout` expires and text is still present. See
        `introduction` for more information about `timeout` and its
        default value.

        `error` can be used to override the default error message.

        See also `Wait Until Page Contains Element`, `Wait For Condition` and
        BuiltIn keyword `Wait Until Keyword Succeeds`.
        """
        s2l = _get_s2l()
        if not error:
            error = "Text '%s' still on the page in <TIMEOUT>" % text
        page_does_not_contain = lambda text: not s2l._page_contains(text)
        s2l._wait_until(timeout, error, page_does_not_contain, text)
Reply all
Reply to author
Forward
0 new messages