I have begun with automation for a product which is in one language and soon to be ported in another. The only good thing is - Test Automation is just begun.
So there are two things which worry me - hard coded Strings (app title, alert messages etc) in Test Scripts and Test Data which should be keyed in depending on locale.
I was thinking of having a global variable which indicates the locale for which test is to be executed and then deciding on String/test data to be used in test method.
Now consider that I externalize the String I have in tests and then decide string of which language is to be used in my test method, so I could do something like -
public void myAweSomeMethodWorkingInAllLocales() {
if(locale is fr) {
testDataFile=privateLocation/frTestDataForThisLocale
testStringFile=privateLocation/frAPPStringForThisLocale
} else if (locale is in) {
testDataFile=privateLocation/inTestDataForThisLocale
testStringFile=privateLocation/inAPPStringForThisLocale
}
//Carry Out my Super tests here
}
But I find it little cumbersome to do so in each test method of mine. Could I improve it?