Forum Discussion

MarinaB's avatar
MarinaB
Occasional Contributor
6 years ago

multi language support

Hi,

I recorded Test while my application was set in Serbian language. Test complete recorded clicks trough menu items which I was performing.

Value of menu Item was :    4- Tools|A- Administratorske funkcije

After i changed language of the application. Now all menu items are translated in English language.

Now value of menu Item is :  4 - Tools|A - Functions of administrator

I run test and it fails because the menu item is now written in English and the TestComplete cannot recognized it.

Are there any settings (automatically to update name of menu items with current application language or something alse) which should be set so the test will not fail while I am swapping languages? 

Help, any idea :)

 

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Assuming that you are using NameMapping and Aliases, there are two options:

    -- Create a new configuration (https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/configurations/index.html) and edit it, translating all relevant texts to the required language;

    -- Edit existing NameMapping so that elements' identification use some project variable(s) but not hardcoded text values (https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/basic-mapping-criteria.html#modifying-property-values) and then, in test code, set the value of the variable to the required text.

     

    P.S. The latter approach is a little more complex in the inplementation when compared to the former one, but has an advantage that for partially translated applications it is possible to search first for the translated value and, if not found, search again, but for the original non-translated value and post a warning that some value has not been translated (yet).

    (This is an approach described in the Community many years ago by the guy whose name I cannot recollect at the moment. :( )

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Additionally, this MAY not be a NameMapping issue.  If your problem is 

       

      Menu.ClickItem('4- Tools|A- Administratorske funkcije')

       

      versus

       

      Menu.ClickItem('4 - Tools|A - Functions of administrator')

       

      that's an entirely different problem.  When text strings within an application change, then interaction with those text strings won't work any more.  So, you'll need to find some other way around them.

       

      I honestly, at this moment, don't have a quick and easy solution for you.  Short answer to your question, there is not a "multi-language support" feature in TestComplete to solve this problem because the strings that show up like this are entirely dependant on the AUT.  There is no way for TestComplete to know to translate this string and what to translate it to because it could EASILY be "A - Adminstrator Functions" instead of what's there. 

      What you may have to do is edit your test cases to accommodate differences in languages.  In the case of menus and their associated menu items, ClickItem will take index values instead of strings.  So, for example, if Tools is the 4th option and Administrative functions is the 2nd option, then you could simulate the same action with

       

      Menu.ClickItem('[4]|[2]')

       

      See https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/menu/click-action-menu-control.html

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        In the case of 

        Menu.ClickItem('4- Tools|A- Administratorske funkcije')

         versus

         Menu.ClickItem('4 - Tools|A - Functions of administrator')

         

        You could use a wild card in the name mapping so that you're only focused on the beginning of the string 

        4-Tools|

        no matter which language you are in.  

         

        If your test needs to check the text/language, then split that out into a separate script.  Use the wildcards whenever you simply need to navigate through the app.  That will narrow down the places where you need to worry about the language.

         

        The last time I had to do something similar, we did all the functional testing in one language (pick your favorite) and then had more of a smoke test that would log into the app in each supported language and only check the headers on a few frequently used screens in order to validate the text.  Spelling and grammar errors were considered low priority and we figured that the QAs would spot them or customer service would and there was no need to spend the effort to check it all in an automated test.