Wednesday, June 25, 2008

Comparison between SilkTest and QuickTest Professional

Two months back, I thought to write a post about SilkTest and QTP comparison. Both the tools are market-leading testing tools. The latest versions of both tools have Vista and Flex support. I did not give any detailed description for each feature or item.

Product page
Here I have listed the product pages for both.
Silktest Product Page
Quick Test Professional Product page

Wiki pages
Silktest on Wiki
QuickTestProfessional (QTP) on Wiki

Code samples for both tools
Sample 4test code snippets for SilkTest
Sample QTP and VB Script code snippets

References:


  1. SILKTEST AND WINRUNNER FEATURE DESCRIPTIONS - By Horwath/Green/Lawler

  2. WinRunner vs. QuickTest Pro Quick Comparison - By Shawn LoPorto, Senior Test Automation Architect

  3. AUTOMATION TEST TOOLS - By Ray Robinson, 2001

  4. Comparision of Web testing tools



Comparison Table: SilkTest Vs QuickTest Professional


Features

SilkTest

QuickTest Professional

Recording ScriptRecorder available with different set of features.Recorder available with different set of features.
OS Windows upto Vista, Unix (SilkBean)Windows upto Vista, Unix (Xrunner)
Browsers supportInternet Explorer, Netscape, FireFox, AOLInternet Explorer, Netscape, FireFox, AOL
Database testsWith the help of DSN (ODBC32 Interface)With the help of DSN (ODBC32 Interface) plus VB Scripting
Data functionsGoodGood. Having extensive support for SpreadSheet (Excel).
TestsTermed as Testcase. Each Testcase has block of coding statements.Termed as Actions. Each Action has block of coding statements.
Test ScriptScript is a single file.Actually Script is a folder and have set of supporting files.
Code ViewClassic 4Test, Visual 4TestKeyword View, Expert View
Objects RepositoryOfficial term is Window declarations. They can be edited directly from the Editor.Maintained as separate file. With the help of utility, objects are modified. Two types as per QTP setting. They are 'Per Action Repository' and 'Shared Repository'. File extensions will be varied for each type.
Dynamic objectsObject properties can be passed dynamically. Variety of methods available to handle them.Object properties can be passed dynamically. Another term is known as Descriptive Programming.
Class MappingClass Mapping is available.Class Mapping is available.
Custom ClassesRecorderClass and Extension Kit are available.Virutal Object Wizards available.
Image testingBitmap Capture and Verification functions.Bitmap Capture and Verification functions.
Test/Error RecoveryPowerful Recovery system available.Recovery Manager
VerificationProvided Verify and Verify Properties functions.Provided check points for different purposes.
Results ReportingResults are stored into *.res binary files. It can be converted into differnt formats. Multiple versions can be stored into single file.QTP results are stroed as XML files and can be converted to HTML files. Result folder contain many files. One result folder can store results for only one run.
Test Management Tool IntegrationIntegrated with SilkCentral Test Manager.Integrated with Quality Center.
Distributed TestingRemote Agent.Having Remote COM Agent.
DLL support Only Standard DLLs. It does not support the COM/ActiveX DLLs, which are created by VB/.NET.Both COM and Standard DLLs are supported.
Java SupportYesYes
Flex Support Available to certain extent.Available to certain extent.
DotNet SupportYesYes
Internatioalization (i18N) Support YesYes
Timer functionsHaving rich set of functions to calculate time taken for block of statements or testcases. Help: TimersHaving limited functions to calculate time taken for block of statements or actions. Help: Measuring Transactions
Environment support Can access OS level variables.Can access OS level variables.
Batch RunSuite (*.s) and Test plan (*.pln) are available.Test Batch Runner utility.
Coding 4Test Language. Similar to Visual Basic
Ability to run multiple scripts consistantly and continuously.YesShould run from Quality Center.
Coding Style 4Test Language. Similar to C++Visual Basic Script
Integration with External librariesNO VB Script libraries.
Code Samples Few samples from vendor. Few samples from vendor. But many VB Script samples available on Internet.
OOPs SupportYes. Oops concepts are supported for certain extent. User can extend standard classes.NO
Data types Set of data types are available. User can create their own data types also. Set of data types are available. User cannot create their own data types
Interactive DebuggingDebugging features available.Debugging steps available.
Ease of use Just record and playback, won't help. Medium. Record and playback used to help. Very Simple. Easy to learn.
DocumentationHLP file available. PDF docs are only for beginners.Both CHM and PDF files are available. Enough info.
Tool Updates Continuing process. Continuing process.
Cost~$9KMore than $10K
Script Templates Manual. No Ways to create automatic templates. Manual. No Ways to create automatic templates.
EditorGood. Simple one. Having Project explorer similar to MS Visual Studio.Better one with nice look. But using tabs to show more than one script.
Tool Support Tool support is available for only latest versions (from silktest 8.0 ) Tool support is available for only latest versions.
Latest VersionSilktest 2008QuickTest Professional 9.5
Strengths Good Development language, good online community, recovery system, Good cross browser support, Code MaintenanceThe most popular test tool by great user base, plenty of jobs, good online community, Good cross browser support.
WeaknessesHelpdesk, Slightly expensive, Skilled resourcesHelpdesk (Getting bad now), Expensive tool.
Vendor Borland. Initially developed by Segue. Borland acquired Segue on 2006. HP (Hewlett-Packard). Initially developed by Mercury Interactive. HP acquired Mercury on 2006.
Product Name Changes Initially QA Partner. Later changed to SilkTest.Initially Astra QuickTest. Later changed to QuickTest Professional.



Note:In case, if you want to add or modify any feature, please drop a mail to palani.selvam@gmail.com

Tuesday, June 24, 2008

Windows Vista Presentation

Last month, I have written a post about Free Training on Windows Vista . Now Microsoft made all those sessions download-able. Hope that It will be useful to you. You can download them from following links:

Login URL
Session 1: Optimize Windows Vista - By Sudhir Rao B
Session 2: Deploy Windows Vista - By Sudhir Rao B

Monday, June 23, 2008

QTP - Descriptive Programming

QuickTestProfessional help refers Descriptive Programming as Programmatic description. Below given few info about Descriptive Programming.

Using Object Repository
When you record an operation on an object, QuickTest adds the appropriate test object to the Object Repository. Once the object exists in the Object Repository, you can add statements in the Expert View to perform additional methods on that object. To add these statements, you usually enter the logical name of each of the objects in the object's hierarchy as the object description, and then add the appropriate method.

Descriptive Programming (Programmatic Description) Usage
Programmatic description can be very useful if you want to perform an operation on an object that is not stored in the Object Repository. You can also use programmatic descriptions in order to perform the same operation on several objects with certain identical properties, or in order to perform an operation on an object whose properties match a description that you determine dynamically during the test run.

There are two types of programmatic descriptions:

  1. Static . You list the set of properties and values that describe the object directly in a VBScript statement.
  2. Dynamic . You add a collection of properties and values to a Description object, and then enter the Description object name in the statement.

Using the Static type to enter programmatic descriptions directly into your statements may be easier for basic object description needs. However, in most cases, using the Dynamic type provides more power, efficiency, and flexibility.

Useful Links :
Descriptive Programming by QTP Expert Tarun Lalwani

Sample QTP code for Descriptive Programming - Dynamic

Sample QTP code for Descriptive Programming - Static

Thursday, June 19, 2008

.opt files in Silk test

Definition for .opt file extension
Configuration file that contains preferences and options settings for a specific program; modified by the program when the user selects different options within the program.

OPT files are referenced by several programs including Borland Delphi and SilkTest, Microsoft Visual Studio, Symantec pcAnywhere, and Macrovision FLEXnet Manager.

Options Sets Usage in Silktest
Options sets save all current options except General Options. Options sets can be very useful when trying to use the same scripts on different operating systems. The primary differences between the two may be compiler constants.

You can use options set for following purposes.


  1. To save and load the Silktest Project settings

  2. Run a plan file for particular settings

  3. Specify your options set file, while running from command prompt

