Skip to content
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

Test Template can't get keyword from resource #10

Closed
sharpdeep opened this issue Aug 24, 2019 · 1 comment
Closed

Test Template can't get keyword from resource #10

sharpdeep opened this issue Aug 24, 2019 · 1 comment

Comments

@sharpdeep
Copy link

I import resource file contains keywords, and want to use it as a test template.

however, I found that it can only get the keyword from current testsuite.

    def _get_template_keyword(self, suite):
        template = self.template_test.template
        if template:
            for keyword in suite.resource.keywords:
                if self._is_same_keyword(keyword.name, template):
                    return keyword
        raise AttributeError('No "Test Template" keyword found for first test case.')

suite.resource.keywords only get the current testsuite keyword.

can robotframework-datadriver support to use external keyword as template ?

@Snooz82
Copy link
Owner

Snooz82 commented Aug 24, 2019

Hi,

As mentioned in documentation it is not possible to use external Keyword as Template.
Reason are the names of arguments.

https://github.com/Snooz82/robotframework-datadriver/blob/master/Readme.rst#requirements

I would also not recommend to do this, because it would be quite in-transparent to use an external keyword as test. In this case you can not read in TestSuite what the Test is doing.

Anyhow you can workaround this by just adding one local Keyword that calls the “external” Keyword. As Template you use the local one.

@Snooz82 Snooz82 closed this as completed Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants