51Testing软件测试网9c*zeh;nO*C公司不能上外网,只有周末回家来这里逛逛,好好整理一下自已的BLOG.51Testing软件测试网L%m:]:Dh~edI
C/S结构,新增一条记录,验证保存后记录的内容是否正确。代码如下:51Testing软件测试网&^
BlM7?X+H
用WR来进行自动化测试
^*L'W"_+a1YkK
W04Z2C }I J*A-G/la0#数据库连接51Testing软件测试网T3xm8| h!TE
I
rc=db_connect ("stationnet","DSN=wr_test1;UID=sa;PWD=;APP=WinRunner;WSID=local;DATABASE=stationnet",30);
:e0tQ PmjQZ a051Testing软件测试网c2jNM]_ UGh#判断数据库连接是否成功51Testing软件测试网Mw$J(?4g8`;Hr b7^
if (rc !=E_OK)
H1m"n:e-e0pause("cannot fail");51Testing软件测试网o:sue"B*I$mNo/P
h0Wzv`.J*I0#验证处方'000019857'在数据库中是否存在51Testing软件测试网'y*~nGjsz
mm="'000019857'";51Testing软件测试网|:Ey;s E%H CW"aO:VGQ
a="select get_amount,unit_price,multiple FROM G_RECIPE where recipe_no=" & mm;
RR}PWGR0db_execute_query("stationnet",a,record_num);51Testing软件测试网'n+A;ovf,Y"]1y
#pause ("a is " & a);51Testing软件测试网!uZG2qQ
total=0;
@}
p~3Hv}0for (i=0;i<record_num;i++)51Testing软件测试网b*th!`8}*W-_ faG
{
Y4zj(~1L(|5J0 value=1;
]H9Zy$t%YX0 for (j=0;j<3;j++)51Testing软件测试网vQekZ
{51Testing软件测试网&s$?8@,ZW*`
ADH
val[i,j]=db_get_field_value ("stationnet","#" & i,"#" &j );
!C;X(p#y.c0
7Qw?~$j b.H#R0 value=value*val[i,j];
Z6~H.JMwHJc1N^0 }51Testing软件测试网5xZ^dm$z^;^}
A&B.asW%I"CR.ul0 tl_step("station",0,"第"& i & "的金额:" & value);
9W7d0Ck#g2`0 total=total + value;
T!ku-pY0}51Testing软件测试网7bW,gK
mj
tl_step("stationnet",0,"总金额为:"&total);51Testing软件测试网%}qu%g/w@g
51Testing软件测试网W7kq5abdw_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;
*U{}ZQ1h0db_execute_query("stationnet",dw_xm,record_num);
-N{-ucQe(L-mjz0pause ("dw_xm is " & dw_xm);51Testing软件测试网LU;n:z)P~ E
m;r3cpY
xm_total=0;51Testing软件测试网.vWOL'e7NHo
[
S
for(i=0;i<record_num;i++)51Testing软件测试网)E&VCO(h,@#t]
{51Testing软件测试网(s-{#YU\"QM:V
for (j=0;j<4;j++)
pW
x-gRr0 {
_6E@"b uF,_0 xm_item[i,j]=db_get_field_value("stationnet","#" &i,"#" &j);51Testing软件测试网1_1W-Q6m9o!Bd
D n%m5E8eIXV
zp[0 }51Testing软件测试网D-xv/zeA4F
k=0;
cKI_8G E!Di0 #pause("xm_item[" &i"] is 项目名称" &xm_item[i,k] &"单价" &xm_item[i,k+1]&"数量" &xm_item[i,k+2]&"金额" &xm_item[i,k+1]);
ehI `Ak0 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]);51Testing软件测试网CO|9F:\)Mhtr8d
xm_total=xm_total+xm_item[i,k+1];
YI4Sc"l1U#J^R0}51Testing软件测试网'q@k1Lq
i2{S`
#pause("xm_total is :"&xm_total);51Testing软件测试网r7zpNi/C!T~F|j5w
tl_step("stationnet",0,"xm_total is :"&xm_total);51Testing软件测试网&~G b)`8~X~WM
db_disconnect("stationnet"); 51Testing软件测试网)E*K,DOvry
db_get_headers("stationnet",field_nu,headers);51Testing软件测试网-f_e%Mth-Se
tl_step("station",0,"total" & total);51Testing软件测试网"b.rc S]0^
'KW x!m+k0Z'F5L'O0 51Testing软件测试网$Z.w$y$AP(M
)~$a6`5uzhlm0本文来自我的CSDN博客,http://blog.csdn.net/lwenz/archive/2006/11/03/1365398.aspx51Testing软件测试网i{{;|,K0u