See a sample batch file to run the scripts by using options set.
Silktest - Run script in different browsers

Wednesday, June 18, 2008

SilkTest - End of Life information

Earlier Borland announced end of support for few of older versions. I think, it is announced in the last month of 2006. I have given the URL below.

Updating Existing Automation to Eliminate Obsolete Specifiers

In version 8.0, SilkTest will discontinue support for certain platforms and application environments:

* Windows 95, NT4 6A, Windows 2000 SP 1,2,3
* IE 4 (SP2), IE 5.01, IE 5.5, IE 6 SP 0 a.k.a. Gold
* Netscape 4.x, 6.x
* PowerBuilder 6.5, 7, 8
* J2SE 1.1, 1.2.2, 1.3.0, 1.4.0, 1.4.1
* AOL 7, 8 and 8 Plus
* SilkTest’s VO extensions (see Note - Discontinuation of VO )
* JInitiator 

In general, SilkTest attempts to preserve backward compatibility. However, the discontinuation of support for VO extensions, leaving only one extension (the DOM extension) per browser version, made it desirable to streamline the list of browser specifiers in 4Test.inc. Additionally, 4Test.inc included several GUI specifiers that represented platforms that have not been supported for quite a few versions of SilkTest, so the list of GUI specifiers has also been trimmed. If your automation uses GUI or browser specifiers that have been eliminated, then you will need to modify it. The information presented below will describe the changes to the specifier lists and will aid you in updating your automation.

Silktest Info URL: http://www.segue.com/support/technical-support/silktest-end-of-life.asp

Tuesday, June 17, 2008

Silktest - Click HTML objects using JavaScript

I was facing a problem, to click a HtmlImage or HtmlCheckbox, which are non-visible objects in the web page. The scrollbars are not native scrollbars. Silktest is unable to click those objects.

I was reading through SilkTest help 'JavaScript: running with ExecMethod' and went through a Knowledge base article. They helped me to solve this problem. The "ExecMethod()" function runs a JavaScript method or property on an object within a webpage. This function can be used to simulate a mouse click on the form element. Following 4test statement, will simulate a mouse click on the Image object.

wImage.ExecMethod("click()")

Borland - SilkTest's KB Article: http://support.borland.com/kbshow.php?q=20434

Monday, June 16, 2008

4Test - Getting IP address

In automation, sometimes we need to find the tricks to achieve it. Like that I have done to find the IP address of a machine. You can see the following code snippet.

Silktest code - To find IP address of a system

[+] public String GetIpAddress(String sMachineName) [ ] //To get IP Address for the particular machine in Network [ ] List of String lsOutput [ ] String sCommand [ ] String sTemp, sItem [ ] String sResult = NULL [ ] Boolean bResult = FALSE [ ] Integer iPos1, iPos2 [ ] [ ] sCommand = "ping -a {sMachineName}" [ ] Sys_Execute (sCommand,lsOutput) [ ] [ ] //ListPrint (lsOutput) [-] for each sItem in lsOutput [-] if (MatchStr("*pinging*", sItem)) [ ] bResult = TRUE [ ] break [ ] [-] if (bResult) [ ] iPos1 = StrPos ("[", sItem) [ ] iPos2 = StrPos ("]", sItem) [-] if ((iPos1 > 0) && (iPos2 > 0)) [ ] sResult = SubStr(sItem,iPos1+1, iPos2-iPos1-1) [ ] Print ("Found IP Address: {sResult}") [ ] return sResult

Friday, June 13, 2008

Tool Comparison - Silktest Versus VisualTest

You will not get the difference between Silktest and VisualTest in the web. Thats why I thought to update it. See the comparison below.

Features

SilkTest

VisualTest

