Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add possibility to save dynamically created test suite into a robot file #3323

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

Open
mikahanninen opened this issue Oct 2, 2019 · 4 comments

Comments

@mikahanninen
Copy link
Member

Below is an example of the feature.

suite = robot.api.TestSuite('Example')
test = suite.tests.create('T1', tags=['example'])
test.keywords('Log', ['message'])
suite.save('tests.robot')

@pekkaklarck
Copy link
Member

Being able to save executable test suite objects to disk would be handy, but saving them into *.robot files is not exactly trivial. Some problems that need to be addressed:

  • Mapping test setup, teardown, template, tags and timeout to test specific settings like [Setup] and file related settings like Test Setup is complicated. Could obviously only use test specific settings but then there would be some duplication.
  • If a suite has child suites, saving would need to create a directory structure. Possible but some work.
  • A programmatically creates suite can have both tests and suites but there's no way to do that using *.robot files. One possibility to handle that would be allowing tests __init__.robot files, but that would need its own issue. Alternatively there should be an error in this case.

An alternative would be creating a new format that would allow saving the whole directory structure into a single file. That would allow pretty interesting possibilities to create tests in different formats, but designing such a format would also be a pretty big task.

@ynpgbr
Copy link

ynpgbr commented Jul 3, 2020

Hi

I would like to create .robot file from robot.api or save py file in the current directory , In which variable can I capture the code generated by the testsuite and testcase

Regards

@blimundo
Copy link

blimundo commented Mar 8, 2022

Being able to save executable test suite objects to disk would be handy, but saving them into *.robot files is not exactly trivial. Some problems that need to be addressed:

  • Mapping test setup, teardown, template, tags and timeout to test specific settings like [Setup] and file related settings like Test Setup is complicated. Could obviously only use test specific settings but then there would be some duplication.
  • If a suite has child suites, saving would need to create a directory structure. Possible but some work.
  • A programmatically creates suite can have both tests and suites but there's no way to do that using *.robot files. One possibility to handle that would be allowing tests __init__.robot files, but that would need its own issue. Alternatively there should be an error in this case.

An alternative would be creating a new format that would allow saving the whole directory structure into a single file. That would allow pretty interesting possibilities to create tests in different formats, but designing such a format would also be a pretty big task.

Hi @pekkaklarck, this feature has been implemented?

@pekkaklarck
Copy link
Member

No concrete plans for implementing this. It's more likely that we add support for saving executable suites into JSON. For more details see #3902.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants