0

I am running below code, which runs fine in python , but in robot test its not working:

Python Code :

def test_gender(Gender=None):
    if Gender is "m":
        Gender="Male"
    elif Gender is "f":
        Gender="Female"
    print Gender
    return Gender

test_gender("m")

Expected Output: Male ,

Python Output : Male

Robot Test :

*** Settings ***
Library    test_var.py

*** Test Cases ***
Test_Gender
test_gender     m

Expected Output : Male ,

Robot output : m

Issue : Robot test is printing incorrect output "m" instead of "Male" . What is the way to get correct output from robot test for this scenario.

2
  • 1
    You're testing identity with is, not equality. Commented Mar 27, 2019 at 7:54
  • Replaced "is" with equality "==". Commented Mar 27, 2019 at 8:02

1 Answer 1

1

As per above comment replaced "is" with equality "==". Robot test is giving correct output now.

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

1 Comment

You can self-accept the answer - it really is that, and solves it for you :)

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.