OSWindows, UnixWindows
BrowsersInternet Explorer, Netscape, FireFoxOnly Internet Explorer
RecorderMouse Clicks and Context SensitiveOnly Mouse Clicks and Keyboard Events
InstallationSimpleEasy
DebuggingGoodFair
VerificationRecorder and code can be usedNeeds to write lot of code
ResultsResults are stored into *.res files. It can be converted into differnt formatsSuite Manager has the flexibility. Otherwise will output to View Port.
Batch RunSuite (*.s) and Test plan (*.pln) are available.Suite Manager is available.
DLL supportOnly Standard DLLs. It does not support the DLLs, which are created by VBSupporting Standard and COM Dlls
Java SupportSupports all Java componentsSupport for only AWT package
InternatioalizationSupport is availableNo
DocumentationHLP file available. PDF docs are only for beginners.Only HLP file available. Adequate.
Distributed Testing4test scripts can be run in multiple systems from single machine.Not Known
Tool SupportTool support is available for only latest versions (from silktest 8.0 )No
UpdatesContinue process. Latest version is Silktest 2008Product updates were stopped seven years ago (from Version 6.5 )
Cost ~$9000 + Support costLess than $1000
Script TemplatesManualAutomatic Templates
EditorBetter OneGood
Coding 4Test Language. Similar to Visual Basic

Thursday, June 12, 2008

VisualTest - Functions by web Tag

Visual Test has the flexibility to click the web objects by the tag. Even you can verify whether the tag exists or not in the web page. Below I've given code snippets to use tag related functions.

VisualTest code : Click based on the given tag details.

'------------------- ' Method : WebClickTag ' Author : T.Palani Selvam ' Purpose : Click based on the given tag. It is useful to nonform tags. ' Parameters: sContext - String, contains web context value. ' sForm - String, contains part of title. ' sTag - String, contains tag data. ' sTagType - String, type of tag to be processed. ' Returns : Returns Integer, either TRUE or FALSE ' Caller : ' Calls : - Nil - '----------------------- Function WebClickTag (sContext As String, sForm As String, sTagType As String, sTag As String) AS Integer WebClickTag = FALSE If WebTagExists(sContext, sTag, sTagType) Then WebTagClick(sContext, sTag, sTagType) LogWrite("Successfully Clicked tag: " + sTagType, 1) WebClickTag = TRUE Else LogWrite("Failure to Click tag: " + sTagType, 1) End IF End Sub


Visual Test code: Check object exists based on the given tag
'--------------------- ' Method : WebTagCheck ' Author : T.Palani Selvam ' Purpose : Check objectexists based on the given tag. It is useful to nonform tags. ' Parameters: sContext - String, contains web context value. ' sForm - String, contains part of title. ' sTag - String, contains tag data. ' sTagType - String, type of tag to be processed. ' Returns : Returns Integer, either TRUE or FALSE ' Caller : ' Calls : - Nil - '--------------------- Function WebTagCheck (sContext As String, sForm As String, sTagType As String, sTag As String) AS Integer WebTagCheck = FALSE If WebTagExists(sContext, sTag, sTagType) Then LogWrite("Successfully Checked tag: " + sTagType, 1) WebTagCheck = TRUE Else LogWrite("Failure to Click tag: " + sTagType, 1) End IF End Sub

Wednesday, June 11, 2008

VisualTest - Radio button functions

Last week, I interviewed one guy and he is using VisualTest in his company. I'm surprised. IBM - Rational VisualTest development was stopped about seven years ago and Still people are using the tool. Here I have given code snippet for Handling Radio buttons in the browser.

Sample VisualTest Code:



'--------------------------------
' Method : WebClickRadio
' Author : T.Palani Selvam
' Purpose : Selects the Radio Button to the given value.
' Parameters: sContext - String, Contains web context
' sForm - String, contains information about Form
' sRadioButton - String, Contains name of control
' sRadioValue - String, Contains value of control
' Returns : Returns Integer, either TRUE or FALSE
' Caller : WebHandleClick(sContext, sForm, sElement ,sElementValue , sElementType)
' Calls : - Nil -
'-----------------------------
Function WebClickRadio(sContext As String, sForm As String, sRadioButton As String,sRadioValue As String) As Integer
Dim iIndex as Integer, iCount As Integer
Dim sControl As String, sTemp As String
Dim lItem As Long, lState As Long

