如果晚上月亮升起的时候,月光照到我的门口,我希望月光女神能满足我一个愿望,我想要一双人类的手。我想用我的双手把我的爱人紧紧地拥在怀中,哪怕只有一次。如果我从来没有品尝过温暖的感觉,也许我不会这样寒冷;如果我从没有感受过爱情的甜美,我也许就不会这样地痛苦。如果我没有遇到善良的佩格,如果我从来不曾离开过我的房间,我就不会知道我原来是这样的孤独.

LR调用JavaClass测试

上一篇 / 下一篇  2013-04-27 12:16:28 / 个人分类:loadrunner

^|)w5tp0使用JavaVuser协议调用JavaClass类进行简单介绍,目前在学习中后续补充更多的实例。51Testing软件测试网1k?J8f0]

51Testing软件测试网|[c"kn5WG0M

java代码:51Testing软件测试网Lo b S'B#C-X|E

AjNOYg\0package MAIN;51Testing软件测试网 n5sRrM(c_ w

'Z6NZi5D.x] V(q0public class Birthday {
6Y'|7k'F"kCN2D{D0 public String year;
j9V#X8PS8N0 public String month;
-iolPp3n/wZs/?T0 public String day;
-H,u wS(i`0 public Birthday()
Bf2aqa0_W/o/]0 {
s2ZFvvvX:b_0  year="2000";
XEco7EC8B.d0  month="01";
|8Ug~Zn0  day="01";
rb$L/qs_l?0 }
6a6Aq^h5tE%D&E5e0 public Birthday(String y,String m,String d)
r yPK5`Gw0 {
b^S+^$n0  year = y;
U&}vhq` Xe0  month = m;51Testing软件测试网nrl:q ~-{"M5qU B
  day = d;51Testing软件测试网 m|:K&\7fO8PXH
  System.out.println("OK");
;~fgN!Wu|0 }51Testing软件测试网_1@rr)RYVa.{(HR
 public String getBirthday()
"p)tw dG2F dv0 {51Testing软件测试网6l3d X6k9J'{t@G
  String fullbirthday = month + '-' + day + '-' + year;
2{r*q~ K^.Waa,O,f0  return fullbirthday;
'\`,M X [[1hR @;t0 }

v3_!v3f Z.pGt0

:f/o'W `%y b)J/d0}51Testing软件测试网9[#|&BRn:t B7c.F
java代码写完后,Export成Jar或者zip文件然后在lR中Runtimesetting-->ClassPaths中添加路径就OK了

D PT(mue:F051Testing软件测试网8Ar ~6AZWi

f3Fc9@Nv.z]0

|&qMsF*B0LoadRunner调用代码:

!h*i(w^#E*I/|Xv(l051Testing软件测试网W'nQ [q6y rW6[+[ _"e

/*
^`i#} r(q'l{0 * LoadRunner Java script. (Build: _build_number_)51Testing软件测试网j r u2X(Q
 * 51Testing软件测试网$y+B4| Z%h
 * Script. Description: 调用javaclass类进行测试51Testing软件测试网5KU0\MJ
 *                     51Testing软件测试网? q'VpbQB&asSS
 */
HX7se*FEPy8q051Testing软件测试网8m$X9X uTQ,D+l1L#e
import lrapi.lr;51Testing软件测试网[T(`zY
import MAIN.Birthday;51Testing软件测试网0{A/Fd i:g/a9O

p-a5D:g9K EI%[0public class Actions
9f"bs [2G tm3A0O0{
,},W\ L;{u-H3a3EZV @051Testing软件测试网J@ZD9vS,EyIt
    public int init() throws Throwable {
$a.Zt*Y+W5oh'E0        return 0;51Testing软件测试网Z'EbLQ
    }//end of init51Testing软件测试网5vi\*x!KdK
51Testing软件测试网,W8r8u#|5v/D.ret P9V
    public int action() throws Throwable {51Testing软件测试网H%Dmg2m K%_G(r
        51Testing软件测试网{}l Y$Jc
        Birthday bir = new Birthday("1987","6","1");
RR3h b,?(d$}0        System.out.println(bir.getBirthday());
MAfF r0j^$^ Y0        return 0;
'W!^.V F6x ED m0    }//end of action
CjR6F eQ&r)zS051Testing软件测试网Ji ~(Xn
    public int end() throws Throwable {51Testing软件测试网#X]7IlF _v:_,U+d
        return 0;
3[.b7t#zW yb0    }//end of end51Testing软件测试网Xw ]IJ+lGyPKA
}51Testing软件测试网hG},`V)Uy!g:u

x9?4@(@Ja6H0Iyvu0运行结果:51Testing软件测试网|$i u x H!iXU bh%\

}#vw-T;]8NX&C1Z8Z051Testing软件测试网| uR,htc&_'s9_

9X"]*O+T XnX'],`0这是我想到的方法,如果有更好更方便的方法请指教。

^?h~'g9z/JB0

TAG:

 

评分:0

我来说两句

Open Toolbar