Showing posts with label silktest. Show all posts
Showing posts with label silktest. Show all posts

Friday, January 21, 2011

Silktest2010R2

Silktest 2010R2 has been released in this month and Release notes - SilkTest_ReleaseNotes_en.pdf

Enhancements
Microfocus has improved the support for 64 bit Operating Systems and improved the features for Silk4NET and Silk4J Plugins.

  • Java AWT/Swing Application and Applet Record and Replay Support
  • Adobe Flex Version 4.x Support
  • 64-bit Support for .NET and Windows API-based Applications
  • Default Recording Mode for xBrowser Applications is Low-Level Native User Input
  • Dynamically Invoke Methods
  • SilkTest Workbench - Importing and Exporting Assets, ObjectMaps, Embedded Scripting Language & Integration with Additional Micro Focus Products
  • SilkTest Classic - Dynamic Object Recognition Supports Recording Locator Keywords

End-Of-Life (EOL) Components
I am wondering after seeing MSUIA technology in EOL list. Without that I'm sure that no body can support silverlight automation. Are they serious about this?
  • Adobe Air 1.x
  • Classic OCR
  • Firefox 3.0
  • IBM JRE 1.5
  • Java version 1.5
  • MSUIA technology domain (the WPF technology domain is still supported)

This time, Microfocus has developed few more documents and I like the effort for Migrating from the SilkTest Classic Agent to the Open Agent. More details from below links:
Silktest 2010R2 Release materials
Silktest 2010R2 Classic Documentation

Tuesday, August 17, 2010

Silktest 2010

Microfocus released silktest 2010 last month. It has few additional features and enhancements. First time, release notes are published in PDF format. SilkTest_ReleaseNotes - pdf

Silktest 2010 Features

  1. Visual Tests- SilkTest Workbench lets you quickly record and playback visual tests. Visual tests comprise the basic building
    blocks of an automated testing solution. SilkTest Workbench uses visual tests to mimic the actions that are
    performed while testing an application.
  2. Embedded Scripting Language - SilkTest Workbench's scripting language is Microsoft's Visual Basic, a robust programming language that gives
    you total control over any application running in the Microsoft .NET framework. .NET scripts contain the functionality of a high-level programming language as well as features designed specifically for software control and testing.
  3. Integration with Additional Micro Focus Products- The SilkTest product suite includes two plugins, Silk4NET and Silk4J, which both work with SilkTest Recorder. Additionally, SilkTest Workbench works with SilkCentral Test Manager (SCTM).

I was expecting Silverlight Support in this release. I know that Mirofocus were working for Silverlight support. Microfocus may release the Silverlight support in next version.

Silk4J - Java as scripting language, introduced in Silktest 2008.
Silk4NET - C# or VB.NET as scripting language, introduced in Silktest 2010

End-Of-Life (EOL) Components
Also it has announced End of support for few OS and other features. The following operating systems, features, and integrations are not supported in SilkTest 2010.
  1. SilkTest Classic 4Test outline Editor mode Note: SilkTest Classic will continue to be supported. This change will not affect most SilkTest Classic users.
  2. Windows XP SP2
  3. Windows 2003 Server
  4. Java 1.4
  5. StarTeam integration
  6. PVCS integration

Tuesday, April 27, 2010

Rules for Object Recognition

Object Recognition is very important thing in any GUI testing tool. Silktest also having set of formats and limitations to identify the objects.

MicroFocus/Borland used to publish "Rules for Object Recognition" document for each silktest release. It is available at techpubs-Rules for Object Recognition

Rules for Object Recognition
Caption - Restricted to 127 characters
WindowID - Restricted to 63 characters
Closest Static Text or Attached Text
4Test Produces – Window Declaration Identifier, Single Tag or Multitag
Agent Produces – Index, Prior Text, Location
Extension Produces – WindowID, Caption

We can manage the automation suite properly for minor application changes by making proper tags. I have given few tips to control the UI changes in the application.
Window declarations Level
1. Object caption change. Use multiple tags
2. Object level change. Assume that UserName text field is under a HtmlTable. Now you set a window variable to have same object level.
3. Same set of objects are in multiple pages. Create a class.
4. Use Variables for page title changes.

Functions Level
1. Navigations. For example, clicking a link, clicking a button.
2. Micro functions. Split to small functions as you have to change in only one place.
3. Use some wrapper functions for all classes. For example, an object is a htmlcheckbox and now it is changed to radio button.

Monday, February 1, 2010

New release Silktest 2009 R2

Last week, I attended Microfocus webinar which is about the new features implemented in Silktest, Silkperformer and SilkCentral Test Manager. Silktest 2009 R2 was released on December 2009. I have given the silktest features below:

Features
Web 2.0/RIA suppot

  • Ajax
  • Adobe Flex
  • Embedded browser controls (Win32, SWT, WinForms,WPF)
Standalone Recorder
  • Improved usability through extensive script generation support
Agile enablement
  • Eclipse Plugin
  • Silk4j
Open agent technology
  • Dynamic object recognition
Other Improvements
  • WinForms
  • IE 8.0 on classic agent
  • Workflow integrations
  • Open Agent Support for GUI-Level Testing
Additional Platform support
  • Windows 7
  • Windows 2008 Server

Both tools (Silktest and Silkperformer) look will be same in new versions and tried the same language. Have done many improvements for open agent. Microfocus has done many improvements to SilkCentral Test Manager. SCTM can integrate with many unit testing tools and few other type of tools like VersionOne and Rally etc.

Monday, October 19, 2009

Silk4Com

Silk4com is a COM interface for open agent. Still it is under development. It is an open source project and hosted on google code pages. I would say, it is an innovative idea.

URL: Silk4Com Project page

Summary from Project page
"This project is an add-on for SilkTest 2009. The goal of this project is to provide a COM interface for the Open Agent, which can be used by many different scripting languages to drive the Open Agent. With silk4com you can use most of the JTF API in VBScript, JavaScript or even in VBA, without the need of a Java Compiler and JUnit. "

I tried a sample script and it works fine.
VBS Code with Silk4Com

