Monday, December 27, 2010

Silverlight Automation

Few of our web applications were migrated to Silverlight technology. I was looking tools for Silverlight Automation. Still many of the leading automation tools have partial support. Few tools like Silktest do not have any support for Silverlight components. Even Microsoft's codedUI test didn't have support upto October 2010. So far, I have seen WebUI Test (Telerik's product) and QALiber (open source) have better support for Silverlight components.

Interestingly all of these UI tools are using MS UIA to identify and interact with Silverlight components. UIA is the successor technology to MSAA (Microsoft Active Accessibility). It is freely available from DotNet Framework. Recent Microsoft Operating Systems (Windows 7, Windows 2008 R2) have better support for UIA.

Microsoft UI Automation provides a single, generalized interface that automation clients can use to examine or operate the user interfaces of a variety of platforms and frameworks. UI Automation enables both accessibility applications such as screen readers and quality-assurance (test) code to examine user-interface elements and simulate user interaction with them from other code.

UIA Supporting Applications

  • Silverlight Applications
  • WPF Applications
  • .NET Windows Forms applications
  • Win32 Applications

Few References:
MS UIA (UI Automation)
Microsoft Documentation - Silverlight Accessibility Overview
UI Automation of a Silverlight Custom Control

WebUI Test tool - Commercial
QALiber tool - Open Source
WHITE tool - Open Source

Wishing you and your family a very happy, healthy and prosperous new year. Have a wonderful year ahead!!!

Sunday, December 26, 2010

Database Testing

Today database becomes as engine to many of the enterprise applications. System would be affected badly if the transactions and queries produced the false conditions. Due to lack of database testing, applications may go to dead lock, data corruption and data loss conditions. These type of issues would take more time to identify and fix. Database testing includes verifying stored procedures, table indexes, exceptions, schemas and compatibility.

Different types of Database Testing

  • Structural testing
  • Functional testing
  • Boundary testing
  • Stress Testing

Few Sample Scenarios
  • Creating an user account from GUI - How would you ensure the details are stored into table correctly?
  • Executing stored procedures in different conditions like valid and invalid conditions.
  • Varying data definitions - The data type and length for a particular attribute may vary in tables though the semantic definitions are same. Example: Account number declared as Number ( 9 ) in one table and the same as varchar2( 11 ) in another table.
  • Varying data codes and values - The data representation of the same attribute may vary with and across tables. Example: Yes or No may be represented as "Y", "y", "N", "n", "1", "0".
  • Misuse of integrity constraints - When referential integrity constrains are misused, foreign key values may left "dangling". Example: Employee record deleted but dependent records not deleted.
  • Nulls - Null may be ignored when joining tables or doing searches on the column.
  • Inaccessible data - Inaccessible data due to missing or reduntant unique identifier value. Example: Uniqueness not enforced.
  • Incorrect data values - Data that is misspelled or inaccurately recorded. Example: Indra Nagar - Indra ngr.
  • Inappropriate use of views - Data is updated incorrectly through views. Example: Data is properly fetched from the database but first record or last record is not displayed

Sunday, September 12, 2010

SQL Basics

I thought to write few posts about SQL and Database testing. This post is the result of that interest.

SQL - Structured Query Language. SQL is used to interact with databases. SQL is a non-procedural language and has few standards. SQL is standardized by the American National Standards Institute (ANSI).

Rules for writing SQL statements

  • It is not case sensitive.
  • It cannot be abbreviated or split across lines.
  • It can be on one or more lines.
  • Indents are used to enhance readability.
  • Clauses are usually placed on separate lines.

SQL's Components / Sub Languages
SQL consists of few components and given below:
  • DDL - Data Definition Language - Create, Alter, Drop, Truncate - For creating, altering and dropping the database objects like tables, viewes, indexes, synonyms,sequences and contraints.
  • DML - Data Manipulation Language - Insert, Update, Delete - For reading and updating data.
  • DRL - Data Retrieval Language - SELECT - For querying the data. SELECT has many clauses.
  • TCL - Transaction Control Language - Commit, Rollback, SavePoint - These allow to group one or more DML statements into units of work or transactions. All statements in a transaction either succeed or fail as a single group.
  • DCL - Data Control Language - Grant, Revoke - For managing database security, by creating user ids and assigning or removing privileges from them.

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

Friday, July 30, 2010

Visual Studio 2010 - Testing Features

I attended a presentation Visual Studio 2010 - Testing Features. Microsoft Visual Studio 2010 has different set of licenses. Apart from development features, VS2010 can be used for project management, testcase managment, UI automation, unit testing, defect tracking and Load testing.

Microsoft targets testing tools market. As of now, it is supporting microsoft technologies. I am sure that Microsoft would have reasonable share in testing tools market within next three years. Definitely it would be tough competitor for QuickTest Professional in near future. Tool has to be enhanced for object storage and simple scripting.

Few links for your reference:
VS 2010 Testing Capabilities (Videos)
Getting started with VS 2010 Defining Your Testing Effort Using Test Plans
Creating Manual Test Cases Recording and Playing Back Manual Tests
Testing the User Interface with Automated UI Tests (CodedUI Test)
Supported Configurations and Platforms for Coded UI Tests and Action Recordings
How to: Create a Coded UI Test (Documentation):
How to: Create a Coded UI Test Tutorial
Administering Team Foundation
Administration Guide for Microsoft Visual Studio Team System 2010 Team Foundation Server
Update on Silverlight support
Partial Silverlight support

Monday, May 31, 2010

Keystroke automation through VBScript

I was looking for a solution, which should do collapse all for silktest code. It is needed before do code comparison. I tried simple VBScript and it is working fine. It is fully based on keystrokes. Below I've shared the code.

VBScript - Sending Keystrokes

' To Collapse All opened Silktest files ' Usage: wscript silktest_collapse.vbs 100 Dim WshShell, iItem, iCount If WScript.Arguments.Count > 0 Then iCount = CInt(WScript.Arguments.Item(0)) Else iCount = 10 End If Wscript.Echo "Count " & CStr(iCount) Set WshShell = Wscript.CreateObject("Wscript.Shell") 'WshShell.AppActivate "Silktest - *" WshShell.SendKeys "%{TAB}" Wscript.Sleep 5000 For iItem=1 to iCount 'To Collapse -> Alt+L+L WshShell.SendKeys "%" WshShell.SendKeys "l" Wscript.Sleep 200 WshShell.SendKeys "l" Wscript.Sleep 1000 'To Save -> Ctrl+S WshShell.SendKeys "^s" Wscript.Sleep 900 'To Close -> Alt+F+C WshShell.SendKeys "%" WshShell.SendKeys "f" Wscript.Sleep 200 WshShell.SendKeys "c" Wscript.Sleep 700 Next Wscript.Echo "Completed."

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 22, 2010

Selenium RC configuration for Java

Few months back, I was trying to run selenium script with Selenium RC Java. Initially I faced few issues to configure the classpath settings. We need to pass the proxy details, if the net connection is based on proxy. I created three batch scripts to run the server and client. You should have latest java version. For more info about Selenium RC, check out Selenium RC documentation .

Selenium Server to start with proxy
Here user can set the username and password for proxy connection. Checkout java options to do that.

REM ******************************************** REM To Run Selenium server REM Author: Palani Selvam REM ******************************************** REM Selenium server path set SeleniumServer=D:\Selenium_trial\tool\selenium-remote-control-0.9.2\selenium-server-0.9.2 REM to run the Selenium server with proxy d: cd %SeleniumServer% java -Dhttp.proxyHost=proxy.mycompany.com -Dhttp.proxyPort=8080 -jar selenium-server.jar

Selenium Server to start without proxy
It will be useful for non-proxy connection.
REM ******************************************** REM To Run Selenium server REM Author: Palani Selvam REM ******************************************** REM Selenium server path set SeleniumServer=D:\Selenium_trial\tool\selenium-remote-control-0.9.2\selenium-server-0.9.2 REM to run the Selenium server without proxy d: cd %SeleniumServer% java -jar selenium-server.jar

To run the Selenium client
Below I have given the batch script to run the GetAllStockQuotes.java. Source code is available at Indian Stock Quotes through Selenium

REM ******************************************** REM To Run Selenium client (Java). Also sets path and classpath REM Author: Palani Selvam REM ******************************************** REM to set class path and path env variables to run selenium set javaClientPath=D:\Selenium_trial\tool\selenium-remote-control-1.0.1\selenium-java-client-driver-1.0.1 Set javaClientJars=%javaClientPath%\selenium-java-client-driver.jar REM JUnit jar Set jUnitJars=D:\java\JUnit\junit46.jar REM Selenium Script (Java) dir path set Stockspath=D:\Selenium_trial REM Setting classpath set classpath=%classpath%;%javaClientJars%;%jUnitJars%;%Stockspath%\classes; d: cd %Stockspath% REM Compiling test scripts Selenium-java code javac -d classes GetAllStockQuotes.java REM Running the test scripts java junit.textui.TestRunner com.palani.tests.GetAllStockQuotes

For more details of Selenium tools configuration, you can refer 5 Minute Guide To Selenium IDE and Selenium Remote Control (Java) Test Tools

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.

Saturday, January 30, 2010

Indian Stock Quotes through Selenium

I thought to get the current indian (NSE) stock quotes by using Selenium tool. I chose Selenium RC and Java language. I have developed a java class for all file related tasks. Another java program used to get the stock values from set of given scrips.

Selenium RC required set of configuration to run the tests. We need to give the proxy details (with or without proxy) for internet connection. I'm planning to cover the configuration in upcoming posts. Below I have given the java code to get current stock values.

Current Stock quotes - Selenium RC with Java
Note: FileHandlerLib class - file related tasks.

/* To get all stockquotes * To Compile: javac GetAllStockQuotes.java -Xlint:unchecked * To Run: java junit.textui.TestRunner com.palani.tests.GetAllStockQuotes * To Run: java GetAllStockQuotes * Note: Recompile with -Xlint:unchecked for details. * javac FileHandlerLib.java -Xlint:unchecked */ package com.palani.tests; // import FileHandlerLib; import com.palani.utils.*; import com.thoughtworks.selenium.*; import junit.framework.*; import java.util.regex.Pattern; import java.io.*; import java.util.*; import java.text.DateFormat; import java.text.SimpleDateFormat; public class GetAllStockQuotes extends SeleneseTestCase { private Selenium selenium; private FileHandlerLib fhNew = new FileHandlerLib(); // @Before public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.nseindia.com/"); selenium.start(); } // @Test public void testGetAllStockQuotes() throws Exception { // Variables String sScripsFile; String sQuotesFile; String sUrlPart; String sCurrentDate; String sQuote; String sQuoteValue; String sOutput; ArrayList aData = new ArrayList(); // Initialization // sCurrentDate = "20100101" ; sCurrentDate = fhNew.getDateTime(); sQuotesFile = "D:\\Stocks\\"+sCurrentDate+"_stocks.txt"; fhNew.DeleteFile (sQuotesFile); sScripsFile = "D:\\Stocks\\StockScrips.txt"; sUrlPart="/marketinfo/companyinfo/companysearch.jsp?cons="; aData = fhNew.ReadFileToArray (sScripsFile); Object[] elements = aData.toArray(); System.out.println ("SCRIPs File: " + sScripsFile); System.out.println ("Quotes File: " + sQuotesFile); selenium.open("/content/equities/cmquote.htm"); Thread.sleep(2000); for(int iIndex=0; iIndex < elements.length ; iIndex++) { sQuote=(String)elements[iIndex]; sQuote=sQuote.trim(); sQuoteValue = "0"; System.out.println("Quote:"+elements[iIndex]+ " ,index: " + iIndex); if (!(sQuote.equals("") ) ) { if (selenium.isElementPresent("companyname")) { selenium.type("companyname", sQuote); } else { selenium.type("company", sQuote); } selenium.click("submit1"); Thread.sleep(2000); for (int second = 0;; second++) { if (second >= 150) System.out.println("timeout"); try { if (selenium.isElementPresent("//div[@id='PI4']/b")) { sQuoteValue = selenium.getText("//div[@id='PI4']/b"); System.out.println ("Quote Value: " + sQuoteValue); sOutput=sQuote.trim()+","+sQuoteValue.trim(); fhNew.FileWrite (sQuotesFile,sOutput); break; } // end if } catch (Exception e) { System.out.println("Selenium Run: " + e.getMessage() + "\n"); e.printStackTrace(); } Thread.sleep(1000); } } // End If } // end for loop } // @After public void tearDown() { selenium.stop(); } // To run Selenium Testcase using JUnit public static Test suite() { return new TestSuite(GetAllStockQuotes.class); } // To run Selenium Testcase public static void main(String args[]) { junit.textui.TestRunner.run(suite()); } }

Saturday, January 16, 2010

MSN Money Quotes

Few months back, I was searching a solution, which can get the current stock value for the given quote. I did not find proper solution to get current quote. I have done few VBA procedures in Excel, to do few more calculations after getting current stock quote.

I found Microsoft's Excel 2003/2002 Add-in: MSN Money Stock Quotes. It can be installed with Excel 2007 version also. This Add-in is very useful to the people, who wish to maintain or track their stock investments. It is used only for US stock markets. Microsoft provides better online help to this addin as MSN MoneyCentral Stock Quotes help.

However I cannot use this add-in for NSE or BSE markets. I used selenium to retrieve the quote from net.

Saturday, January 2, 2010

Strange Internet connection Problem

Recently I saw a strange problem in a laptop, which has Vista OS. I have broadband connection. Router was showing as internet connection successful. But none of the web pages were not loaded. I checked all the internet connection settings. All are correct. I checked in Safari, Internet Explorer and Firefox.

I tried with a startup mode SafeMode with Networking . To know more about these startup modes, see my post Strange behavior with Service Pack. In SafeMode with Networking, I was able to do internet browsing. Then I realized the problem might be due to setting changes or some configuration would have changed.

Solution

  1. Open a command prompt (cmd.exe) with 'Run as administrator' privilege
  2. Type Ipconfig /flushdns and press ENTER key
  3. Type Netsh int ip reset and press ENTER key
  4. Reboot (Re-start) the system
  5. Again Open a command prompt (cmd.exe) with 'Run as administrator' privilege
  6. Type Netsh winsock reset and press ENTER key
  7. Reboot (Re-start) the system again.

After doing above things, I were able to do net surfing. I hope that, Vista is removing the settings or resetting the configuration, if any of devices or drivers went wrong. Microsoft Knowledge-base article has different solution. That solution is You receive an error message in Internet Explorer: "Internet Explorer cannot display the webpage" .

Removing Malware
Elphantboycomputers has prepared wonderful article to Remove Malware. See the section Recap of what you will need to have on-hand before you start the cleanup process

1. To repair or reset Winsock in Vista/Win7
a. Start>Run>cmd [enter]
b. netsh winsock reset catalog [enter]
c. Reboot the system.
2. Sysclean or Multi-AV
3. Full-featured antivirus with updates downloaded separately for manual update
4. MBAM
5. SuperAntiSpyware
6. HijackThis
7. Possibly Process Explorer and Killbox.