New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support common keyword setup / teardown for a file #5110
Comments
@Brownies maybe https://github.com/sebastianciupinski/robotframework-listenerlibrary is what you are looking for |
If I understood its functionality correctly it's not quite what I'm looking for. I could use |
The reason this functionality hasn't been implemented is that we haven't considered it too common for all or even most of the keywords in a same suite or resource file to have a same setup or teardown. Do you @Brownies have a concrete example about such usage? Implementing this shouldn't be too complicated and the design with |
This functionality would become more usable if we'd allow changing the default setup/teardown within a file like this: *** Settings ***
Keyword Setup Setup 1 # The initial default setup
*** Keywords ***
Keyword 1
xxx
Keyword 2
yyy
*** Settings ***
Keyword Setup Setup 2 # New setup used with the subsequent keywords
*** Keywords ***
Keyword 3
zzz
Keyword 4
ååå The above doesn't currently because default specified in the Settings section apply for the whole file. That's even true if the Settings section is positioned after the test or keyword section it affects. There have now and then been requests to allow changing test related settings (mainly the template), and although they have been rejected earlier I start to like that idea nowadays. The main benefit I see is that it would simplify implementing new parsers for Robot data (e.g. in C or Rust for performance), because a setting like Although the above is somewhat related to this issue, it absolutely would need a separate issue. Changing the behavior would also be somewhat badly backwards incompatible, so it would need a deprecation period. I may submit an issue about that at some point, but others can submit one already now if you find it important. |
Somewhat simplified example is that I have a resource file with a bunch of keywords for a REST API. I want the keywords to be independent in the sense that if the default credentials are good for what I'm doing, then all I need to do in a test file is to import the resource file and call the keyword. I want to use a single RequestsLibrary session per credential set if possible because I don't want to get hundreds of access tokens per test run. So I end up calling Note, we haven't actually upgraded to RF 7 yet so there's no
|
Basically what the user guide says isn't supported at the moment. Something like
Keyword Setup
/Keyword Teardown
settings for resource files to set setup/teardown steps for all keywords, which you could then override with individualSetup
/Teardown
settings in keywords, much likeTest Setup
andSetup
for tests.My use case is simplifying some bits of session management for RequestsLibrary keywords. I realize this is just syntax sugar and very much a "nice to have", rather than a need or a requirement.
The text was updated successfully, but these errors were encountered: