注:本文最早于2009年5月发表于It168.com
5
月,
Automated
公司的
TestComplete7
发布了,展现了很多令人激动的新特性,
TestComplete7
的口号是:
The Easiest TestComplete Ever.
Script-free testing for new users.
Power-packed features for savvy testers.
Ease of use and low price for all.
誓要改变大众对其一贯的印象,把自己打造成“物美价廉”,功能强大而又简单易用的自动化测试工具形象。
也来关键字驱动测试
TestComplete
一直缺少像
QTP
一样的关键字测试功能,这让很多初学者感觉其使用的难度较高。现在好了,
TestComplete
7
增加了关键字测试功能,实现其“
Script-free testing for new users
”的诺言。
<!-- [if gte vml 1]><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:414.75pt;
height:248.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image001.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image001.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
美中不足的是关键字测试与脚本代码不能互相转换,这多少有点让人跌眼镜,看来
Automated
公司还需要努力加强这方面的功能。作为弥补,
TestComplete 7
支持在脚本代码中调用关键字测试,例如:
Sub
Main
' Enter your code here.
KeywordTests
.Test1.Run
End
Sub
同时也支持在关键字测试视图中调用脚本里定义的过程,例如,对于如下脚本:
Sub
TestCase1
Msgbox "this is TestCase1"
End
Sub
可以在关键字视图中通过“
Run Script Routine
”进行调用。
<!-- [if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75"
style='width:414.75pt;height:244.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image003.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image003.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
调用函数也是同样的做法,例如对于如下函数:
Function
Add(a,b)
c = a + b
Add = c
End
Function
同样可以在关键字测试中调用,调用时输入参数值即可。
<!-- [if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75"
style='width:337.5pt;height:256.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image005.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image005.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
在关键字视图的左侧,提供了各种通过关键字编写测试脚本的工具,例如插入条件判断、循环等。
<!-- [if gte vml 1]><v:shape id="_x0000_i1028" type="#_x0000_t75"
style='width:414.75pt;height:240.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image007.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image007.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
支持
PDA
测试
对
PDA
测试的支持是
TestComplete
7
的另外一大亮点。在
TestComplete
7
中,有专门的扩展用于支持
PDA
应用程序的测试。
<!-- [if gte vml 1]><v:shape id="_x0000_i1029" type="#_x0000_t75"
style='width:405pt;height:240pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image009.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image009.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
支持的版本包括:
Windows Pocket PC 2003, Windows Mobile 5.0
和
Windows Mobile 6.0
。在
Object Browser
中,可以查看远程
PDA
上的进程和对象。
<!-- [if gte vml 1]><v:shape id="_x0000_i1030" type="#_x0000_t75"
style='width:415.5pt;height:311.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image011.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image011.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
不容忽视的
RIA
新版本的
TestComplete
对
RIA
应用程序的支持进一步增强,现在,你可以用
TestComplete
测试
Flash
、
Flex
、
Silverlight
的程序。
TestComplete 7
支持运行于
IE
(
v5~8
)、
Firefox(v1.5~3.0)
上的
Flash
和
Flex
程序。需要注意的是,对于
Firefox
,要求
Flash Player
插件的版本是
9.0.124.0
或以后的版本。
TestComplete 7
支持
Silverlight 2
的应用程序测试。通过
UI Automation
接口访问
Silverlight
界面控件。
在这方面,
TestComplete
比
QTP
等其他自动化测试工具领先不少(
QTP
仅支持
Flex
程序的测试,而且是通过
Adobe
的
Flex Builder
提供的插件来完成的)。在
RIA
应用日趋流行的今天,对
RIA
应用程序的支持是自动化测试工具不容忽视的一项内容。
第三方控件
在
TestComplete 7
中,添加了很多第三方控件的支持,例如
Developer Express XtraEditors
和
XtraBars
、
Infragistics NetAdvantage
、
Syncfusion Essential Studio
、
MFC Feature Pack for Visual C++ 2008
、
Telerik RadControls for ASP.NET
等。
第三方控件是自动化测试过程中碰到问题比较多的地方,
TestComplete
对众多第三方控件的支持无疑为其增色不少。在
Grid
类型的控件方面,
TestComplete
现在又添加了对以下控件的支持:
Borland
TStringGrid
Developer
Express XtraVerticalGrid
、
PropertyGridControl
和
XtraTreeList
Microsoft MFC
PropertyGrid
Rogue Wave
Stingray Objective Grid .NET
Syncfusion
GridControl
和
ScheduleGrid
Xceed Grid for
.NET
尤其值得注意的是,
TestComplete 7
现在支持采用
Qt
和
wxWidgets
框架构建的跨平台应用程序。
TestComplete
支持
MinGW
、
Microsoft Visual Studio .NET 2003,
Microsoft Visual Studio 2005
和
Microsoft Visual Studio 2008
编译的
Qt4.5
程序。
另外,如果碰到一些自定义的
.NET
和
WPF
控件,还可以使用
TestComplete
提供的
SDK
来开发插件,这些插件可以大大提供
TestComplete
与自定义控件的交互能力。
测试命令行应用程序
正当大家在为
TestComplete
对新技术的支持如此神速而惊叹的时候,
TestComplete7
还不失时机地添加了对命令行程序的扩展支持。这对于大家测试一些遗留的骨灰级程序,或者是一些后台服务器上的一些应用程序会比较有用。
TestComplete 7
为我们提供了一种比较特别的命令行应用程序测试的方式,可通过类似于如下所示的代码来访问命令行应用程序的窗口:
Set p = Sys.Process("MyApp")
Set w = p.Window("ConsoleWindowClass", "*")
...
然后,可以通过如下方式向命令行应用程序发送字符串,就像在命令行中敲入命令一样:
Set p = Sys.Process("MyApp")
Set w = p.Window("ConsoleWindowClass", "*")
Call w.Keys("MyString [Enter]");
...
下一步就是获取命令行应用程序的响应了,在
TestComplete
中可以通过
wText
来获取,下面代码展示了一个完整的小例子:
Sub MyTest
Dim p, w, txt, cnt, i, s
Set p = Sys.Process("MyApp")
Set w = p.Window("ConsoleWindowClass", "*")
Call w.Keys("MyString [Enter]")
'
获取命令行窗口的文本
txt = w.wText
'
指定分割符
aqString.ListSeparator = vbNewLine
'
获取文本列表的长度
cnt = aqString.GetListLength(txt)
For i = 0 To cnt - 1
'
获取一行文本的字符串
s = aqString.GetListItem(txt, i)
'
把字符串写入日志
Call Log.Message(s)
Next
End Sub
这种方式获取的是所有文本,如果想以一种交互式的方式来测试命令行应用程序的话,还可以利用
WScript.Shell
,例如下面的代码所示:
Sub Main
Dim WshShellObj, WshShellExecObj, out
Set WshShellObj = CreateObject("WScript.Shell")
Set WshShellExecObj = WshShellObj.Exec("cmd.exe")
'
Flush the stream
out = readTillChar(WshShellExecObj, ">")
Log.Message(out)
'
Send the "ver" command and the new line character
WshShellExecObj.StdIn.Write("ver"+VbCrLf)
out = readTillChar(WshShellExecObj, ">")
Log.Message(out)
End Sub
Function readTillChar(WshShellExecObj,
endChar)
Dim out, curChar
Do
While Not WshShellExecObj.StdOut.AtEndOfStream
curChar = WshShellExecObj.StdOut.Read(1)
out = out + curChar
If (curChar = endChar) Then
readTillChar = out
Exit Function
End If
Loop
End Function
GUI Explorer
除了上面一些主要的改进和新特性外,
TestComplete 7
还在很多细节的地方做了改进和提高,在
Object Browser
中,添加了一个
GUI Explorer
小工具,
GUI Explorer
可以帮助我们查看应用程序
GUI
界面控件的层次结构,例如,下图展现的是
Google
主页的
GUI
界面控件的层次结构:
<!-- [if gte vml 1]><v:shape id="_x0000_i1031" type="#_x0000_t75"
style='width:414.75pt;height:248.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image013.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image013.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
GUI Explorer
可以让我们观察界面上的对象,不管它是可见的还是隐藏的。在
GUI
Explorer
中,窗体控件被画成亮灰色,非窗口控件则画成暗灰色,不可见的控件都是白色的,对于隐藏的控件,则画出其边界。
新加入了
Table
变量类型
TestComplete7
引入了一个新类型的变量
– Table
,其实就是一个二维数组。
<!-- [if gte vml 1]><v:shape id="_x0000_i1032" type="#_x0000_t75"
style='width:414.75pt;height:258.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image015.png" mce_src="file:///C:/DOCUME~1/testware/LOCALS~1/Temp/msohtml1/01/clip_image015.png"
o:title=""/>
</v:shape><![endif]--><!-- [if !vml]--><!-- [endif]-->
Table
可以在
Project
、
Project Suites
和
Keyword test
中使用。例如,下面的代码展示了如何访问
Table
中的数据:
Sub
getTableData
columnCount =
Project
.Variables.Var1.ColumnCount
rowCount =
Project
.Variables.Var1.RowCount
For
I=0 to
rowCount-1
For
J=0 to
columnCount-1
Log
.Message(
Project
.Variables.Var1.Item(J,I))
Next
Next
End
Sub
小结
TestComplete 7
的亮相给我们带来不少惊喜,例如对关键字测试的支持(虽然还有待改进,但是毕竟迈出了第一步)、对
PDA
、
RIA
应用的支持等。
此外,
TestComplete
一如既往地保持对新技术、工具、编译器的及时支持,例如:
IE8
被及时地支持了,
CodeGear
RAD Studio 2009
也被及时地支持了。在
TestComplete
7
中,除了
Microsoft
的
Visual Studio Team System
和
AutomatedQA
自己的
AQdevTeam
外,现在还支持把
bug
录到开源的
Bugzilla
(看来金融危机下,开源的东西开始被重视起来了)。
分享到:
相关推荐
把程序目录bin下:用TestComplete替换掉原有TestComplete 然后启动替换后的程序。 首次登陆按照如下设置: User Name: Eternal Shield Company Name: HOMEZ, Inc. Registration Code: 558B8FDC-6BF62C26-F83BF6FF
5月,Automated公司的TestComplete7发布了,展现了很多令人激动的新特性,TestComplete7的口号是:TheEasiestTestCompleteEver.Script-freetestingfornewusers.Power-packedfeaturesforsavvytesters.Easeofuse 5月...
testcomplete7安装程序及激活码(part3)
这是TestComplete7 基础培训
testcomplete7安装文件及激活码(part2)
关于TestComplete7的学习说明
testcomplete720 XX的东东 也上传在我的资源里面啦
TestComplete中文帮助手册 TestComplete中文帮助手册 TestComplete中文帮助手册 TestComplete中文帮助手册 TestComplete中文帮助手册
TestComplete中文帮助手册,教你如何使用TestComplete
Testcomplete750ent的破解
TestComplete5 KeyGen 可以生成TestComplete5的注册码,其中的keygen.exe杀毒软件可能会报是病毒,本人用是正常的,各位下载时自己衡量吧。提供一组我自己生成的注册码: KLP KLP SSG D8563359-9400D3D0-05000000
介绍TestComplete的基本使用方法,以及如何利用TestComplete的各种特性对.NET软件进行自动化的功能测试
TestComplete is an automated testing tool, designed for advanced and novice testers alike, to create, manage and run tests for any desktop, Web or rich client software. It does not depend on any ...
testcomplete7.2企业版注册机 记得使用的时候关闭杀毒软件
介绍TestComplete的关键字测试介绍TestComplete的关键字测试
TestComplete与QTP的简单比较, 如何选择,一对比便知道!
原来链接不能用了,很多人问,重新上传,跟这个内容一致。 https://download.csdn.net/download/fvafuc/8239685
TestComplete 入门教程(英文版),教你如何创建第一个TestComplete工程
Test Complete自带帮助文档的中文版
这是一个TestComplete的中文帮助,主要包括内容: 1。TestComplete基础教程,大概讲了测试种类,创建一个自动化测试的基本过程,测试对象模型这些基础内容; 2。TestComplete数据驱动测试 3。如何测试.NET应用...