Silk Test - language and add on
In this article we will explain some advanced features of SilkTest and focus on 4Test language which is the scripting language for SilkTest. We will also touch upon how 4Test language can be used for accessing data bases, DLLs and so on. Various extensions available in the SilkTest for enabling Java, and other add on will be explained as well.
The 4Test Language
The 4Test language is an object oriented fourth generation language ( 4GL ). 4Test offers you many functionalities to ease your life in the form of
A robust library of object oriented classes and methods that specify how a test case can interact with GUI objects of application. For example, for the radio button of your application 4Test will have methods like enable/disable, for textbox it might have functions like setText/getText etc.
Normal language features like loop, control statement, operators data type etc. Apart from these, SilkTest also provide functionalities related to database access, INI files, Date Time, DLL access, threads, exception handling etc. for your various project needs.
Apart from the functionality provided by 4Test language, you can use the resources available on internet. Many people have shared their 4Test code with the rest of community and you can get plenty of help from this shared code. Libraries are available for accessing excel, network related information, date-time conversion etc.
We will discuss database access related functions provided by 4Test in some detail as most of the applications require some kind of database at the backend. In order to validate functionality, sometime it is required to access database and compare results in your automation suite. Database related functions present in SilkTest can help you in achieving this. Some of the main database related functions of SilkTest or 4Test language are discussed below.
DB_Connect - This function should be the first function you should be using if you are using database functions provided by SilkTest. As a parameter to this function, you need to give data source name or DSN that you might have created already. You need to make sure that if you want to modify data in the database, specify Read only parameter as false.
DB_ExecutesSQL - This function is responsible for making the connection to the required table. It accepts connection handle returned by the DB_Connect function and SQL query that should be executed for the database.
DB_FetchNext - As indicated by the name, this query retrieves data from the database. It takes two input, first is the connection handle created using DB_ExecuteSQL method and another is the variable in which results will be stored.
DB_FinishSQL - This function closes SQL connection and deletes all the temporary files created.
DB_Disconnect - This closes the connection to the database handle. With the help of functions specified above, it should be very easy to use DB related function in your functional testing.
Using External DLL in SilkTest
Though SilkTest provides many interesting functions and features, still there are occasions when user need some capability which is not built into the SilkTest. To handle situation like this, SilkTest provide functionality of referencing WIN 32 DLL from inside SilkTest to extend its capabilities. Using this feature, many interesting functions can be performed for example handling network related activities using wininet.dll which is bundled with Internet Explore 4.0 and above and handles all the network related operations etc.. Steps to extend 4Test to use any DLLs can be summarized as follows -
- Obtain a DLL that exposes its function in a C-Style interface. In the absence of such DLL, it can be created very easily.
- Determine the suitable function in the DLL and its input and output parameter.
- Declare this DLL in a include file using the dll keyword.
- Call the functions created in above include file in your script.
After following these four steps, it should be very easy to extend functionality provided by SilkTest using DLLs.
Enabling Java Environment in SilkTest
This is one of the first thing that you need to do if you are testing any java application using SilkTest. Java support for SilkTest is implemented by using additional classes with your application. These additional classes allows SilkTest to query application during recording and identifying objects during play back. These support classes can be found in the JavaEx directory under your normal Silk installation. You should use appropriate JAR files according to the Java version you are using. If you are using SilkTest 6.0 onwards, you should be able to configure this environment using the basic workflow. You need to make sure that when you configure environment, your application under test is not minimized.
SilkTest Add-ons
Apart from out of the box SilkTest features, additional features can be bought for SilkTest for your needs. Following additional features can be used for SilkTest
Extension Kit
As stated earlier, test execution is the functionality of SilkTest agent. Some time if your application is using custom GUI object which can not be identified by SilkTest agent you can extend SilkTest agent using this extension kit. Using this extension, SilkTest agent can be extended to talk to your custom GUI objects.
.NET add-on - For testing .NET applications.
Blue Express Add on - For testing IBM AS/400 and mainframe applications.
AOL Add on - To test AOL browser.
Do you like this post?
Subscribe to receive new posts via RSS or email. Join!

