How to replace value generated in robot framework into python data file?

How can I replace the new value from “next_mobile_number” with the old value of “LOGIN_MOBILE_NUMBER” in python file?

========
Testcase

*** Test Cases ***
Update Mobile Number In File
${last_mobile_number} = Get Variable Value ${ONBOARDING_MOBILE_NUMBER}
${next_mobile_number} = Evaluate ${last_mobile_number} + 1
Set Global Variable ${ONBOARDING_MOBILE_NUMBER} ${next_mobile_number}

=============
Testdata.py file

ONBOARDING_MOBILE_NUMBER = “79001011098888”

Updating an actual Python file at runtime is Very Bad Idea.

Store the actual number in separate file and update that when needed.

1 Like