51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 1060|回复: 0
打印 上一主题 下一主题

WinRunner :Testing multi language applications

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-10-25 12:58:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Description

      How to make WinRunner scripts language independent


Solution

      The easiest way for this is of course to use differnt GUI-maps: one GUI-map for each language. But this causes a lot of additonal work: All these GUI-maps have to be created and what is even worse: to be updated in case of changes to the application.

So I decided to use only one GUI-map for all languages. The first thing to to for this is to avoid language dependent recognition properties (like "label") whereever it is possible. You set this in the GUI-map configuration and we used mainly the 4GL name (eg. "pbname" in case of PowerBuilder) property.
Nevertheless there will always be some objects (especially menu-items etc) which you cannot recognize properly without using the "label".
What I did with these object was to write them in an XLS-Sheet with one column for the logical name, one column for its parent window and one column for each language.
Then I created a startup script which I initialized with a variable for the current language of the AUT to be tested.
With this startup script I open a template GUI-map which contains all objects which are language independent and create a copy of this template GUI-map, which I call "Runtime GUI-map"
By using the language variable I then loop through the XLS-Sheet, get the language dependent label of the object and copy it into the Runtime GUI-map.
After finishing the loop, the Runtime GUI-Map will be closed and loaded and I am ready for language independent testing...


               
######################################################################################
######################################################################################
#                                 Script one begins here:                                                                                                                                                                          

#                                 Declare path for locating files in a commonly accessible folder
                                path="\\\\asoa0004\\Access\\CommDir\\TD_Basel\\Tests";
#                                 the following lines pull the current system time
#                                from the workstation for use by the script.
                                CURRENT_TIME= get_time( );
                                SCHEDULED_TIME=CURRENT_TIME+120;#this is 60 * 2 minute(s)
                                split ( time_str(SCHEDULED_TIME), date_array, " " );
                                FORMATTED_TIME= date_array[4];# this displays the time as HH:MM:SS
                                report_msg("Formatted time written :"&FORMATTED_TIME);
#                                Write the raw time, expressed in seconds, to a file       
                                file_open(path &"\\results\\time.txt",FO_MODE_WRITE);
                                file_printf(path &"\\results\\time.txt",SCHEDULED_TIME);
                                file_close(path &"\\results\\time.txt");
                                report_msg("correct time written :"SCHEDULED_TIME);

#                                 Script one ends here                       
######################################################################################
######################################################################################
#                                 Script two begins here:                               

#                                 In a later script, read the results of the earlier script  
                                file_open(path &"\\results\\time.txt",FO_MODE_READ);
                                file_getline(path &"\\results\\time.txt",SCHEDULED_TIME);
                                file_close(path &"\\results\\time.txt");
#                                Now loop until the SCHEDULED_TIME is past                               
                                CURRENT_TIME = get_time();
                                do
                                {
                                CURRENT_TIME = get_time();
                               
                                } while (CURRENT_TIME < SCHEDULED_TIME);
#                                 Write a tl_step so that Test Director will see that the script
#                                 passed successfully                               
                                tl_step("Current time is now past the scheduled time",pass,"The scheduled time arrived");

#                                 Script two ends here
######################################################################################
######################################################################################
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-7 21:50 , Processed in 0.060578 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表