WebClickRadio = FALSE
If (WebRadioExists(sContext,sForm,sRadioButton)) Then
If (Instr(LCase(sRadioValue),"check") = 1 OR Instr(LCase(sRadioValue),"select") = 1) Then
lState = SELECTED
Else
lState = NOTSELECTED
End IF

If (Instr(sRadioButton,"@") = 0) Then
iCount = WebInputelementCount(sContext, sForm,"radio")
For iIndex= 1 To iCount
lItem = iIndex
sControl = Str$(WebInputElementProperty(sContext,sForm, _ord(lItem), "radio", "name"))
sTemp = Str$(WebInputElementProperty(sContext,sForm, _ord(lItem), "radio", "value"))

Print sControl,sTemp

If ((Instr(Lcase(sRadioButton),lcase(sControl)) <> 0) AND (Lcase(Trim(sRadioValue)) = lcase(sTemp))) Then
WebRadioSetState(sContext, sForm, _ord(lItem), lState)
'WebInputElementSetState(sContext,sForm, _ord(lItem), "radio", SELECTED)
WebClickRadio = TRUE
LogWrite("Successfully set the state for radio button " + sRadioButton, 1)
Exit Function
End IF
Next iIndex
LogWrite("Failure to set the state for radio button " + sRadioButton, 1)
Else
WebRadioSetState(sContext, sForm,sRadioButton, lState)
WebClickRadio = TRUE
LogWrite("Successfully set the state for radio button " + sRadioButton, 1)
End IF
Else
LogWrite("Doesn't exist radio button " + sRadioButton, 1)
End IF
End Function


Sample Visual Test Code: Checks the selected Radio Button to the given value


'---------------------------
' Method : WebRadioCheck
' Author : T.Palani Selvam
' Purpose : Checks the selected Radio Button to the given value.
' Parameters: sContext - String, Contains web context
' sForm - String, contains information about Form
' sRadioButton - String, Contains name of control
' sRadioValue - String, Contains value of control
' Returns : Returns Integer, either TRUE or FALSE
' Caller : WebHandleCheck(sContext, sForm, sElement ,sElementValue , sElementType)
' Calls : - Nil -
'--------------------------
Function WebRadioCheck(sContext As String, sForm As String, sRadioButton As String,sRadioValue As String) As Integer
Dim iValue As Integer, iState AS Integer

WebRadioCheck = FALSE
If (WebRadioExists(sContext,sForm,sRadioButton)) Then
If (Instr(LCase(sRadioValue),"check") = 1 OR Instr(LCase(sRadioValue),"select") = 1) Then
iState = SELECTED
Else
iState = NOTSELECTED
End IF

iValue = WebRadioState(sContext, sForm, sRadioButton)
If (iState = iValue) Then
LogWrite("Successful to check Radio " + sRadioButton,1)
WebRadioCheck = TRUE
Else
LogWrite("Failure to check Radio " + sRadioButton ,1)
End IF
Else
LogWrite("Doesn't exist radio button " + sRadioButton, 1)
End IF

End Function

Tuesday, June 10, 2008

Silktest - Compilation Warning

We have one silktest suite, which was developed by using lower version of Silktest. Three years back, We ported that suite to Silktest 6.5. After that no changes are done in the script. While compiling the script in Silktest 7.1 and Silktest 2006, I was getting following warnings. Since it is working fine and Nobody tried to solve this warnings.

d:\scripts\myaut\includes\elementprops.inc(713) *** Warning: Function SelectExistingFormula is not defined for window ElementProperties.Formulas

I searched Silktest Help to see the compilation warning. No documentation about that. I searched in Google and got following results from different release notes.

silk8.0 (SilkTest 2006) ReleaseNotes
When using AutoComplete, the member list occasionally may reveal methods that are not valid for the 4Test class. The compiler will not catch these usage problems, but at Runtime the following exception will be raised when the script is played back:

*** Error: Function <invalid method> is not defined for <window class>.

silk2006 R2 ReleaseNotes
The MoveMouse() method is not defined for the Menu and MenuItem classes.

But None of them are useful. Then I tried each warning and corrected now.

Monday, June 9, 2008

