Reputation: 3269
I have just started to look at adding robot framework on top of our current pytest based system.
In our test we are doing things like:
network."subnetX".setDelay(200)
network."subnetY".setRandomLoss(20%)
machine.engine.start()/stop()
machine.clutch.engage()/disengage()
machine."somethingelse".engage()/disengage()
machine.engine.setRPM(1200)
machine."somethingelse".set"somethingelse"(300)
How would one go ahead and create a keyword mapping that would support this kind of three/four keyword combo + sometimes one argument so that I can write somethings along the lines of:
set networkY delay 200ms
Set networkX random loss 20%
Start machine engine
Engage machine clutch
Start machine engine
Set machine engine RPM 1200
Set machine 300
Upvotes: 1
Views: 957
Reputation: 6961
This would require a custom Robot Framework Library. In the User Guide the Chapter Extending Robot Framework the section Creating test libraries explains how to create a custom (Python/Java) module whose methods/functions can be used as keywords in Robot Framework script. This includes Keyword Arguments and in the Keyword Names section a paragraph on embedded arguments explains the options you have there.
As the library instance is able to retain state, you can use keywords to set certain variables or store connections to external systems for use by other keywords.
Upvotes: 2