Downloaded the TC4 from here : http://www.xtras.net/GetFile.asp?ProductFileID=4110
You can also download it from this web site: http://www.automatedqa.com/downloads/download.asp?file=testcomplete4demo.exe&product=tc
But I never tried.
Yesterday I used V
1 Tips
1. 启动所有程序:TestedApps.RunAll
2. 关闭进程:p1.Terminate() 'p1是要关闭的进程名字
3. 代码执行延迟一段时间: BuiltIn.Delay(2000)
4. 直接设定控件的值:
Dim w1
Dim p1
Set p1 = Sys.Process("RealAbility")
Set w1 = p1.WinFormsObject("LoginDialog")
w1.WinFormsObject("txtUserID").Text="s" ‘here set the value
5. Date 、Time 可以显示时间 msgbox Date & Time, 可以用它来动态生成字符串
6. 察看对象是否存在:if w1.Exists then
7. Process.WaitWindow Window.WaitWindow set wText=w4.WaitWindow("TextBoxMaskBox","TextBoxMaskBox")
8. 引用其他单元中的函数
'[VBScript]
'USEUNIT My_Name
9. This example shows how to set nested grid’s value.
dim w
dim w1
set w=Sys.Process("RealAbility").WinFormsObject("MainForm").WinFormsObject("pnlClient").WinFormsObject("SequenceEvaluationDetail").WinFormsObject("pnlContent").WinFormsObject("tabControl").WinFormsObject("tabByPerson").WinFormsObject("grcByPerson")
set w1=w.Views.Item(1).DataSource.Item(0)
call w1.Set_Item(5,99)
W is a GridControl which includes some views.
W1 is one view of w, and then selected the row(0). W1 includes a method named Set_Item, it can set value of cells.
10. This example shows how to work with SQL Server2005.
Dim ad
dim DatabaseName
set ad= ADO.CreateADOTable()
ad.ConnectionString="Provider=MSDASQL.1;UID=sa;PWD=123456;Data Source=TCSql;"
ad.TableName="ORCFPeople"
ad.Open
or
Dim ad 'as ADODB.Connection
dim DatabaseName
set ad= ADO.CreateConnection()
ad.ConnectionString="Provider=MSDASQL.1;UID=sa;PWD=123456;Data Source=TCSql;"
ad.Open
Note: To make the sample work, we created a DSN link to the Northwind database (to create a DSN link, use the ODBC Data Source Administrator. To call it, go toControl Panel | Administrative Tools | Data Sources (ODBC) in Windows NT, 2000, XP or Windows Server 2003 or to Control Panel | Data Sources (ODBC) in Windows 95, 98, Me). It’s name is TCSql.
You can also use this connectString: ad.ConnectionString="UID=sa;PWD=123456;Data Source=TCSql;"
11. TestComplete with CSV file.
Dim ForReading, ForWriting, ForAppending
Dim FS, F, s, i, j
ForReading = 1
ForWriting = 2
ForAppending = 8
Set FS = Sys.OleObject("Scripting.FileSystemObject")
Set F = FS.OpenTextFile(fileName, ForReading)
s = F.ReadLine()
For j = 0 To (GetCSVCount(s) - 1)
GetCSVItem(s, j)’^^^^^^^^^^^^^^^this return a string.
Next
Note:CSV (comma-separated values) files.
2 Testing With TestComplete-Over view
TestComplete is an automated testing manager equally oriented to unit testing, functional (or UI) testing, regression and many other kinds of testing.
Regression n.衰退 回归
2.1 Different Ways of Testing
The basic test sequence is
- Define expected output.
- Feed corresponding input.
- Gather output. Gather推断 集合
- Compare to expected output.
- Call for attention if the comparison fails.
The log lets you filter them by grade, so that in the end you only pay attention to those that deserve attention.
Deserve值得
TestComplete is a leading-edge tool.
If you actually carry out the testing thoroughly and in good time, the natural way to bring all this together is regression testing. The Stores function in TestComplete is meant to provide for this.
Thoroughly十分地, 彻底地
For TestComplete, under some conditions, the application becomes much more transparent.
2.2 Unit Testing
Unit testing consists of testing the functions, procedures or methods that a source module makes available to the rest of the application. A “unit” may be anything from a single function to an entire library. The essential point of unit testing is that only a small part of the intended application is tested.
Essential本质的
Thus, at a minimum, any automated testing tool should provide a way to --
- Run the unit test harness.
- Gather the results which the harness reports.
- Feed the tested unit the required input.
- Get the unit’s output and either return it to the harness for comparison, or compare it directly (which is preferred, since the test tool is “foreign” to the code that generated the output).
2.3 Creating Self-Testing Applications in C#
2.4 Analyzing Test Results
2.5 Handling Unexpected Windows
2.6 Working With Grids