SilkTest - Make sublist from a list

I have written a function to get sublist from a list of items. I have done for STRING type. You can try for ANYTYPE data type.Its usage is similar to SubString. See the following code snippet.

Silktest code sample: GetSubList

[+] public LIST OF STRING GetSubList(LIST OF STRING lsInput, STRING sFirst optional, STRING sLast optional, Boolean bMatch optional) [ ] //To get String list between sFirst and sLast [ ] //If sFirst is NULL or "", SubList will be taken from first item of list [ ] //If sSecond is Null or "", SubList will be taken upto last item of list [ ] //bMatch - FALSE means exact match, TRUE means Partial Match [ ] Integer iCount, iItem [ ] Boolean bFirst = FALSE [ ] Boolean bLast = FALSE [ ] LIST OF STRING lsReturn = {} [ ] [-] if (IsNull(bMatch)) [ ] bMatch = FALSE [-] if (IsNull(sFirst) || (sFirst == "")) [ ] bFirst = TRUE [ ] [ ] iCount = ListCount(lsInput) [-] for iItem=1 to iCount [-] if !(bFirst) [-] if !(bMatch) [-] if (sFirst == lsInput[iItem]) [ ] bFirst = TRUE [ ] ListAppend(lsReturn,lsInput[iItem]) [-] else [-] if (Len(sFirst) <= Len(lsInput[iItem])) [-] if (MatchStr("*{sFirst}*",lsInput[iItem])) [ ] bFirst = TRUE [ ] ListAppend(lsReturn,lsInput[iItem]) [+] else [-] if !(bLast) [ ] ListAppend(lsReturn,lsInput[iItem]) [-] if !(IsNull(sLast)) [-] if !(bMatch) [-] if (sLast == lsInput[iItem]) [ ] bLast = TRUE [-] else [-] if (MatchStr("*{sLast}*",lsInput[iItem])) [ ] bLast = TRUE [-] else [ ] break //Exit from for loop [ ] [ ] return lsReturn [ ]

Friday, June 6, 2008

Unable to load IE (IE7) extension

Sometimes Silktest2006R2 is throwing following error.

*** Error: Unable to load extensions: Enabled extension(s) for iexplore.exe#7 not installed: ActiveX, Accessibility

But Internet Explorer7 exists on that system and earlier Silktest was working fine with IE7. Even restarting Silktest will not be helpful. I didn't try restarting machine.

Problem Cause:
Browser might be running for a long time. Silktest Agent initialization used to fail.

Solution:

  1. Verify your default browser.
  2. Create a new Silktest project and try to enable extension for IE7. Assume that successfully IE7 extension is set for the new project. Now open your old project and try to identify any browser object. IE7 extension will be enabled automatically.

Hope that it will be a useful tips.

Thursday, June 5, 2008

QTP - Handling Dynamic objects

Most of the QTP (Quick Test Professional) users are using playback methods to develop the scripts. Here I have given a code snippet to handle dynamic objects. You can put the object physical description directly. You can develop the script with Object Repository.

Code: Login for Mercury Flight

Dialog("nativeclass:=#32770","text:=Login").Activate Dialog("nativeclass:=#32770","text:=Login").WinEdit("nativeclass:=Edit","attached text:=Agent Name:").Set "tester1" Dialog("nativeclass:=#32770","text:=Login").WinEdit("nativeclass:=Edit","attached text:=Password:").Set "mercury" Call wait(2) Dialog("nativeclass:=#32770","text:=Login").WinButton("nativeclass:=Button","text:=OK").Click

Code: Browser certification dialog
If Browser("name:=Certificate Error: Navigation Blocked").Page("title:=Certificate Error: Navigation Blocked").Exist(0) Then ' To DO End If

Wednesday, June 4, 2008

Silktest - File Handling

Any automation suite must have file handling functions for various scenarios. It may be just text files or any data files. Silktest also has few methods for file handling.

SYS_FileOpen is executed by the Agent process and not by the SilkTest host process. But it is essentially the same as FileOpen. SYS_FileOpen and SYS_FileClose should be used to do file operations in other machines (while the agents are running from other machines ), not in the host machine. Below few 4test code samples are given.

