Untitled
unknown
plain_text
14 days ago
782 B
2
Indexable
Never
from robot.api import TestData def parse_robot_file(file_path): # Parse the robot file suite = TestData(source=file_path) # Get the first test case if suite.testcase_table: first_test = suite.testcase_table.tests[0] print(f"First Test Case: {first_test.name}") print("Test Case Keywords:") for step in first_test.steps: print(f" {step}") else: print("No test cases found.") # Get all keywords from the Keywords section print("\nAll Keywords from Keywords section:") for keyword in suite.keyword_table.keywords: print(f" {keyword.name}") for step in keyword.steps: print(f" {step}") # Usage file_path = 'path/to/your/robot_file.robot' parse_robot_file(file_path)
Leave a Comment