I am working with a Suite that is quite large and often find a need to change some behaviors within a Keyword that I want to then ensure doesn’t cause problems. Up until now, I just search for references and try to perform some due diligence examining and manually running some set of tests followed by just running the whole Suite overnight (as it runs for 16+ hours).
I am looking to do something where I can use prerunmodifier to tag Tests accordingly so that any Test using the desired keyword (directly or indirectly) is executed.
I have successfully managed to get it to run any Tests that directly call a given keyword as follows but cannot figure out how to extend it to look through all the Keywords recursively. Is this possible? Is it terrible idea?? I understand that if I wasn’t careful, it could end up running MANY (or even All Tests)
robot --prerunmodifier keyword_filter.KeywordFilter:"MyModifiedKeyword" --exclude skip .\Tests\UI\MyApplication
against a python file such as…
from robot.api import SuiteVisitor
class KeywordFilter(SuiteVisitor):
def __init__(self, keyword):
self.keyword = keyword
def start_test(self, test):
if not any(self.keyword in kw.name for kw in test.body):
test.tags.add('skip')