自动化测试专家,专注于自动化测试领域的框架开发及国外最新自动化技术,担任过银行、电子商务等项目的自动化测试工作,精通自动化测试工具QTP、Watir等.并对QTP有过深入的研究,有过企业内训和工具培训经验,希望能与各位同行一起沟通,交流,探讨。 zzxxbb112@hotmail.com

【QTP系列讲座 27】== ArrayList数组类在DotnetFactory中的应用 ==

上一篇 / 下一篇  2011-10-31 16:58:46 / 个人分类:QTP系列讲座

 Rss订阅IQuickTest关于如何订阅?

7@,]G#H t\#t0
GoogleReader订阅地址: http://feeds.feedburner.com/iquicktest

51Testing软件测试网.vn&spM(d[]

作者:zzxxbb112
时间:2010/02/09 版权所有,侵权必究。51Testing软件测试网2`a r1{rq6rwW/C

出处:http://blog.csdn.net/zzxxbb11251Testing软件测试网bV/u.BxnLM


        很久没有来更新博客了,主要原因还是由于还是由于CSDN博客无法上传图片,而看惯我博客的朋友应该都知道我的博客一向是有图文解说的,就像做数学题一样,需要数形结合。今天我实在忍不住了还是要爬上来写一篇,博客内容由于不能上传图片,因此特地挑了这个比较简单的主题,呵呵,不废话了,进入正题,会点VBS的朋友应该都知道VBS中的数组是使用ARRAY或者DIM申明后进行初始化来创建的,来看如下脚本

(|O`[`u0
  • Array函数创建

person = array("zxb001","zxb002","zxb003") 
For i=0 To UBound(person) 
    MsgBox person(i) 
Next51Testing软件测试网#`Z*d_*P rDA [

  • Dim申明创建

Dim person(2) 
person(0)="zxb001" 
person(1)="zxb002" 
person(2)="zxb003" 
For i=0 To UBound(person) 
    MsgBox person(i) 
Next51Testing软件测试网qJ)e*@+a8O[a_

其实除了以上两种方法外还有很多种方法,我们可以使用字典对象,也可以使用容器对象,这里我们主要讲解DOTNETFACTORY中的System.Collections.ArrayList类,接下来看例子:51Testing软件测试网`X|w}#^Ie

Set MyList = DotnetFactory.CreateInstance("System.Collections.ArrayList")

m)DZ9u6h6W0

With myList 
    .Add("zxb001") 
    .Add("zxb002") 
    .Add("zxb003") 
    .Add("zxb004") 
    .Add("zxb005") 
End With

kx bx;f'm0

For i = 0 To MyList.Count -1 
    MsgBox  MyList.Item(i) 
Next

4a-Bj d&}@g~+]0

Set MyList = nothing51Testing软件测试网qW+B&VT0f8be

同样此方法也可以使用CREATEOBJECT来创建

`(A+eRZZ-k/r0

Set MyList=CreateObject("System.Collections.ArrayList") 
With myList 
    .Add("zxb001") 
    .Add("zxb002") 
    .Add("zxb003") 
    .Add("zxb004") 
    .Add("zxb005") 
End With51Testing软件测试网2f\2^E6R:k

For i = 0 To MyList.Count-1 
    MsgBox  MyList.Item(i) 
Next

f Zo:b-X @n0

Set MyList = nothing51Testing软件测试网uoU#g0ykg|

以下是ArrayList的所有方法,有兴趣的朋友可以试试51Testing软件测试网cpx/d#V&VZ

Add – adds an item in an arraylist 
MyList.Add(”ListItem”)51Testing软件测试网S U/rc1Q'WkEC*[+W

Remove – removes an item from the arraylist 
MyList.Remove(”ListItem “)

nS)c|Q Skm [0

RemoveAt – removes an item from the specified position in the arraylist 
MyList.RemoveAt(3)51Testing软件测试网%@%o+GPB1sHj3G,q

Insert – Inserts an item at a specified position in the arraylist 
MyList.Insert(3,”ListItem”)

LL0j'HnG&n#[5R7Y0

Sort – Sorts items in the arraylist 
MyList.Sort51Testing软件测试网u-L,hte!no


TAG: iquicktest QTP qtp

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-12  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 32218
  • 日志数: 49
  • 建立时间: 2009-10-17
  • 更新时间: 2011-10-31

RSS订阅

Open Toolbar