cancel
Showing results for 
Search instead for 
Did you mean: 

multi language support

Occasional Contributor

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 Smiley Happy

 

4 REPLIES 4
Community Hero

Re: multi language support

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/conf...) 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/basi...) 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. Smiley Sad )

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Hero

Re: multi language support

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-men...


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Community Hero

Re: multi language support

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.

Contributor

Re: multi language support

You can also address menus by numbers.. 

Aliases.YourApplication.YourMainForm.MainMenu.Click('[0|0]'); 

Numbers are 0 based so above clicks first item in first menu. 

But honestely, if something changes that is quite pain in the ....

 

I don't know if this helps anything but i'll tell anyhow.. 

I have made an published procedure ClikMenuByCaption to our mainform. 
Because for reason or other TC doesn't find items from our menu (it's TTmsAdvMenu).

If you have translations available at runtime you could try to translate text and find with that. 

to access this you must have *.tds files 

function TSKJMainForm.ClickMenuByCaption(const MenuCaption: string): Boolean;
var
  i: Integer;
  Item: TMenuItem;
begin
  Result := False;
  Item := nil;
  if menucaption <>'' then
  begin
    for i:=1 to WordCountL(MenuCaption,'|') do
    begin
      if i=1 then
        item:= OurMainMenu.Items.Find(ExtractWordL(1,MenuCaption,'|'))
      else
      begin
        if assigned(item) then
          item:=item.Find(ExtractWordL(i,MenuCaption,'|'))
        else
          break;
        if (i=Integer(WordCountL(MenuCaption,'|'))) and assigned(item) then
        begin
          Result := True;
         
          SendMessage(Self.Handle,WM_COMMAND,Item.Command,0);
          Exit;
        end;
      end;
    end;
  end;

end;

 

 

Jeemly - Dream Big
https://jeemly.com/
New Here?
Join us and watch the welcome video:
Watch the new Interview