1

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.