Showing posts with label Technique. Show all posts
Showing posts with label Technique. Show all posts

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 2, 2009

Selenium Overview

Selenium is a suite of tools to automate web app testing across many platforms. It is a GUI based automation tool. Initially it is built by ThoughtWorks. It supports various browsers on various platforms.

Selenium Home Page
Selenium Projects
Tool History
Platform Support

Selenium Projects
Selenium has many projects. Following projects are mostly used by testers.


  1. Selenium IDE (IDE)
    Selenium IDE can be used only in FireFox. It is an add-on for FireFox. User can record the actions and can edit and debug the tests. It can be used to identify IDs, name and XPath of objects. Only one test at a time.

  2. Selenium Core (CORE)
    Selenium Core is the original Javascript-based testing system. This technique should work with any JavaScript enabled browser. It is the engine of both, Selenium IDE and Selenium RC (driven mode), but it also can be deployed on the desired application server. It is used specifically for the acceptance testing.
    User can record the tests using Selenium IDE and can use the same tests to run in other browsers with minimal modifications. It provides support to run the tests in HTA (HTML Applications) Mode. This mode works only in IE.

  3. Selenium Remote Control (RC)
    Selenium Remote Control is a test tool that allows user to write automated web application UI tests in few programming languages against any HTTP website using any mainstream JavaScript-enabled browser. User can write the tests (More expressive programming language than the Selenese HTML table format) in Java, DotNet, Perl, Ruby and PHP. Also it supports few testing frameworks.

  4. Selenium Grid
    Selenium Grid allows easily to run multiple tests in parallel, on multiple machines, in an
    heterogeneous environment by cutting down the time required for test execution. Using this, user can run multiple instances of Selenium Remote Control in parallel.

Supported browsers
Selenium tools can run in following browsers.
  • Internet Explorer
  • FireFox
  • Opera
  • Safari
  • Seamonkey

Supported Operating Systems
Users can execute the selenium tests in following OS.
  • Windows
  • Linux
  • Solaris
  • OS X

Supported Programming languages
Below languages are supported by Selenium RC.
  • C# (DotNet)
  • Java
  • Perl
  • Ruby
  • Python
  • PHP

Lot of presentations and documents about Selenium are shared in SlideShare. You can do simple search and get many docs.

Recorded Selenese code through IDE
 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>GoogleSearch2</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">GoogleSearch2</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>q</td>
<td>silk4j tutorial</td>
</tr>
<tr>
<td>click</td>
<td>btnG</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>30000</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>q</td>
<td>Silktest extension kit</td>
</tr>
<tr>
<td>click</td>
<td>btnG</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>30000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>btnG</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>30000</td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

Java code - Selenium RC
 

package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

public class NewTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.google.com/", "*chrome");
}
public void testNew() throws Exception {
selenium.open("/");
selenium.type("q", "silk4j tutorial");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
selenium.type("q", "Silktest extension kit");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
System.out.println("New Test is completed.");
}
public void tearDown() {
browser.stop();
}
}

Wednesday, February 27, 2008

Regression Testing

Regression Testing:It retests previously tested segments to ensure that they still function properly after a change has been made to another part of the application.

Objectives:

  • It determines whether systems documentation remains current
  • It determines that system test data and test conditions remain current.
When do use regression testing:
When there is a high risk that new changes may affect unchanged areas of the application system.

Performance testing:
In this testing that the system will perform as specified at predetermined levels,wait times,static processes,dynamic processes and transaction processes.It is also tested at the client/browser and server levels.

Example:

  • In database systems the response time relates to the time to obtain a report after clicking on a specific button.It may be difficult to specify the response times for each and every form/Report,but the time that can be generally specified,for example 30 seconds is reasonable.
  • In real time or embedded systems the performance parameters are very significant.If the system demands,if the temperature exceeds 40 degrees then the valve will be opened with in 10milliseconds.Here this performance requirement is not met it may result in a catastrophe.
Hence performance testing is compulsory in process control and telecommunication software systems.

Sanity Testing:

Sanity testing is a cursory testing; it is performed whenever a cursory testing is sufficient to prove the application is functioning according to specifications. This level of testing is a subset of regression testing. It normally includes a set of core tests of basic GUI functionality to demonstrate connectivity to the database, application servers, printers, etc.

Smoke Testing:

Smoke testing is non-exhaustive software testing, ascertaining that the most crucial functions of a program work, but not bothering with finer details.