记录阿里巴巴QA架构组成长点滴。2008年关键词为效率,技术,影响力!QA/测试架构师定义:开发和设计测试框架测试库;纵横全局的考虑产品的功能,设计复杂的测试系统;负责研发某一项特定的测试技术;为公司考虑如何提高测试效率。领导公司测试技术的发展和测试策略上的方向,关注整个公司的测试部门的问题,前瞻性的考虑未来的版本的测试策略和技术。测试架构师计划/设计测试平台,关注着产品的测试过程,提供咨询服务,影响到公司内的测试机构测试社区,以及开发机构等,对产品各个方面施加深远而正确的影响,最终提高整体软件质量。
excel采用usedRanage 与jet用select实现单元格访问
上一篇 /
下一篇 2008-05-12 20:08:18
/ 个人分类:自动化测试框架与实现
By Wiston Li
在访问excel时,可用如下两种机制来进行单元格的访问遍历,
1,excel采用usedRanage 遍历到二维数组 2,采用jet用select into 到变量中去
二者都是放在内存中,从这两者的实现思路可以看到提高excel的i/o性能的可能着手地方,
代码如下:
1,
tmpArray = ReadExcel ("d:\devtmp\ADOtest.xls", "join")
For i= 1 to ubound(tmpArray, 1) ' 输出二维数组
For j = 1 to ubound(tmpArray, 2)
msgbox tmp(i,j)
Next
Next
Function ReadExcel(sFileName,sSheetName)
Dim oExcel
Dim oRange
Dim arrRange
On Error Resume Next
Set ōExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open(sFileName)
Set ōRange = oExcel.Worksheets(sSheetName).UsedRange ' 输出到二维数组中oRange
If Err.Number <> 0 Then
ReadExcel = Array("Error")
msgbox ReadExcel
Exit Function
End If
On Error Goto 0
arrRange = oRange.Value
Set ōRange = Nothing
oExcel.Quit
Set ōExcel = Nothing
ReadExcel = arrRange
End Function
2, Function xlsGetSpecifiedDataFromDPForParameterbak(sFilePath, sSheetName, sVarible )
Dim sConnStr
Dim oConn
Dim oRS
Dim oFSO
Dim sSql
Dim iFirstEnd
Dim iSecondEnd
On Error Resume Next
Set ōFSO = CreateObject("scrīpting.FileSystemObject") ' check the file if exists
If not oFSO.FileExists(Trim(sFilePath)) Then
MsgBox "No Datapool File Found"
Exit Function
End If
If Trim(sSheetName)= "" Then ' check the worksheet if exists
MsgBox "No Sheet Found"
Exit Function
End If
' create the jet connection and get the DB object
sConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &sFilePath & ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""; "
Set ōConn = CreateObject("ADODB.Connection")
oConn.Open sConnStr
Set ōRS = CreateObject("ADODB.Recordset")
iFirstEnd=4 ' mark the start flag
iSecondEnd=1000 ' mark the end flag, but unlimit depend on your requirement
sSql="Select * from [" &sSheetName & "$A" &iFirstEnd &":B" & iSecondEnd &"]"
' find the data you want to search
oRS.Open sSql, oConn
If Trim(sVarible) <> "" Then
Do While Not oRS.EOF
If Trim(oRS(0)) = "&end&" Then ' terminal the find until end
Exit Do
End If
If trim (oRS(0)) =trim (sVarible) Then
xlsGetSpecifiedDataFromDPForParameter=oRS(1)
Exit function
End If
oRS.MoveNext
Loop
Else
MsgBox "No data matched"
End If
Set ōConn = nothing
Set ōRS = nothing
Set ōFSO = nothing
If Err.Number <> 0 Then
MsgBox ("Error # " & CStr(Err.Number) & " " & Err.Descrīption & Err.Source)
End If
On Error Goto 0
End Function
相关阅读:
- QTP中对识别为WebElement的对象进行输入操作的一种解决办法 (qaarchitech, 2008-3-17)
- 自动化测试议题 (qaarchitech, 2008-3-18)
- 利用qtpapp自动加载QTP lib文件 (qaarchitech, 2008-3-24)
- 续前:利用winapp设置系统环境变量 (qaarchitech, 2008-3-24)
- 如何对qtp无法识别的web对象输入值 (qaarchitech, 2008-3-24)
- 如何得到odbc数据源中系统DSN的安装配置? (qaarchitech, 2008-4-08)
- 如何得到localmachine的odbc driver安装配置? (qaarchitech, 2008-4-08)
- ADODB.Connection使用OraOLEDB.OracleOracle字串链接数据库 (qaarchitech, 2008-4-14)
- 无人值守运行自动化脚本 (qaarchitech, 2008-5-12)
- 类似ruby中hash table数据结构在QTP中的应用 (qaarchitech, 2008-5-12)
收藏
举报
TAG:
自动化测试框架与实现