|
1.WR是否支持vs.net
根据Mercury的介绍,他们的对.Net的支持转移到QuickTest Pro上了,如果你需要自动化测试.Net程序(不是web的),建议用
QuickTestPro。也就是说wr不支持vs.net开发的程序
2.我对比两个文件file1.txt和file2.txt,文本内容如下
file1.txt 内容如下:
10523 8315 6804 8387 3643 4550 3457 3649
file2.txt内容如下:
190176 155737 117417 145194 65314 81431 64522 63324
代码如下:file_compare("C:\\file1.txt","C:\\file2.txt","save");
为什么每次对比这两个文件结果都是通过的。
答:这个问题的原因在于它在前面的脚本中对文件进行了操作,没有关闭,所以这段代码运行总是通过
3.如何在winRunner中用Windows的API函数
在使用该API函数前需要先加载该函数然后声明API函数,代码如下
load_dll("user32.dll");
extern int PostMessageA(in long, in long, in long, in long);
win_get_info("{class:window, MSW_class:AfxMDIFrame42, label:\"!WinRunner.*\"}", "handle", hWnd);
PostMessageA(hWnd, 16, 0, 0);
请在尝试以上代码的时候,保存脚本,呵呵!
4.怎样处理跟踪键盘操作?
答:下边的代码希望对你有帮助
function GetKeyStatus(in vKey){
auto pid, thread_id, win_desc, hWnd, KeyState, win_log_name, win_full_desc, focused_obj_desc;
win_desc = "{active:1}";
if (win_exists(win_desc)==0) {
win_get_desc(win_desc, "", "", "", win_full_desc);
GUI_map_get_logical_name( win_full_desc, "", win_log_name, "bla");
win_get_info(win_desc, "handle", hWnd);
pid = GetWindowThreadProcessId(hWnd, NULL);
thread_id=GetCurrentThreadId();
AttachThreadInput(pid,thread_id,TRUE);
KeyState=GetKeyState (vKey);
AttachThreadInput(pid,thread_id,FALSE);
if (KeyState < 0)
return(0); # Key is pressed
else
return (1); # Key is not pressed
}
else
return (-1); # No active window found, so cannot determine key state
} |
|