0

I'm new to robot framework. I have a robot frame work code which I run using command

robot --variable color:red myrobo.robot

Here I'm passing variable ${color} as command line argument. In robot code I want to check whether the variable color is defined or not. The purpose is if I ran robot code like

robot myrobo.robot

I should have a default value for ${color}. If I didn't pass any command line argument I want ${color} = 'yellow' If I pass command line argument as color:red I should have ${color} = 'red'.

How to achieve this.

1 Answer 1

2

You can define the variable in the variable table with a default value.

*** Variables ***
${color}         yellow

*** Test Cases ***

This value will be overwritten with the command line argument,

robot --variable color:red myrobo.robot

or it will hold its default value when the command line argument is not used.

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

Comments

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.