TestComplete 8 provides greater support to verify Microsoft Silverlight 4 application components by using any functional test methodology such as black-box and white-box test mechanisms. In this version of test complete engine can access Silverlight internal objects, methods, properties and fields in order to automate applications.
In order to track Silverlight components by testcomplete engine, first you require to check following “Extend Silverlight Object Tree” checkbox option by navigating to Tools -> Default Project Properties -> Projects -> Open Application -> Silverlight. Subsequent that, the test complete engine will have access to Silverlight objects and their methods, properties and fields and you can employ those elements in your automated tests. (Pls. refer the following screen cap)
Further, you can notice all Silverlight objects and their available methods and properties in the hierarchy of object tree model subsequent to explore browsers such as IE, Firefox.
Now TestComplete introduce a new SlObject method in order to automate applications with Silverlight components. Using this method, users allow obtaining a Silverlight component by its name, which was stated in the application’s source code.
Moreover, TestComplete also offers a SlApplication scripting object that is a wrapper to a Silverlight application’s main class that sum up application defined functionality and inherit methods and properties of the System.Windows.Application class.
As well as the members of this System.Windows.Application class contains the SlClasses property. This property assist you for scripting interface to namespaces and assemblies classes included in your Silverlight application package in the.xap file.
Now Testcomplete provide great opportunity to access static non visual objects and their public members by using SlClasses property. In addition to functional testing, this special feature allows you to perform unit/web component performance testing by using application’s internal classes and their associates.
Hope that the above mentioned features will facilitate you easily creates more powerful automated tests for your Silverlight applications.
To download TestComplete 8 Trial
Sponsored Links
Showing posts with label TestComplete Coding. Show all posts
Showing posts with label TestComplete Coding. Show all posts
How to test Silverlight 4 Applications using TestComplete 8
3:04 PM | Filed Under TestComplete 8, TestComplete Coding, Testcomplete integration with Technologies | 1 Comments
TestComplete Data Driven Automated Testing – Write CSV file data.
The below function write array of row values to csv file by creating file object.
Sample:
Sub Utill_WriteCSV(FILENAMEW,WriteFileArray)
Dim objStream
Dim objFSO
Dim innerIndexW
Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.FileExists(FILENAMEW) Then
Call Log.Error("The File Path " & FILENAMEW & " cannot be found.", HIGHEST_PRIORITY)
Else
Set objStream = objFSO.OpenTextFile (FILENAMEW,8, True)
Call Log.Message("The File Path " & FILENAMEW & " was Found.")
For innerIndexW = 1 to UBound(WriteFileArray)
objStream.WriteLine(WriteFileArray(innerIndexW))
next
End If
objStream.Close()
End Sub (Note: this code based on VB scripts)
Function Steps:
1. Save file path as constant in main function and pass to above < Utill_WriteCSV(FILENAMEW,WriteFileArray)> function.
2. Create a file object for write Functionality.
E.g. Set objFSO = CreateObject("Scripting.FileSystemObject")
3. Verify file object exist for write Functionality.
e.g.
If not objFSO.FileExists(FILENAMEW) Then
Call Log.Error("The File Path " & FILENAMEW & " cannot be found.", HIGHEST_PRIORITY)
Else
4. Open file object and write file values starting from second line (since first line considered as “Field title” row).
e.g. objStream.WriteLine(WriteFileArray(innerIndexW))
Sample:
Sub Utill_WriteCSV(FILENAMEW,WriteFileArray)
Dim objStream
Dim objFSO
Dim innerIndexW
Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.FileExists(FILENAMEW) Then
Call Log.Error("The File Path " & FILENAMEW & " cannot be found.", HIGHEST_PRIORITY)
Else
Set objStream = objFSO.OpenTextFile (FILENAMEW,8, True)
Call Log.Message("The File Path " & FILENAMEW & " was Found.")
For innerIndexW = 1 to UBound(WriteFileArray)
objStream.WriteLine(WriteFileArray(innerIndexW))
next
End If
objStream.Close()
End Sub (Note: this code based on VB scripts)
Function Steps:
1. Save file path as constant in main function and pass to above < Utill_WriteCSV(FILENAMEW,WriteFileArray)> function.
2. Create a file object for write Functionality.
E.g. Set objFSO = CreateObject("Scripting.FileSystemObject")
3. Verify file object exist for write Functionality.
e.g.
If not objFSO.FileExists(FILENAMEW) Then
Call Log.Error("The File Path " & FILENAMEW & " cannot be found.", HIGHEST_PRIORITY)
Else
4. Open file object and write file values starting from second line (since first line considered as “Field title” row).
e.g. objStream.WriteLine(WriteFileArray(innerIndexW))
4:31 PM | Filed Under Data Driven Testing, TestComplete Coding | 1 Comments
TestComplete Data Driven Automated Testing – Read CSV file data.
The below function reads data from any csv file and pass array of row values to another splitting function for decomposition.
Sample:
Function Util_Readcsv(StrFilename)
Dim innerIndex
Dim objFSO
Dim objTextFile
Dim strnextLine
Dim fileArray()
Set objFSO = CreateObject("Scripting.FileSystemObject")
If not objFSO.FileExists(StrFilename) Then
Call Log.Error("The File Path " & StrFilename & " cannot be found.")
Else
Set objTextFile= objFSO.OpenTextFile(StrFilename, 1)
innerIndex = 0
Call Log.Message("The File Path " & StrFilename & " was Found.")
Do Until objTextFile.AtEndOfStream
Redim Preserve fileArray(innerIndex)
strnextLine = objTextFile.Readline
fileArray(innerIndex)=strnextLine
innerIndex = innerIndex + 1
Loop
Util_Readcsv = fileArray
End If
End Function
(Note: this code based on VB scripts)
Function Steps:
1. Save file path as constant in main function and pass to above < Util_Readcsv(StrFilename)> function.
2. Create a file object for Read Functionality.
E.g. Set objFSO = CreateObject("Scripting.FileSystemObject")
3. Verify file object exist for Read Functionality.
e.g.
If not objFSO.FileExists(StrFilename) Then
Call Log.Error("The File Path " & StrFilename & " cannot be found.")
Else
4. Open file object and read file values starting from second line (since first line considered as “Field title” row) and split in to rows and assign to array.
5. Now, pass all splitted row values to decomposition.
E.g. Util_Readcsv = fileArray
6. All row values can be decomposed to field values by using following code sample.
Sample:
'Call Util_Readcsv function for read values from CSV file
FileArray = Util_Readcsv(FILENAME)
'Read Array Raw Values
For outerIndex = 1 to UBound(FileArray)
Call Util_LogFolderstack(outerIndex)
strnextLine = FileArray(outerIndex)
splitString = Split(strnextLine, ",") 'new line as the delimiter, Split returns an array
'Assigning field values each row in CSV file to array
for innerIndex = 0 to UBound(splitString)
Redim Preserve arrArray(innerIndex)
strText = splitString(innerIndex)
arrArray(innerIndex) = strText
next
3:26 PM | Filed Under Data Driven Testing, TestComplete Coding | 0 Comments
Data-Driven Testing With TestComplete V6.0
Data-driven testing is a very important aspect of test automation. In short, the goal is to run a given test or set of tests multiple times with different sets of input data and expected results.
This means using a single test to verify many different test cases by driving the test with input and expected values from an external data source instead of using the same hard-coded values each time the test runs. This way, we can test how the application handles various inputs without having a numerous similar tests that only have different data sets.
By considering these aspects, Testcomplete includes special program objects that let us easily access data stored in an Excel sheet, CSV file or in a ADO database table. These objects are called drivers. They are typically needed to perform data-driven tests, however, we can also use them to retrieve data from the mentioned storages.
The DDT object is used to create drivers for ADO database tables, Excel sheets and files holding comma-separated data (CSV file). Its methods return special “driver” objects that have access to values stored in the mentioned data storages.
CSV Driver – Is used to read text file such as comma delimited (default) or tab delimited (using a
Schema.ini file).
[Note] By default the first row is the header information (or column names) for the driver.
Excel Driver – Is used to read an Excel spreadsheet. The first row of the sheet is the header
information for the driver.
ADO Driver – Is a generic driver for a database table or record set that can be accessed via Microsoft's ADO DB.
In the example below creates a DDT driver for an ADO DB, runs through records of the driver’s table and retrieve & write values stored in record data source to the Notepad.
Dim MyDriver
Sub Main
'Global Variables
Dim SQLStatement
Dim ConnectionString
' Start Notepad
TestedApps.Notepad.Run
'Assign SQL Statement to Variable
SQLStatement = "SELECT TL_Id, TL_Name From Personnel"
'Set Connection String
ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"Initial Catalog=Darshika_TestDB1;Data Source=.\SQLExpress"
'Create Driver
Set MyDriver = DDT.ADODriver(ConnectionString,SQLStatement)
'Call Method
MyDriver.DriveMethod("Main.DDTest1")
End Sub
Sub DDTest1
'Global Variables
Dim p1
Dim w1
Dim w2
Dim KeyStr
'Start & Open Notepad
Set p1 = Sys.Process("Notepad")
Set w1 = p1.Window("Notepad", "*")
Set w2 = w1.Window("Edit")
w2.VScroll.Pos = 0
' Create String with Customer Information
KeyStr = MyDriver.Value("TL_Id")& "," & _
MyDriver.Value("TL_Name")& "," & "[Enter]"
Call w2.Keys( KeyStr)
End Sub
This means using a single test to verify many different test cases by driving the test with input and expected values from an external data source instead of using the same hard-coded values each time the test runs. This way, we can test how the application handles various inputs without having a numerous similar tests that only have different data sets.
By considering these aspects, Testcomplete includes special program objects that let us easily access data stored in an Excel sheet, CSV file or in a ADO database table. These objects are called drivers. They are typically needed to perform data-driven tests, however, we can also use them to retrieve data from the mentioned storages.
The DDT object is used to create drivers for ADO database tables, Excel sheets and files holding comma-separated data (CSV file). Its methods return special “driver” objects that have access to values stored in the mentioned data storages.
CSV Driver – Is used to read text file such as comma delimited (default) or tab delimited (using a
Schema.ini file).
[Note] By default the first row is the header information (or column names) for the driver.
Excel Driver – Is used to read an Excel spreadsheet. The first row of the sheet is the header
information for the driver.
ADO Driver – Is a generic driver for a database table or record set that can be accessed via Microsoft's ADO DB.
In the example below creates a DDT driver for an ADO DB, runs through records of the driver’s table and retrieve & write values stored in record data source to the Notepad.
Dim MyDriver
Sub Main
'Global Variables
Dim SQLStatement
Dim ConnectionString
' Start Notepad
TestedApps.Notepad.Run
'Assign SQL Statement to Variable
SQLStatement = "SELECT TL_Id, TL_Name From Personnel"
'Set Connection String
ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"Initial Catalog=Darshika_TestDB1;Data Source=.\SQLExpress"
'Create Driver
Set MyDriver = DDT.ADODriver(ConnectionString,SQLStatement)
'Call Method
MyDriver.DriveMethod("Main.DDTest1")
End Sub
Sub DDTest1
'Global Variables
Dim p1
Dim w1
Dim w2
Dim KeyStr
'Start & Open Notepad
Set p1 = Sys.Process("Notepad")
Set w1 = p1.Window("Notepad", "*")
Set w2 = w1.Window("Edit")
w2.VScroll.Pos = 0
' Create String with Customer Information
KeyStr = MyDriver.Value("TL_Id")& "," & _
MyDriver.Value("TL_Name")& "," & "[Enter]"
Call w2.Keys( KeyStr)
End Sub
11:23 AM | Filed Under Data Driven Testing, TestComplete Coding | 0 Comments
Search This Blog
Labels
- Data Driven Testing (3)
- Test Automation Basics (3)
- TestComplete 8 (2)
- TestComplete Coding (4)
- Testcomplete integration with Technologies (4)
- TestComplete Test Execution (3)
- TestComplete Test Methodology (1)

