Micro Focus QTP (UFT) Forums
Translation Testing (.NET) - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Translation Testing (.NET) (/Thread-Translation-Testing-NET)



Translation Testing (.NET) - MikeZimmermann - 07-17-2008

I am going to be using QTP 9.0 to ease the testing of translations with the newest version of our product. I have been looking through the manual and online for tips but haven't come across too much regarding our need. What I want to know is, what would be the best way to go about creating a test for our needs? What I need is:

-Have QTP go through our program and get the text from every object which has text
-Compare them against the strings from an external file (Excel or XML) or the .resx file
-Make sure that the string is fully displayed within the program and not cut off

I have figured out how to fetch the text from all objects I need but I can't figure out the best way to go about comparing them to what they should be. Would it be best to import all the correct strings as Environment Variables or would it be best to import into the DataTable? Is there a way that I can get the only visible text and the full text to compare? Basically I need to figure out if strings are getting truncated by being too long. I would appreciate any help on this. Thanks.


RE: Translation Testing (.NET) - gammaflare - 07-23-2008

This is interesting........let's start by attacking the first part of the problem

1) I am assuming that the text to be compared is being displayed on a webpage. If it is, you can use DOM functions and get all the text that is being displayed on the page. An ex:
If you want to extract text from let's say List, the text would be embedded in the LI tag of the page. We can use the following code to extract the text
Code:
Lsts = Browser("Title:=.*).Page("Title:=.*").object.GetElementsByTagName("LI")
Now Lsts is an array containing all the text embedded in all the LI tags on that page.

2) Now using FSO or filesystemobject you can import the file which has all the text that is supposedly the expected text on the webpage.

3) Doing an instr or strcmp of both 1 and 2 would solve the problem
ex:
Code:
for each Lst in Lsts
            if instr(1,Lst.innertext, ExpectedText,1)>0
               Reporter.ReportEvent micPass
            Else
               Reporter.ReportEvent micFail
            End if
          Next

I just gave a high level example, but this is just an idea if you feel this is ok you can start building upon it.

All the best.


RE: Translation Testing (.NET) - MikeZimmermann - 07-24-2008

This is actually for a .NET program. Our biggest concern is that text is not getting clipped on labels and buttons. I currently have a test which will go through each form we need tested, get all the children into a set and then go through each one and use GetVisibleText and GetROProerty("text"). This will get the text which is actually shown on the program and what is supposed to be shown.

I am having problems though that sometimes the GetVisibleText does not return the entire text. For instance: One of our dialogs has the title "Marks Not Set" but it is clipped off to show "Marks Not S". Running the script brings back "Marks Not Set" for the GetROProperty("text") but for the GetVisibleText it only retrieves "Marks", even though it shows "Marks Not S". Is there a bug with GetVisibleText in v9.0 or should we be going about this a different way? And don't be afraid to use any in-depth answers...I just posted this in the beginner's forum because there wasn't an advanced one Tongue

Oh and another thing. A lot of elements on our forms are dynamically created. I.e. - Dialogs all use the same object, so all the labels and buttons will have the same name for each instance but the actual text will not. This prevents us from using an imported environment variable list containing each control name and text as there would be no way to distinguish between them.


RE: Translation Testing (.NET) - gammaflare - 07-26-2008

Sorry Mike,

Havent worked on .Net apps before.