将自已写的一部分测试代码贴出来,希望大家多提意见
来源:互联网 发布:linux 动态域名解析 编辑:程序博客网 时间:2024/04/29 00:35
公司不能上外网,只有周末回家来这里逛逛,好好整理一下自已的BLOG.
C/S结构,新增一条记录,验证保存后记录的内容是否正确。代码如下:
C/S结构,新增一条记录,验证保存后记录的内容是否正确。代码如下:
用WR来进行自动化测试
#数据库连接
rc=db_connect ("stationnet","DSN=wr_test1;UID=sa;PWD=;APP=WinRunner;WSID=local;DATABASE=stationnet",30);
#判断数据库连接是否成功
if (rc !=E_OK)
pause("cannot fail");
#验证处方'000019857'在数据库中是否存在
mm="'000019857'";
a="select get_amount,unit_price,multiple FROM G_RECIPE where recipe_no=" & mm;
db_execute_query("stationnet",a,record_num);
#pause ("a is " & a);
total=0;
for (i=0;i<record_num;i++)
{
value=1;
for (j=0;j<3;j++)
{
val[i,j]=db_get_field_value ("stationnet","#" & i,"#" &j );
value=value*val[i,j];
}
tl_step("station",0,"第"& i & "的金额:" & value);
total=total + value;
}
tl_step("stationnet",0,"总金额为:"&total);
dw_xm="select item_name,unit_price,amount,total from g_outp_bill_item,g_price_list where g_outp_bill_item.item_code=g_price_list.item_code and cf_code=" & mm;
db_execute_query("stationnet",dw_xm,record_num);
pause ("dw_xm is " & dw_xm);
xm_total=0;
for(i=0;i<record_num;i++)
{
for (j=0;j<4;j++)
{
xm_item[i,j]=db_get_field_value("stationnet","#" &i,"#" &j);
}
k=0;
#pause("xm_item[" &i"] is 项目名称" &xm_item[i,k] &"单价" &xm_item[i,k+1]&"数量" &xm_item[i,k+2]&"金额" &xm_item[i,k+1]);
tl_step("stationnet",0,"xm_item[" &i"] is 项目名称" &xm_item[i,k] &"单价" &xm_item[i,k+1]&"数量" &xm_item[i,k+2]&"金额" &xm_item[i,k+1]);
xm_total=xm_total+xm_item[i,k+1];
}
#pause("xm_total is :"&xm_total);
tl_step("stationnet",0,"xm_total is :"&xm_total);
db_disconnect("stationnet");
db_get_headers("stationnet",field_nu,headers);
tl_step("station",0,"total" & total);
#数据库连接
rc=db_connect ("stationnet","DSN=wr_test1;UID=sa;PWD=;APP=WinRunner;WSID=local;DATABASE=stationnet",30);
#判断数据库连接是否成功
if (rc !=E_OK)
pause("cannot fail");
#验证处方'000019857'在数据库中是否存在
mm="'000019857'";
a="select get_amount,unit_price,multiple FROM G_RECIPE where recipe_no=" & mm;
db_execute_query("stationnet",a,record_num);
#pause ("a is " & a);
total=0;
for (i=0;i<record_num;i++)
{
value=1;
for (j=0;j<3;j++)
{
val[i,j]=db_get_field_value ("stationnet","#" & i,"#" &j );
value=value*val[i,j];
}
tl_step("station",0,"第"& i & "的金额:" & value);
total=total + value;
}
tl_step("stationnet",0,"总金额为:"&total);
dw_xm="select item_name,unit_price,amount,total from g_outp_bill_item,g_price_list where g_outp_bill_item.item_code=g_price_list.item_code and cf_code=" & mm;
db_execute_query("stationnet",dw_xm,record_num);
pause ("dw_xm is " & dw_xm);
xm_total=0;
for(i=0;i<record_num;i++)
{
for (j=0;j<4;j++)
{
xm_item[i,j]=db_get_field_value("stationnet","#" &i,"#" &j);
}
k=0;
#pause("xm_item[" &i"] is 项目名称" &xm_item[i,k] &"单价" &xm_item[i,k+1]&"数量" &xm_item[i,k+2]&"金额" &xm_item[i,k+1]);
tl_step("stationnet",0,"xm_item[" &i"] is 项目名称" &xm_item[i,k] &"单价" &xm_item[i,k+1]&"数量" &xm_item[i,k+2]&"金额" &xm_item[i,k+1]);
xm_total=xm_total+xm_item[i,k+1];
}
#pause("xm_total is :"&xm_total);
tl_step("stationnet",0,"xm_total is :"&xm_total);
db_disconnect("stationnet");
db_get_headers("stationnet",field_nu,headers);
tl_step("station",0,"total" & total);
- 将自已写的一部分测试代码贴出来,希望大家多提意见
- 我写的string, 字符串类, 望大家多提意见
- 九宫格程序代码 共享并希望大家多提意见
- 我办的有奖注册,大家看看,多提意见。
- 新写了一个DLL注入工具,欢迎大家提意见
- 将matlab原始代码的ROC曲线张贴出来供大家学习
- 在WinForm下利用CurrencyManager对数据集对象进行控制的类,大家多提意见
- 【自然框架】——思路、结构、特点的介绍(初稿,欢迎大家多提意见)
- 考试系统(含源码),希望各位多提意见,谢谢!
- 欢迎大家提意见
- 手机网站,诚邀测试,多提意见
- php写的上传功能(希望对大家有帮助)
- 我们内部培训用的ATL结构图,请大家提意见
- 今编的一段码,大家提意见 关于数学周易
- JavaScript模拟的HashMap,请大家多多提意见!
- 一个iOS程序员自己写代码将Kindle中我的剪贴内容筛选提取出来
- 自己写的一个大小写金额转化函数,贴出来大家看看
- 关于POSA v1巨详细读书笔记,请大家多提意见!
- Windows Vista包装盒……打开后的样子
- 10月9号写的学习总结
- 罗技Alto本本键盘托
- VIJOS p1023 Victoria的舞会3 终于AC了!!!
- 武汉香格里拉·Borland Studio 2006大会
- 将自已写的一部分测试代码贴出来,希望大家多提意见
- 男朋友和男的朋友的区别
- JavaScript中的Boolean,你了解多少?
- 心随绪飘
- 所写之所想
- 关于OLE技术!
- 俄罗斯的公路
- 战果--继围剿Worm.Viking.dy、专杀工具的较量
- 转载:SAP技术概述(二)