51Testing软件测试论坛
标题:
winrunner中调用Dll及连接数据库扩展测试功能的用法
[打印本页]
作者:
century
时间:
2006-6-14 07:40
标题:
winrunner中调用Dll及连接数据库扩展测试功能的用法
#----------------------------
#
#例子
#
# 调用DLL 及连接数据库
# 2006 草莓
#----------------------------
# 申明 extdll.dll 的两个函数 .
extern int Min(int x,int y);
extern int Max(int x,int y);
static z;
# 初始化extdll.dll.
function init_dll(lib_path)
{
load_dll (lib_path & "\\extdll.dll");
return(E_OK);
}
# 加载 extdll.dll
init_dll("g:\\out");
# 调用Dll方法l
z = Min(3,5);
pause(z);
# 释放 extdll.dll
unload_dll("g:\\out\\extdll.dll");
# 建立数据库连接
db_connect("query1","DSN=pw");
# 执行查询
db_execute_query ("query1","SELECT * FROM AS_folders",record_number);
val = db_get_field_value("query1","#1","#2");
pause(val);
# 获取行
db_get_row("query1",5,row_content);
#split(row_content, line_arr, "\t");
pause(row_content);
# 获取字段
db_get_headers ("query1",field_num,headers);
pause(field_num);
pause(headers);
#写查询记录到文本
db_write_records("query1","G:\\query1.txt",TRUE, NO_LIMIT);
# 比较文件
file_compare("g:\\w.txt","g:\\w1.txt","save");
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2