Sub SimpleTestcase2(browser) Set searchField = browser.Find("//input[@name='q']") searchField.hugo = "asd" WScript.Echo(searchField.hugo) '' Added by Palani searchField.setText("silk4j tutorial") Set btn = browser.find(".//input[@type='submit' and @name='btnG']") 'Set btn = browser.find(".//DomButton[@type='submit' and @name='btnG']") ''Not working btn.click() End Sub
Silk4j Code
@Test public void testSimpleGoogleSearch() throws Exception { // DomTextField[@title='Google Search' and @maxLength='2048' and @size='55' and @name='q' and @autocomplete='off'] DomTextField searchText = (DomTextField)browser.find (".//DomTextField[@title='Google Search' and @name='q']"); searchText.setText(""); searchText.setText("silk4j tutorial"); DomButton btn = (DomButton)browser.find( ".//DomButton[@type='submit' and @name='btnG']"); btn.click(); }

Saturday, September 19, 2009

PDF File Verification

Sometimes testers need to verify the PDF file contents. Few times I have seen the questions related to this in few forums. Verifying graphical contents are not so easy. But we can verify the text content in three ways.

First way - Scripting
You can use any other scripting to verify PDF. You can use Java Script or VB Script. In this way, PDF file will not be opened physically and retrieve the contents internally. For more info, Read through this link - Accessing PDF

Second way - Utility
Convert the PDF files to text by using any utility and then verify text files. There are many freewares available for this kind of purpose. I suggest TextMining Tool. In this way also, PDF file is not opened physically.

Sample code in Silktest

 
STRING sPDF2TxtUtil = "F:\TextMining\minetext.exe"
sCmdExecute = "{sPDF2TxtUtil} {sPdfFile} {sConvertedFile}"
Print ("Command: {sCmdExecute}")
SYS_Execute (sCmdExecute,lsCmdOut)
Print (lsCmdOut)

Third way - Using Adobe Reader
In this way, Open the pdf file using Adobe Reader. Then go to File Menu and then click sub menu Save As Text. Now you can store pdf contents as text file and you can use the text file for verification.

To compare the PDF files, you can use comparison softwares (for ex Beyond Compare from 3.0). They internally convert to text file and then comparing it.

Sunday, August 16, 2009

Silktest 2009

Recently MicroFocus released Silktest 2009. In this release, Silktest has many enhancements for Open Agent and Eclipse Plugin.

Silktest 2009 Page on MicroFocus
Silktest 2009 - Release Notes
Silktest - Supporting documents

New in Silktest 2009

  • AJAX Testing with xBrowser
  • Support for Recording Testcases that Use Dynamic Object Recognition
  • Silk4J Eclipse Plugin
  • New Basic Workflow for Applications that Use the Open Agent
  • Dynamic Object Recognition Supports Locator Keywords
  • The Open Agent Supports Windows Forms Applications
  • Enhancements in the XPath Syntax
  • AnyWin Class Includes Several New Functions and Methods
  • SWTTree Class Includes Several New Functions
  • Several SYS Functions are Supported on the Open Agent
  • SilkTest Recorder

Sunday, July 19, 2009

Verifying Email notifications

For long time, I was looking a solution to automate the verification of email contents. It required to verify for few user accounts, attachments like Excel, PowerPoint and PDF docs. We have few critical features, which required to verify email contents and attachments. Silktest does not have any built-in functions for this activity. However I have to find a solution. The solution should supports IE6 and IE7 browsers and Windows 2000, Windows XP and Vista OS. I had four choices in mind. They are,

  1. Using a command line utility
  2. Using MS Office Outlook COM interface
  3. Using Collaboration Data Objects (CDO) Interface with Outlook Express
  4. Worst case - Automate any email client with UI

Automate any email client with UI
This option was last one. Because I do not want to automate with User Interface. We can build the solution in couple of weeks effort. The issue is the changes with that client. I have to look on support for different Operating Systems such as Windows XP and Vista.

Using Collaboration Data Objects (CDO) with Outlook Express
In my first company, I have used CDO with Visual Basic. See my previous post - Checking Mail Notification. I got a surprise, while I was searching information for CDO Help. Microsoft has stopped the updates on Outlook Express. Earlier Internet Explorer Intallation was bundled with Outlook Express.

Using MS Office Outlook COM interface
I am familiar with VB script. I have used Outlook COM interface [CreateObject("Outlook.Application")] earlier. The issue is, the particular user account mailboxes should be opened, while executing VB Script. Also I thought the license and installation costs.

Using a command line utility
I have searched many times and found a utility. GetMail is a command line utility and it is working in all windows OS. It is available at GETMAIL for Windows It is a cheapest and best utility to fit for my requirements.

Different Cmdline switches of GetMail
Getmail has different switches for various purposes. You can opt appropriate switches as per your requirement.
 

GetMail v1.33: WinNT console utility to download a mailbox's mail.
syntax:
Getmail -u <user> -pw <password> -s <server> [optional switches (see below)]
Getmail -install [ see install details below ]
Getmail -profile [-delete | "<default>"] [profile1] [profileN] [-q]
Getmail -h [-q]
Getmail -forceextract filename

-install <server> <userid> <password> [<delete> [<xtract> [<try> [<port> [<profile>]]]]]
: set's POP3 server, login, password, whether to delete or not (Yes/No),
whether to automatically extract base64/7bit/UU encoded files or not (Yes/No),
number of tries and port for profile
(<delete> <xtract> <try> and <port> may be replaced by '-').

-u <userid> : Specify userid on remote pop3 host
-pw <password>: Specify password for userid on remote mail host
-s <server> : Specify mail server (pop3) to contact
-nodelete : Do not delete messages after downloading (default)
-delete : Delete messages after downloading
-noxtract : Do not extract base64/7bit/UU files after downloading (default)
-xtract [defname]: Extract base64/7bit/UU encoded files after downloading messages
defname is an optional default filename for the extracted file
-domainstamp : Prepend sender's domain name to extracted attachments
-headersonly : Download only the headers of the message
-port <port> : port to be used on the server, defaults to POP3 (110)
-p <profile> : send with SMTP server, user and port defined in <profile>.
-q : supresses *all* output.
-n <n> : Only get 'n' messages
-m <n> : Only get message # n
-b <n> : Retrieve messages beginning from # n
-plain : Extract text/plain segments too (usually ignored)
-h : displays this help.
-try <n times>: how many attempts to access mail. from '1' to 'INFINITE'
-ti <n> : Set timeout to 'n' seconds.
-forceextract fn: Attempt to extract any encoded messages in 'fn'

Installing GetMail
You need to follow the belows steps to install it. Assume that getmail.exe is stored under D:\tools.
  1. First open a command prompt.
  2. Go to D:\tools folder.
  3. Install it by executing below commmand
    Getmail -install mailserver script1@auto.com wrongpwd
    Here mailserver means the mail Server name or IP address

Verifying GetMail
To verify the GetMail installation, you can use following steps.
  1. Goto folder D:\tools
  2. Execute the following command for any user.
    For example, D:\tools\getmail.exe -u script1 -pw TestPassword -s mailserver
  3. Check any error exists on command prompt.
  4. Check on that folder, whether all the mails are downloaded or not. You can see mails like msg1.txt,msg2.txt,..etc

4Test code - To Verify the GetMail
 

[ ] sMailCommand = "{gsToolsDir}\getmail.exe -u {sUser} -pw {sPass} -s {sServer} {sAdditionalSwitch}"
[ ] Print ("Mail Command: {sMailCommand}")
[+] // if (bDeleteAfterReceive)
[ ] // sMailCommand = "{gsToolsDir}getmail.exe -u {sUser} -pw {sPass} -s {sServer} -delete"
[+] // else
[ ] // sMailCommand = "{gsToolsDir}getmail.exe -u {sUser} -pw {sPass} -s {sServer} -nodelete"
[ ] // Checking any errors on command line output
[+] if( 0 != SYS_Execute( sMailCommand, lsGetmailOut ) )
[ ] ListPrint( lsGetmailOut )
[ ] LogError ( "FAIL. Unable to receive the mail." )
[ ] return FALSE
[ ]

Sunday, July 12, 2009

Top 10 Silktest blogs/forums

Earlier I have seen Dmitry Motevich's post 15 QTP sites/blogs/groups/forums. Similarly I have listed for Silktest.

  1. SQA Forums
    Initially it was QAForums. Many silktest users are participating here. You can find many silktest expertise in this forum. It is having more than 50k posts and sample code.
  2. Borland Support
    Tool vendor's support site. Recently borland made compulsory service contract to access Knowledgebase articles and silktest community. It has plenty of usefull KB articles.
  3. Silktest FAQ & Tips
    Great blog for Silktest FAQ and tips. It has detailed solutions for common silktest issues.
  4. Silktest and Automation Tips
    Here user can find Silktest tips, code and automation tricks. Also covering advanced features of Silktest.
  5. Silktest tips
    One more good blog with limited posts.
  6. Silktest Yahoo groups
    It is the only active Silktest yahoo groups. One can find many expertise here.
  7. Silktest Tutorial
    Having detailed tutorials for Silktest.
  8. Silktest on QACampus
    Few more Silktest information is shared here.
  9. Darshan's blog
    Contains mixed of silktest and python posts.
  10. CSDN blog
    Many posts are in Chinese language. Has covered most of the silktest features.


Also I would like to mention few popular silktest sites, which are not available now. Many of you would have seen Bret Pettichord's Software Testing Hotlist. But most of the Silktest links are not exist today. All of them having fundamental and advanced concepts of Silktest. Also they have shared 4test sample code and white-papers.

Jeff Hemsley-OOPs and Classes concepts
Non-exist Link: http://www.weirdness.org/jeff/articles/a_classes.html
Current Page: Classes, Objects, Dynamic Instantiation and Constructors: Is 4Test Really an Object-Oriented Language?

Tony Venditti's Silk Automation Page
Non-exist Link: http://www.iris.com/web/irisdevs.nsf/c404f3f7c0cc20458525618c00633c15/f41c9c2b9b8dc4508525666700747f56?OpenDocument
Info about him: IBM page

Silktest White Papers - ameliortech
Non-exist Link: http://www.ameliortech.com/stuff/toolkits/ST/st_whpap.htm

4Test Hints and Tips
Non-exist Link: http://www.testmap.com/4test/4test_support.htm

Automation Expertise Tutorials
Non-exist Link: http://www.automationexpertise.com/Tutorials/SilkOrganizer/pages/Parent.htm

Mr. Cluey's Kludge Page
Non-exist Link: http://www.sqa-test.com/mr_cluey/

Automation on Quality Tree website
Non-exist Link: http://www.qualitytree.com/autotest/qapartner.htm

Automation Junkies
Non-exist Link: http://www.automationjunkies.com/resources/experts.shtml

I think that I can put them here, If I am able to retrieve those missed pages from my storage or from others. What do you say?

Sunday, July 5, 2009

Silk4J Overview & Analysis

Silk4j was introduced from Silktest 2008. Hereafter user can use Java as test scripting language with the help of Silk4J Package. It is supported only with Open Agent. I hope that Borland might target developers too. User can write java unit tests as well as GUI tests.

From Silktest Help - Silk4J Eclipse Plugin

Silk4J enables user to create functional tests using the Java programming language. Silk4J provides a Java runtime library that includes test classes for all the classes that Silk4J supports for testing. This runtime library is compatible with JUnit, which means you can leverage the JUnit infrastructure and run and create tests using JUnit. You can also use all available Java libraries in your testcases.

The testing environments that Silk4J supports include:

  • Adobe Flex applications
  • Java SWT applications
  • Windows Presentation Foundation (WPF) applications
  • Windows API-based client/server applications
  • xBrowser applications


Silk4J with Open Agent - Google Search testcase

I have gone through documents such as Silk4J_QuickStartGuide_en.pdf and Silk4J_AdvancedUserGuide_en.pdf. I created the sample code and it works fine.

package com.palani;
import org.junit.Before;
import org.junit.Test;

import com.borland.silktest.jtf.Desktop;
import com.borland.silktest.jtf.TechDomain;
import com.borland.silktest.jtf.xbrowser.BrowserWindow;
import com.borland.silktest.jtf.xbrowser.DomButton;
import com.borland.silktest.jtf.xbrowser.DomTextField;

public class GoogleSearch {
private Desktop desktop = new Desktop();
private BrowserWindow browser;

@Before
public void setUp() throws Exception {

browser = (BrowserWindow)desktop.executeBaseState(
"C:/Program Files/Internet Explorer/iexplore.exe", null, null,
".//BrowserWindow", TechDomain.XBROWSER);
browser.navigate("http://www.google.co.in/");
}

@Test
public void testSimpleGoogleSearch() throws Exception {

DomTextField searchText = (DomTextField)browser.find (".//DomTextField[@title='Google Search' and @name='q']");
searchText.setText("");
searchText.setText("silk4j tutorial");
DomButton btn = (DomButton)browser.find(
".//DomButton[@type='submit' and @name='btnG']");
btn.click();
}
}


4Test with Open Agent - Google Search testcase
The same case is written in 4Test. SilkTest supports a subset of the XPath query language. It gives dynamic object recognition.

[ ]
[-] testcase GoogleSearch1 () appstate none //DefaultBaseState
[ ] STRING sUrl="http://www.google.co.in/"
[ ]
[-] if (! InternetExplorer.Exists(2))
[ ] InternetExplorer.Invoke ()
[ ] InternetExplorer.SetActive ()
[ ] InternetExplorer.Maximize ()
[ ]
[ ] WINDOW wMain = Desktop.Find(".//BrowserApplication")
[ ] WINDOW wBrowser = wMain.Find(".//BrowserWindow")
[ ]
[ ] wMain.SetActive()
[ ] wBrowser.Navigate (sUrl)
[ ] WINDOW wText1=wBrowser.Find(".//DomTextField[@title='Google Search' and @name='q']")
[ ] wText1.SetText("Silk4j Tutorial")
[ ] wBrowser.Find(".//DomButton[@name='btnG' ]").Click ()
[ ]
[ ] WINDOW wText2=wBrowser.Find(".//DomTextField[@name='q']")
[ ] wText2.SetText("Silktest Extension Kit")
[ ] wBrowser.Find(".//DomButton[@name='btnG' ]").Click ()
[ ]
[ ]


Selenium RC Java format - Google Search testcase

Selenium is a open source tool and can be used only web based applications. But user can choose different languages to develop the suite. Selenium tests can be written with Selenese, PHP, Perl, Python, Ruby, DotNet and Java.

import org.openqa.selenium.server.SeleniumServerTest;
import com.thoughtworks.selenium.*;
import junit.framework.*;
import org.openqa.selenium.server.SeleniumServer;

public class TestSearch extends SeleniumServerTest {
private Selenium browser;
public void setUp() throws Exception {
SeleniumServer seleniumServer = new SeleniumServer();
browser = new DefaultSelenium("localhost", 5555, "*firefox", "http://www.google.com");
seleniumServer.start();
browser.start();
}

public void testGoogle() {
browser.open("/webhp?hl=en");
browser.type("q", "hello world");
browser.click("btnG");
browser.waitForPageToLoad("5000");
assertEquals("hello world - Google Search", browser.getTitle());
}

public void tearDown() {
browser.stop();
}
}


Few Questions

Now Silktest and selenium both supports in Java language. Silktest supports many type of applications. In other end, Selenium supports many Operating Systems and browsers. I have few questions on Silk4J.
  1. Can Silk4J utilize silktest features such as TestcaseEnter,TestcaseExit,scriptEnter and ScriptExit?
  2. Target audience?
  3. Any Success stories (implementations)?

Saturday, June 27, 2009

Silktest Questions

Last two weeks, I was trying to compile all the silktest related questions. It helps me to dig, how much I know in Silktest. I have left out few areas. I did not cover much on the recent silktest features or additions. I have given just questions only not answers. For answers, you can try this blog - SilkTest FAQ and Technical Questions .

Silktest Basics

  1. What are the file types available in silktest and usage of that?
  2. What is the usage of SilkMeter?
  3. What is a SilkTest Agent?
  4. What is “appstate” in silk?
  5. What is the difference between appstate and testcase?
  6. What is the difference between testcase and function
  7. Can any testcase be called within another testcase?
  8. Can any testcase be called within function?
  9. How can you make shared variables in Silk?
  10. Tell me about options set file (*.opt)?
  11. What is 4test? Do you know about classic 4 test and Visual 4test?
  12. What is a test frame?
  13. Tell me silktest workflows?
  14. Where can you find all the methods for a class?
  15. What is test identifier and tag?
  16. What are the prefixes of every tag identifier while taking window declarations?
  17. If you want to record the mouse move event, then what you have to do?
  18. Explain Basic Workflow in silktest?
  19. Explain Data Driven flow in Silktest?
  20. Different types of tags and can we set the tag dynamically?
  21. What do you meant by Silk Extension?
  22. What are the different Variable pass-modes available and how will you use in scripting?
  23. How can you start one application?
  24. What do you mean by a DefaultBaseState and what role does it play in automated testing?
  25. When is the SilkTest Recovery System used?
  26. How can you run only the failed testcases in the second round of testing?
  27. How can you do database testing using silk?
  28. How will you implement immediate If statements?
  29. How silkAgent interacts with script statements?
  30. Description Equivalent to a function or method call.
  31. Array and List Declaration
  32. Can you give few of common silktest errors
  33. What are the different file opening modes available in silk?
  34. What is the difference between “Log Error”, “Log Warning”?
  35. What is the difference between “ExceptLog” and “LogError” function?
  36. How can you handle exceptions in silk?
  37. What is the difference between “raise” and “re raise” statements in silk?
  38. What are the uses of “Use Path” & “Use File” text field Silk’s option> runtime dialog box?
  39. What does it indicates “Agent.SetOption (OPT_APPREADY_TIMEOUT, 180)”?
  40. How can you identify each and every radio button under radio button group?
  41. What is extension enabler?
  42. How will you access Database, retrieve the records using Silktest? Is there any limitation?
  43. How do I add steps to DefaultBaseState?
  44. Can I call Silk Scripts from an external shell program?
  45. What are the default testplan attributes?
  46. How to define new testplan attributes?
  47. Where are the testplan attributes stored?
  48. How to assign attribute values to test cases?
  49. How to include a test case into a testplan?
  50. How record a test case into a testplan automatically?
  51. How to run all test cases in a testplan?


Application Related
  1. What are the extensions available for IE and Netscape?
  2. How can you develop script, to wait for complete navigation or what is the function to wait until browser is ready?
  3. What is the difference between Browser and Browser2 objects?
  4. How will you open a Browser (IE/Netscape/FireFox)?
  5. Why is a new layer of HtmlText being recorded by SilkTest 6.0?
  6. How can both Netscape and Internet Explorer declarations for SilkTest be consolidated into one set of declarations?
  7. What is the use of “SetUserOption”?
  8. What is the usage of "ShowBorderlessTables" option?
  9. What is the difference between BrowserChild and BrowserPage objects?
  10. How to specify a browser extension to a Web application?
  11. What is class map? What are the different ways of defining class map?
  12. What is option set? Have you ever used option set in silk?
  13. How will you invoke the application, which has login dialogbox?
  14. How will you invoke multiple applications in single test suite?
  15. Have you ever tested images using silk? What are the methods you have used?
  16. Custom objects - Not similar to any standard objects. For ex., Excel, SpreadSheet
  17. What is silk bean?
  18. What are the settings required to invoke a Java application?
  19. What are the settings required to identify Flex objects?


Advanced Silktest
  1. Explain about Open Agent
  2. Difference between Classic and Open Agent
  3. Explain about Silk4j.
  4. Explain about Extension Kit.
  5. Explain how silktest supports OOPs concepts? Give few examples.
  6. How will you extend a method, which is defined for a class?
  7. What does the recording statement do?
  8. How will you overwrite default script and Testcase procedures ?
  9. Have you automated any dynamic pages/controls? How have you done, explain?
  10. How silktest supports DLLs?
  11. How will you run the scripts into another machine?
  12. What are the steps or procedures, you will follow to make silktest suite as robust?
  13. Give an example of setting agent value at runtime?
  14. What is default base state in silk? How can you implement the default base state to its customized base state?
  15. When it is necessary to create a “plan” file instead of “suit” file in silk?
  16. What are the different tags available in “partner.ini” file?
  17. How can you define your own property set?
  18. Silk is having built in recovery system. How is it working?
  19. Few lines of code for some string manipulation operations.
  20. How do I set a option set file dynamically?
  21. How will you handle if a window has many parents?
  22. How will test the application remotely?
  23. Can you avoid the use of sleep()? How?
  24. Have you used Registry related functions?
  25. To create, or "spawn," multiple threads, which statements you will be going to use?
  26. Have you ever used “multitestcase”? Can you tell me in brief.
  27. What is LinkTester?
  28. What are the functions offered by DBTester?


Automation Framework
  1. What is automation framework?
  2. Tell me about few of the Industry standard automation frameworks
  3. Have you ever make an internationalization frame work using silk? What are the constraints you need to take care while making your silk framework as independent of OS, Language?
  4. Different types of framework with a brief explanation of each.
  5. Efficient ways of handling custom objects and Dynamically changing objects?
  6. Have you used XML and Excel files as your input data?

Thursday, April 30, 2009

Flex component automation with Silktest

Overview about Flex
Adobe Flex is a collection of technologies released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the proprietary Adobe Flash platform. MXML, an XML-based markup language, offers a way to build and lay out graphic user interfaces. Interactivity is achieved through the use of ActionScript, the core language of Flash Player that is based on the ECMAScript standard.

The Flex SDK comes with a set of user interface components including buttons, list boxes, trees, data grids, several text controls, and various layout containers. Charts and graphs are available as an add-on. Other features like web services, drag and drop, modal dialogs, animation effects, application states, form validation, and other interactions round out the application framework.

For more info, visit Flex Wiki page Wiki - Adobe Flex

Help from Vendors
Adobe has developed few libraries to support test automation for flex components. To know more about these libraries, you can go through following links.


Borland has given a separate document for flex configuration. You can search in Borland site for ‘QuickTour_Flex.pdf’. Similarly Adobe has published a document ‘Flex2_at_api.pdf’ for Testing Flex Components.

Even Silktest Help documentation contains few pages for Flex and Open Agent. You can check following Silktest Help pages:
  • Testing a Flex Sample Application Using a Dual Agent Approach
  • Enabling Extensions Automatically Using the Basic Workflow
  • Enabling Extensions for Embedded Browser Applications that use the Classic Agent
  • Configuring Security Settings for Your Local Flash Player


Silktest Flex API
As a first step, we need to copy Silktest flex library before building Flex components.
  1. Navigate to Windows Explorer -> Silktest_Installed_Directory\ng\AutomationSDK\Flex\3.0\Automation
  2. Copy FlexTechDomain.swc
  3. Paste into C:\Program Files\Adobe\Flex Builder 3\sdks\3.1.0\frameworks\libs
  4. In this libs folder, you can see few more files such as automation.swc, automation_agent.swc & automation_dmv.swc
Change in Flex XML configuration
To change flex-config.xml
  1. Navigate to Windows Explorer -> C:\Program Files\Adobe\Flex Builder 3\sdks\3.1.0\frameworks
  2. Open flex-config.xml and set the following:
    <include-libraries>
    <library>/libs/automation.swc</library>
    <library>/libs/automation_agent.swc</library>
    <library>/libs/FlexTechDomain.swc</library>
    <library>/libs/automation_dmv.swc</library>
    </include-libraries>NOTE: Remove the comments for include-libraries tag.

Flex Compiler Settings
  1. Open the project.
  2. Project Menu-> Properties.
  3. Select Flex Compiler.
  4. In additional compiler constants, set the following:
    -include-libraries "${flexlib}/libs/automation.swc" "${flexlib}/libs/automation_agent.swc" "${flexlib}/libs/FlexTechDomain.swc"

Browser Setting

To set security settings for Flash Player:
  1. Navigate to FlashPlayer Setting
  2. In Global Security Settings, select radio button 'Always Allow'.
  3. From the Edit Locations drop-down menu, click Add Location.
  4. Click Browse for folder and navigate to the folder where your local application is installed.
  5. Click Confirm and then close the browser.


To Enable JavaScript:
  1. In Internet Explorer 6.0 and 7.0, Choose Tools/Internet Options.
  2. Click the Security tab.
  3. Click Custom level.
  4. In the Scripting section, under Active Scripting, click Enable and click OK.

Settings in Silktest
  1. It is important to start the Open Agent before starting your flex application.
  2. Enable extensions for flex
  3. Check your include files (From Options menu-> Runtime). Flex.inc and flexDataTypes.inc files should be included in the UseFiles. I have given a sample UseFiles value of a simple project below:
    D:\Flex\MyFlex1\frame.inc,extend\explorer.inc,extend\xBrowser\xbrowser.inc,extend\Flex\Flex.inc,extend\Flex\FlexDataTypes.inc,extend\WIN32\WIN32.inc

Sunday, January 25, 2009

Mapping - Silktest Versions

Borland is using product names instead of versions for Silktest. We are using different versions of Silktest to execute our silktest suites. Sometimes it is confusing for testers, who is trying to execute silktest suites. Below I have given a mapping for product name and version.

Product Name

Version

SilkTest 20068.1
SilkTest 2006 R28.5
SilkTest 20089.0
SilkTest 2008 SP19.1
SilkTest 2008 R29.2

Saturday, January 24, 2009

New Release - SilkTest 2008 R2

Borland has released SilkTest 2008 R2 recently. It has many enhancements for Open Agent.

New Features


  1. Dynamic Object Recognition (Open Agent)

  2. Windows Presentation Foundation (WPF) Support for the SilkTest Open Agent

  3. xBrowser Support

  4. JavaScript Support

  5. Custom Class Attributes in Java SWT and xBrowser Applications

  6. Ability to Suppress Controls for Certain Classes

  7. New Methods Supported for Adobe Flex

  8. Enhancements for Silk4J Eclipse Plugin

For more information, you can have a look at SilkTest 2008 R2 documentation.

Saturday, December 13, 2008

Close the AUT after certain time

In recent days, I am trying to kill the applications if they are unable to close by the tool (SilkTest). Last month, I was solving one different issue.

We are having ten years old test suite and it was not updated for last two years due to product priorities. The total execution time for this regression suite is around 70 hours. Many times, our AUT is getting hung or the current window focus is unable to shift and suite is unable to continue after that. We endup to stop the suite at that script and re-ran the remaining scripts manually. Also we are unable to use weekends fully for the regression.

I planned to run the scripts as unattended. It is intermittent problem. Often silktest not executed in different testcases and not in one particular case always. So I thought to kill the application if the application is running more than 45 minutes. Few of silktest group members have given a idea and I have implemented it.

Silktest has 'spawn' statement to create a separate thread and it is used to execute MultiTestcase. MultiTestcae helps to run the particular code in multiple systems. Also I used PsList to get the running time of an application. I have tried few scenarios with Notepad and then finally put into our suite. This solution is worked..!!!

I have called in script level and I called 'spawn' statement in ScriptEnter and break the loop, once the execution reached ScriptExit. I have given the code below...

4Test code for ScriptEnter and ScriptExit



[+] void ScriptEnter ()
[ ] // Added for Unattended execution
[ ] gbAppKill = TRUE
[+] spawn
[ ] KillApp_UsedTime ("myAut",2700)
[ ]
[+] void ScriptExit (boolean bException)
[ ]
[ ] // Added to stop kill thread
[ ] gbAppKill = FALSE
[ ]



4Test methods to find the exeuction time and killing it


[ ] // // **** Code written for killing apps if app is running more than 45 mins.
[ ] // Methods
[ ] Boolean gbAppKill
[ ]
[+] Void KillApp_psKill (STRING sApp)
[ ] List of STRING lsOutput
[ ]
[ ] STRING sCommand = "{gcsToolsPath}\pskill {sApp} "
[ ]
[+] do
[ ]
[ ] Print ("Executing command: {sCommand}")
[ ] SYS_Execute (sCommand, lsOutput)
[ ] ResPrintList ("Command Output", lsOutput)
[ ] Print ("echo App {sApp} killed at %DATE%_%TIME% >> d:\kill.txt ")
[ ] SYS_Execute ("echo App {sApp} killed at %DATE%_%TIME% >> d:\kill.txt ")
[ ] Sleep (2)
[+] except
[ ] // Do Nothing
[ ] ExceptLog ()
[ ]
[ ]
[-] VOID KillApp_UsedTime (STRING sApp, INTEGER iKillTimeLimit optional)
[ ] List of STRING lsOutput
[ ] INTEGER iItem, iTotalValue, iTimes, iCount,iSleepTime
[ ] STRING sPartial,sItem,sPID
[ ] STRING sTime, sHour, sMin, sSec
[ ] STRING sCommand = "{gcsToolsPath}\pslist {sApp}"
[ ]
[ ] //sPID = ""
[ ]
[-] do
[ ]
[ ] iSleepTime = 50 //Seconds
[+] if (IsNull (iKillTimeLimit))
[ ] iKillTimeLimit = 6 // Seconds.
[ ]
[ ]
[ ] iCount = (iKillTimeLimit/iSleepTime) * 100 + 1+10
[ ]
[-] for iTimes=1 to iCount
[+] if (! gbAppKill)
[ ] Print ("gbAppKill is FALSE and exiting from Spawn thread..")
[ ] break
[ ]
[ ]
[ ] Sleep (iSleepTime)
[ ]
[ ]
[ ] Print ("Executing command: {sCommand}")
[ ] SYS_Execute (sCommand, lsOutput)
[ ] ResPrintList ("Command Output", lsOutput)
[ ]
[+] for iItem=2 to ListCount (lsOutput)
[ ] sItem = lsOutput[iItem]
[+] if (MatchStr ("{sApp}*",sItem))
[ ]
[ ] sSec = GetField (sItem,":",5)
[ ]
[+] if (IsNull(sSec) || (Trim(sSec) == ""))
[ ] continue
[+] else
[ ] sTime = GetField (sItem,":",3)
[ ] sMin = GetField (sItem,":",4)
[ ] sHour = SubStr (sTime,Len(sTime)-3)
[ ]
[ ] Print ("Hour: {sHour}")
[ ] Print ("Minutes: {sMin}")
[ ] Print ("Seconds: {sSec}")
[ ] iTotalValue = Val (sMin) * 60 + Val(sHour) * 3600
[ ] Print ("App {sApp} - running total time: {iTotalValue} Seconds")
[ ]
[+] if (iKillTimeLimit <= iTotalValue)
[ ] Print ("Application {sApp} is running {iTotalValue} seconds -beyond expected time {iKillTimeLimit} seconds.")
[ ] KillApp_psKill (sApp)
[ ] Print ("Going to kill Application {sApp}")
[ ] // break // It is suitable for testcase level
[+] else
[ ] Print ("Application {sApp} is running {iTotalValue} seconds - not exceeding expected time {iKillTimeLimit} seconds.")
[ ] // return sPID
[ ]
[ ]
[ ]
[+] except
[ ] // Do Nothing
[ ]
[ ]
[ ]

Sunday, September 28, 2008

Children objects has negative co-ordinates in Browserchild

Last year, one web based product has been revamped with our own reporting modules. Lot of javascripts used for this reporting. Silktest is able to identify the HtmlTable and HtmlColumn objects properly. But the co-ordinates are shown wrong. Each click action is done in different point instead of expected point. Only X-Axis position got changed. See the RECT info below.

BrowserChild (Parent) rect: {195, 175, 827, 538}
Htmltable rect: {-77, 323, 818, 574}


It is varying for different kind of reports. Testcases need to do left-mouse click and right-mouse clicks. I have set few variables for position changes. I have written the code like below. In the Runtime, XAxis changes (ixGridInc) are calculated dynamically. I have given the code below:

4Test code - To set the Table position dynamically


[-] void SetGridTablePosChanges (Window wTable)
[ ] // To set xAxis and YAxis increments (changes)
[ ] // Position changes.
[ ] Window wParent
[ ] Boolean bxGetPos = FALSE
[ ] String sWinTag, sMainFrameTag
[ ]
[ ] RECT rtTblCell = wTable.GetRect (TRUE)
[ ] Print ("table rect: {rtTblCell}")
[ ]
[-] if (ixGridInc == -1)
[ ] Print ("Grid xAxis increment is going to set.")
[ ] ixGridPos = rtTblCell.xPos
[ ] // iyGridPos = rtTblCell.yPos
[ ] bxGetPos = TRUE
[-] else if (ixGridPos != rtTblCell.xPos)
[ ] bxGetPos = TRUE
[ ] ixGridPos = rtTblCell.xPos
[ ] // iyGridPos = rtTblCell.yPos
[-] else
[ ] Print ("Already Grid xAxis increment is available.")
[ ]
[-] if (bxGetPos)
[ ]
[ ] sMainFrameTag = WindowTag (wTable)
[ ] sWinTag = GetField (sMainFrameTag,"[BrowserChild]",3)
[ ] Print ("Whole Table tag: {sMainFrameTag}")
[ ] Print ("Parent tag: {sWinTag}")
[-] if (MatchStr ("*[6]*",sWinTag) || MatchStr ("*mainFram*",sWinTag))
[ ] wParent = MyReportPage
[ ] RECT rtTblCell2 = wParent.GetRect (TRUE)
[ ] Print ("Parent rect: {rtTblCell2}")
[ ]
[-] if ((rtTblCell.xPos < (rtTblCell2.xPos + XAXIS_TABLE_DIFF)) )
[ ] ixGridInc = rtTblCell2.xPos - (rtTblCell.xPos) + XAXIS_TABLE_DIFF
[ ] Print ("X Axis changed Position: {ixGridInc}")
[-] else
[ ] Print ("Parent{wParent} is not expected one.")

Saturday, September 6, 2008

Saving Clipboard contents as Image

Scenario 1:
Earlier I had a challenging task to automate SVG charts. There are two issues. Major issue is, Silktest does not identify SVG Chart as any object (custom/HtmlImage). Second one is taking Bitmap image for the chart. SVG chart gives the flexibility by 'Copy SVG' feature. Using this we can copy the chart image. It can be saved as text or Image file.

Scenario 2:
Last month, I have posted VBA - Extract Pictures from Excel . It works fine, if this VBA code is executed as Excel Macro. But the same code does not extract the image with the right quality, after running as VB Script. I got the problem, while saving/pasting the clipboard copy. I was forced to find a way to implement a method, to save clipboard image as a image file.

Solution:
IrfanView is a windows graphic viewer and it is a freeware utility. It can be used command-line utility. It has a command-line option to save the clipboard image as image file. You can save the image in many different formats.

Syntax to Convert clipboard image as image file:
/clippaste - paste image from the clipboard.

Below I have given the way to implement in VBScript and Silktest.
Silktest code:


[ ] // To save the image
[ ] SYS_Execute ("D:\autostuff\i_view32.exe /silent /clippaste /convert=D:\my_scripts\testdata\zsvg1.bmp")


VB Script code:

'-------------------------------------------------------------------------
' Method : CreateImageFromClipBoard
' Author : Palani Selvam
' Purpose : It gets the clipboard image and convert as a image file.
' Parameters: FileName - String, contains the BMP file name
' iIndex - Integer, contains the Worksheet index
' Returns : String. The replaced file name it gives.
' Caller : - Nil
' Calls : - Nil
'-------------------------------------------------------------------------
Sub CreateImageFromClipBoard(sFileName)

Dim wshShell,ShellReturnCode, sCmdExec

Set WshShell = WScript.CreateObject("WScript.Shell")
sCmdExec = "D:\autostuff\i_view32.exe /silent /clippaste /convert="& sFileName

ShellReturnCode = WshShell.Run(sCmdExec, 1, True)

End Sub


Modified VB Script code for VBA - Extract Pictures from Excel
Note: Few function calls are from my vbscript library.

'--------------------------------------
' Method : ReadExcel
' Author : T. Palani Selvam
' Purpose : Read all the contents from Excel sheet and write into log file
' Parameters: sExcelFile - String, contains the Excel file
' : iSheetIndex - Integer, Value for Sheet Index
' Returns : - Nil
' Caller : - Nil
' Calls : - Nil
'--------------------------------------
Sub ReadExcel(sExcelFile, iSheetIndex)
Dim sExcelPath 'As Variant 'Excel file
'********** Excel object declaration **********'
' Excel Application object
Dim objExcel 'As Excel.Application
Dim objXLWorkbooks 'As Excel.Workbooks
Dim objXLWorkbook 'As Excel.Workbook

Dim WorkSheetCount 'As Variant 'Work sheets count in a excel
Dim CurrentWorkSheet 'As Excel.Worksheet ' Current worksheet
Dim objCells 'As Excel.Range
Dim objCurrentCell 'As Variant
Dim objFont 'As Variant

' Result contents
Dim sCellText 'As Variant
Dim sFontName 'As Variant
Dim sFontStyle 'As Variant
Dim iFontSize 'As Variant
Dim iCellTextColorIndex 'As Variant
Dim iCellInteriorColorIndex 'As Variant
Dim sResult 'As Variant
Dim sChartFile 'As String


' Row and Col integer variables
Dim iUsedRowsCount 'As Integer
Dim iUsedColsCount 'As Integer
Dim iTop, iLeft 'As Integer
Dim iRow 'As Integer 'Row item
Dim iCol 'As Integer 'Col item
Dim iCurRow 'As Integer
Dim iCurCol 'As Integer


If (sExcelFile = "") Then
sExcelPath = "D:\my_scripts\Basic Wks.xls"
Else
sExcelPath = sExcelFile
End If

If (iSheetIndex = "") Then
iSheetIndex = 2
End If


Call FileDeleteAndCreate (gsLogFile)

'XL file check
If (FileExists(sExcelPath) <> 0) Then
Call LogWrite (gsLogFile, "The Excel file " & Chr(34) & sExcelPath & Chr(34) & " does not exit!")
Exit sub
End If

Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open sExcelPath, False, True

On Error Resume Next

Set objXLWorkbook = objExcel.ActiveWorkbook
'objXLWorkbook.RunAutoMacros

WorkSheetCount = objXLWorkbook.Worksheets.Count

Set CurrentWorkSheet = objExcel.ActiveWorkbook.Worksheets(iSheetIndex) 'iSheetIndex worksheet

iUsedRowsCount = CurrentWorkSheet.UsedRange.Rows.Count
iUsedColsCount = CurrentWorkSheet.UsedRange.Columns.Count
iTop = CurrentWorkSheet.UsedRange.Row
iLeft = CurrentWorkSheet.UsedRange.Column

' Cells object
CurrentWorkSheet.Cells.Activate


For iRow = iTop To iUsedRowsCount-1 '(iUsedRowsCount - 1)
'Read All rows
For iCol = iLeft To iUsedColsCount '(iUsedColsCount - 1)

sResult = ""
Set objCurrentCell = CurrentWorkSheet.Cells(iRow, iCol)
sCellText = objCurrentCell.Text


If ((sCellText = Empty)) Then


sResult = "Reading Cell {" & CStr(iRow) & ", " & CStr(iCol) & "}^" &" "& "^" & " " & "^" & " " & "^" & " " & "^" & " " & "^" & " "

Call LogWrite (gsLogFile, sResult)

Else
Set objFont = objCurrentCell.Font
sFontName = objFont.Name
sFontStyle = objFont.FontStyle
iFontSize = objFont.Size
iCellTextColorIndex = objFont.Color
iCellInteriorColorIndex = objCurrentCell.Interior.ColorIndex



If (sFontName = Empty) Then
sFontName = "empty"
End If
If (sFontStyle = Empty) Then
sFontStyle = "empty"
End If
If (iFontSize = Empty) Then
iFontSize = "-99999999"
End If
If (iCellTextColorIndex = Empty) Then
iCellTextColorIndex = "99999999"
End If
If (iCellInteriorColorIndex = Empty) Then
iCellInteriorColorIndex = "99999999"
End If


sResult = "Reading Cell {" & CStr(iRow) & ", " & CStr(iCol) & "}^" & sCellText & "^" & CStr(iCellInteriorColorIndex) & "^" & sFontName & "^" & CStr(sFontStyle) & "^" & CStr(iFontSize) & "^" & CStr(iCellTextColorIndex)

Call LogWrite (gsLogFile, sResult)

End If

Set objCurrentCell = Nothing


Next

Next
'Get the Chart now
'sChartFile = Replace (sExcelFile,".xls",".png")
sChartFile = Replace (sExcelFile,".xls",".bmp")

'*****************************
' Place for Chart creation
objExcel.ScreenUpdating = False

Dim iIndex,iPictureHeight,iPictureWidth,iShapeCount
Dim aShape, aChart, aShapeChart, aChart1
Dim sPictureShape, sChartName, sCurrentSheet


'Set aWorkSheet = ActiveWorkbook.ActiveSheet

sCurrentSheet = CurrentWorkSheet.Name

For iIndex = 1 To CurrentWorkSheet.Shapes.Count

Set aShape = CurrentWorkSheet.Shapes(iIndex)
sPictureShape = aShape.Name
'Picture 1 Name, 13

If Left(aShape.Name, 7) = "Picture" Then
aShape.CopyPicture
Call CreateImageFromClipBoard (sChartFile)

''objExcel.ScreenUpdating = True
Exit For

End If
Next

if FileExists(sChartFile)=0 Then
Call LogWrite (gsLogFile, "Chart Image: " & sChartFile)
End If

' This will prevent Excel from prompting us to save the workbook.
objExcel.ActiveWorkbook.Saved = True
Set CurrentWorkSheet = Nothing

'objExcel.Worksbooks.Close
objExcel.Quit

''Set CurrentWorkSheet = Nothing
Set objExcel = Nothing

'MsgBox "Read Completed.", vbOKOnly, "Exec Over"
Exit Sub

ErrorHandler1:
'MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description
'Err.Clear ' Clear the error.
End Sub

Wednesday, September 3, 2008

Convert failed testcases as a testplan

We have few silktest automation projects. One project is used to execute by suite. Another one is ran by batch (*.bat) file, which has few sub-plans. I am not able to run the failed cases from all results at one shot. I was looking an utility, similar to 'Mark failures in Plan' in the results menu. I thought to implement a 4test script to convert failed testcases as a testplan and I did it.

4Test code - Create testplan for failed cases only

[ ] LIST OF STRING glsFailedScripts = {} [ ] [+] testcase ConvertTestPlan_SingleFile () appstate none [ ] [ ] STRING sResFile = "D:\Auto_Scripts\Results\MyStuff_MasterPlan.res " [ ] STRING sRexFile = "D:\Auto_Scripts\Results\MyStuff_MasterPlan1.rex " [ ] STRING sMyPlanFile = "D:\Auto_Scripts\Results\zSingleFailed.pln " [ ] [ ] glsFailedScripts = {} [ ] CreateFileFromTemplate(sPlanTemplate,sMyPlanFile) [ ] ResExport (sResFile,sRexFile) [ ] ProcessSingleREXFile (sRexFile,sMyPlanFile) [ ] [ ] Agent.DisplayMessage ("test","Completed.") [ ] [-] // functions [+] Boolean GetFailedTestInfo (STRING sRexLine, out LIST OF STRING lsPlanInfo) [ ] [ ] // Title [ ] //TestPlan Script TestCase TestData ErrorCount ErrorText DateTime Elapsed [ ] [ ] // Samples [ ] // "D:\Auto_Scripts\PlanFiles\MyStuff_MasterPlan.pln","D:\Auto_Scripts\Scripts\FamilyFunctions.t","FamilyFunctions_DimensionFunctions_5", [ ] // "Verify user sees a proper error message by clicking OK button.",0,"","2008-08-18 21.52.06","0:00:00" [ ] [ ] STRING sScript [ ] STRING sTestCase [ ] STRING sTestData,sFormattedData [ ] STRING sTestTime [ ] STRING sErrCount, sErrCount1 [ ] INTEGER iPos [ ] [ ] // Initialization [ ] STRING sIndentation = " " [ ] STRING sIndentation1 = "[+] " // Level1 [ ] STRING sIndentation2 = " [ ] " // Level2 [ ] [ ] STRING sSeperator = """,""" [ ] STRING sErrSeperator = ",""" //",""***" [ ] STRING sDataSeperator = """,0,""" [ ] STRING sErrSeperator1 = """" [ ] Boolean bResult = FALSE [ ] lsPlanInfo = {} [ ] [ ] sErrCount1 = GetField (sRexLine,sSeperator,4) [ ] sErrCount = GetField (sRexLine,sDataSeperator, 2) [ ] //if ((Trim(sErrCount) != "") && (Val(sErrCount) > 0)) [+] if ((Trim(sErrCount) == "") && (Trim(sErrCount1) != "") ) [ ] Print ("Considering line: {sRexLine}") [ ] bResult = TRUE [ ] sScript = GetField (sRexLine,sSeperator,2) [ ] sTestCase = GetField (sRexLine,sSeperator,3) [ ] sTestTime = GetField (sRexLine,sSeperator,6) [ ] Print ("Elapsed: {sTestTime}") [+] if (sTestTime == "") [+] sFormattedData = "" [ ] iPos = StrPos (sErrSeperator, sTestCase,TRUE) [+] if (iPos > 0) [ ] Print ("sTestCase:{sTestCase}: iPos:{iPos}") [ ] sTestCase = SubStr (sTestCase, 1,iPos - 4) [ ] Print ("Before formatting, sTestCase:{sTestCase}") [ ] //sTestCase = StrTran (sTestCase,"\","") [ ] Print ("After formatting, sTestCase:{sTestCase}") [ ] [+] else [ ] sTestData = GetField (sRexLine,sSeperator,4) [+] if (MatchStr ("*,?,""*",sTestData)) [ ] iPos = StrPos (sErrSeperator, sTestData,TRUE) [+] if (iPos > 0) [ ] Print ("TestData:{sTestData}: iPos:{iPos}") [ ] sTestData = SubStr (sTestData, 1,iPos - 4) [ ] Print ("Before formatting, TestData:{sTestData}") [ ] sFormattedData = StrTran (sTestData,"\","") [ ] Print ("After formatting, TestData:{sTestData}") [ ] [ ] Print ("TestCase: {sTestCase}") [ ] Print ("TestData: {sFormattedData}") [ ] [+] if ( (glsFailedScripts == {}) || (glsFailedScripts[ListCount(glsFailedScripts)] != sScript) ) [ ] ListAppend (glsFailedScripts,sScript) [ ] ListAppend (lsPlanInfo,"{sIndentation1}#script: {sScript}") [+] // if (Trim (sTestData) != "") [ ] // ListAppend (lsPlanInfo,"{sIndentation2}#testdata: {sFormattedData}") [ ] ListAppend (lsPlanInfo,"{sIndentation2}#testcase: {sTestCase}({sFormattedData})") [ ] [+] else [ ] Print ("Not Considering line: {sRexLine}") [ ] [ ] return bResult [+] public void TestPlanWrite(STRING sPlanFile, ANYTYPE aMsg) [ ] // To write content into log file [ ] HFILE hFile [ ] STRING sItem [ ] [ ] hFile = FileOpen (sPlanFile, FM_APPEND) [+] switch TypeOf (aMsg) [+] case STRING [ ] FileWriteLine(hFile,"{aMsg}") [+] case LIST OF STRING [+] for each sItem in aMsg [ ] FileWriteLine(hFile,"{sItem}") [+] default [ ] Print ("Non supported element for TestPlanWrite: {TypeOf (aMsg)}") [ ] FileWriteLine(hFile,"{aMsg}") [ ] [ ] FileClose (hFile) [ ] [ ] [+] VOID ProcessSingleREXFile (String sRexFile, STRING sPlanFile) [ ] // To create a testplan [ ] // Implemented for Auto Scripts [ ] // It will read the text file [ ] [+] // Parsing REX file and then writing into plan file [ ] HFILE hInFile [ ] STRING sLine [ ] LIST OF STRING lsPlan [ ] [ ] hInFile = FileOpen (sRexFile,FM_READ) [ ] [+] while (FileReadLine (hInFile, sLine)) [+] if (GetFailedTestInfo (sLine,lsPlan)) [ ] TestPlanWrite (sPlanFile,lsPlan) [ ] [ ] FileClose (hInFile)

Saturday, August 30, 2008

Converting Bitmap to GIF/JPG image

Earlier I have written a post about Automation Basics - Capturing Failures . Almost all the GUI testing tools are providing built-in functions to take the snapshot of screen. Snapshot can be taken for given screen co-ordinates or entire object.

Mostly these snapshots are stored as bitmap (*.bmp) files. Bitmap files are occupying more hard-disk space. It is difficult to maintain all the snapshots for each build in release-wise. IrfanView is a windows graphic viewer and it is a freeware utility. It has many command-line options for image related actions. You can just copy the executable file to another machine and can open or use immediately.

Syntax to Convert one image to another image format:
/convert=filename - convert input file to 'filename' and close IrfanView

Below I have given the way to implement in Silktest. This can be done for any testing tool.



[ ] //convert the image
[ ] SYS_Execute ("D:\autostuff\i_view32.exe {sBmpImage} /silent /convert={sGifImage}")

Wednesday, August 27, 2008

Restart Silktest Agent at Runtime

Last few months, I faced one issue and solved it by restarting silktest Agent.
Problem
We have a silktest suite for our Excel AddIn. It is developed by DotNet Framework. Silktest DotNet extension goes off after running 75-200 tests. Also facing this issue differently for both Excel 2003 and Excel 2007. Already I raised one post 'Application not responding" for this.



[ ] *** Error: Application is not responding
[ ] Occurred in Exists
[ ] Called from MSExcelAddIns at ExcelRecoverySystem.inc(573)
[ ] Called from ASCS_EAIBaseState at ExcelRecoverySystem.inc(684)
[ ] Called from SymmetricReport at ExcelRecoverySystem.inc(714)
[ ] Called from TestcaseEnter at ExcelRecoverySystem.inc(255)
[ ] Called from PreservingFunctions_ReplaceWithUpper at PreservingFunctions.t(238)
[ ] Error E_APP_NOT_RESPONDING) raised. Closing all applications
[ ] *** Error: Application is not responding
[ ] Occurred in Exists
[ ] Called from KillExcelApp at ExcelRecoverySystem.inc(395)
[ ] Called from CloseAllApps at ExcelRecoverySystem.inc(386)



Solution:
Later selected cases are executed fine, If I close silktest agent and re-run few cases. I am able to figure out, where/when it is not able to identify. Then I tried to restart the agent in that machine, while scripts are executing continuously.

4Test code: To restart Silktest Agent


[-] void RestartSilkAgent ()
[ ] // To Restart Silktest Agent
[ ]
[ ] STRING sAgent
[ ]
[ ]
[ ] sAgent = GetMachineName ()
[ ] Print ("Agent name: {sAgent}")
[ ] Print (Desktop.GetActive ())
[ ] Disconnect (sAgent)
[ ]
[ ] Print ("**** Restarting Silktest Agent ...")
[ ] SYS_Execute ("D:\SampleDotNet\RestartAgent.bat")
[ ] Print ("**** Restarted Silktest Agent @@@@@@")
[ ]
[ ] Connect (sAgent)
[ ] Print (Desktop.GetActive ())
[ ]
[ ]