I am looking for a way to write scripts on Robot Framework so that I can run same set of scripts for iOS and Android. I understand that Android and iOS has different arguments for appium on Robot Framework (Also, device name, appPackage etc will be different). How can I write some if/else condition so that I can determine if the simulator is Android then run 'xyz' keywords but if the simulator is iOS then run 'abcd' keywords?
For example:
***Test Case***
Run Keyword if ..... Platform is Android ...... Login for Android
Run Keyword if ..... Platform is iOS ....... Login for iOS
**Keywords**
Login for Android
xyz
Login for iOS
abcd
In this case, how should I determine if "Platform is Android" or "Platform is iOS"?
Best solution would be probably to have ${platform} global variable that would determine platform on a test level. And also you place keyword names from a variable, that means following:
Run Keyword If '${platform}'=='${global_androidPlatform}' ${keywordName}
But I'm pretty sure there is better solution somewhere to be honest. :)