def my_keyword_that_is_supposed_to_add_test_cases_dynamically_to_the_current_suite(self):
suite = {'dirname': ['test1', 'test2']} # A dynamically generated dict that contains
# directories and the tests inside them
for dirname, tests in suite.items():
if len(tests) == 0:
continue
from robot.running.context import EXECUTION_CONTEXTS
suite = EXECUTION_CONTEXTS.current.suite
for test in tests:
t = suite.tests.create('{dir}: {testname}'.format(dir=dirname, testname=test), tags=[dirname])
t.keywords.create('Run Test In Directory', args=[os.path.join(self.dir, dirname), test])Ugh
Just crossed in my mind:
2) You could get the info based on keyword(s) and then could launch new pybot process, example using Process library, to run the required test and later combine the the results to a single result.
-Tatu
Send from my mobile
suite = {} # Contains all the test information
for dirname, tests in suite.items(): if len(tests) == 0: continue with open(os.path.join(outputdir, 'make_test_{dir}_{arch}.txt'.format( dir=dirname, arch=test_arch)), 'w') as outfile: outfile.write('| *Setting* | *Value* |\n') outfile.write('| Library | Process |\n') outfile.write('| Library | MyDefaultsLib | {arch} |\n'.format(arch=test_arch)) outfile.write('| Library | MyMake | {dir} |\n\n'.format(dir=self.dir.replace('\\', '\\\\'))) outfile.write('| *Test Case* | *Action* | *Argument* |\n') for test in tests: outfile.write('| {testname} | Run Test In Directory | {dir} | {testname} |\n'.format( testname=test, dir=dirname) )
--
You received this message because you are subscribed to a topic in the Google Groups "robotframework-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/robotframework-users/Rd8G-53rYJ4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.