4Test Sample Code: To Read a text file.

[+] public void ReadTxtFile(STRING sFile) [ ] // Purpose: Read contents of a file. [ ] HFILE hFile [ ] String sLine [ ] [ ] hFile = FileOpen (sFile, FM_READ) [ ] Print ("File: {sFile}") [ ] [-] while (FileReadLine (hFile, sLine)) [ ] Print (sLine) [ ] [ ] FileClose (hFile) [ ]

4Test Sample Code: To Create a text file.
[+] public void CreateTxtFile(STRING sFile, STRING sMsg) [ ] // Purpose: Create a txt file. All contents will be removed [ ] // from that file, if that file exists already. [ ] HFILE hFile [ ] String sLine [ ] [ ] hFile = FileOpen (sFile, FM_WRITE) [ ] FileWriteLine (hFile, sMsg) [ ] FileClose (hFile)

SilkTest Sample Code: To append a text file.
[+] public void AppendTxtFile(STRING sFile, STRING sMsg) [ ] // Purpose: Create a txt file. Given string will be appended [ ] // from last line of the file, if that file exists already. [ ] HFILE hFile [ ] String sLine [ ] [ ] hFile = FileOpen (sFile, FM_APPEND) [ ] FileWriteLine (hFile, sMsg) [ ] FileClose (hFile) [ ]

Silk Test Sample Code: To Delete a text file.
[-] void DeleteFile (String sFileName) [ ] // To delete given file, if it exists [-] if (Sys_FileExists(sFileName)) [ ] Print ("Existing file - {sFileName}") [ ] Sys_RemoveFile (sFileName) [ ] Sleep (0.1) [-] if (Sys_FileExists(sFileName)) [ ] Print ("Could not delete file - {sFileName}") [-] else [ ] Print ("Deleted file - {sFileName}") [-] else [ ] Print ("File {sFileName} does not exist.")

Silktest Sample Code: To Separate filename and path.
[+] public void GetFileNameAndPath (String sFileWithPath, inout String sFileName null optional, inout String sFilePath null optional) [ ] // Purpose: To separate filname and path. [ ] String sTmpFile, sTmpPath, sTemp [ ] Integer iPos,iCount = 0 [ ] [ ] sTemp = sFileWithPath [ ] iPos = strPos ("\",sTemp, TRUE) [-] if (iPos > 0) [ ] sFileName = Substr (sTemp,iPos + 1) [ ] sFilePath = Left (sTemp,iPos -1) [-] else [ ] Print (" File {sFileWithPath} does not have File Separator")

Tuesday, June 3, 2008

Silktest - Difference between tag and identifier

Sometimes testers are confused with tag and identifier. Thats why, I prepared this post.

Identifier
Identifier is equal to a variable and it holds the object's reference. The Constraints, which is applicable for variable, is applicable for identifier also. You can not give special characters such as space, dollar etc into the identifier.
Testcases use the identifier to refer to an object. In Winrunner, it is referred as Logical Name.

tag
Tag is a string information, which contains the object details. Tag is the physical description of the object. SilkTest uses the tag to identify objects in the application under test when recording and when executing testcases. Testcases never use the tag to refer to an object. Tags are classified as tag and multitag.

Types of tags:


  1. Caption

  2. Prior text

  3. Index

  4. Window ID

  5. Location

  6. Attributes - only for HTML objects (Added from Silktest 2006).


More details: See the Silktest help for tag: definition

Monday, June 2, 2008

Silktest - No License errors

Sometimes silktest engineers may get error like "NO license for Silktest_GUI x.x". It will not work even if you re-install silkmeter and configuring licenses. At that time, you can check following Two things:

1. You can check your network. Sometimes network identification may go to wrong for silk meter server. We used to give the machine name and few machines are not getting license. At that time, you can not access the license server from that machine. It will work if you give IP address of license server.

2. Mostly lower version of Silktest can use higher version's license. In this case, you may need to restart silkmeter service or machine.