I have an existing Python I/O library that communicates with a piece of test equipment. I have been tasked with modifying it to add Robot Framework hooks such as keyword decorators, listeners, etc.
The Python library implements ~800 commands, each as a Python method. They’re organized into a few child classes, based on the command group. For example, in Python, I might use it like this:
import FooLibrary
foo = FooLibrary()
foo.group1.reset()
foo.group1.start()
foo.group1.doSomething()
foo.group1.stop()
foo.group2.reset()
foo.group2.start()
foo.group2.subgroup1.bar()
foo.group2.subgroup1.baz()
foo.group2.stop()
Is it even possible to keep the tree-based child class structure like this in a Robot Framework library? I’ve read the RF user guide, and didn’t see anything, so I assume the answer is “no”. But either way, I need to make this library usable within Robot Framework. So is there any advice for naming and organizing keywords for a library this big?
I can’t name the keywords something simple like “Reset”, “Start”, and “Stop”, since there are multiple command groups with those names.
And I can’t name them “Reset Group1”, “Reset Group2” etc because the API docs sort alphabetically, that makes it a huge mess since all the groups are out-of-order.
And I can’t make each group a separate Robot Framework library since they share an I/O communication session to the test equipment.
The only solution I can come up with is to have a giant monolithic test library with all 800+ keywords shoved into it, and prefix them with the group name, e.g.: “Group 1 Reset” “Group 2 Reset” and so on.
This doesn’t seem very elegant to me. Is there a better way to structure and name the keywords in my test library?