Last active
March 6, 2023 14:30
-
-
Save Tattoo/68c2cb8510946275a48e38a2dbaff42f to your computer and use it in GitHub Desktop.
Small dynamic library to facilitate running manual Robot Framework tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import chain | |
from robot.api import TestSuiteBuilder | |
from robot.libraries.BuiltIn import BuiltIn | |
from robot.libraries import Dialogs | |
class MabotLibrary(object): | |
'''MabotLibrary facilitates running manual testing with Robot Framework. | |
You can write your manual test case as Robot Framework test case: | |
*** Test cases *** | |
My manual test cases | |
This test case has steps | |
None of them have automation (yet) | |
So executing the test case would fail with "No keyword with name '...' found." for each keyword | |
MabotLibrary turns each keyword call in a test case to call to RF's Dialogs library, thus enabling the user to run the test case and interactively select for each keyword does it PASS or FAIL: | |
*** Settings *** | |
Library MabotLibrary | |
*** Test cases *** | |
My manual test cases | |
This test case has steps | |
None of them have automation (yet) | |
So executing the test case would fail with "No keyword with name '...' found." for each keyword | |
No external dependencies: just Robot Framework and Python standard libraries. | |
''' | |
def __init__(self, verification_kw_prefix=''): | |
source = BuiltIn().get_variable_value('${SUITE_SOURCE}') | |
this_suite = TestSuiteBuilder().build(source) | |
self.keyword_names = list(chain(*[[kw.name for kw in test.keywords] for test in this_suite.tests])) | |
def get_keyword_names(self): | |
return self.keyword_names | |
def run_keyword(self, name, args, kwargs): | |
Dialogs.execute_manual_step(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment