Sunday, May 31, 2009

Google Wave - A forward step in Email Communication




Google is planning to release Wave later this year. It seems Wave will replace the current Email system. And, it looks like it will compete with Twitter also.

Google has given Developer preview demo recently. You can see it below. Or You can see the demo video here



If you are not having enough time to see the video fully, you can refer this article which explains summary of the demo.

Based on this demo, we can understand below things.

-Wave will be real-time Communication/Collaboration tool/platform from Google.

-It will allow the recipient to see the message Character-by-Character while the sender types the message. He need not wait till hitting the Enter key to see the message. Anyway, if the sender wants to hide the message till hitting enter he can hide it by using an checkbox.

-It will be open source.

-Google provides Wave API for integrating/embedding it easily with any website and blogs.

-Wave allows editing of message at any place by any participant.

-It allows the Wave robots for getting information from outside sources and any other automated tasks.

-The files need not be attached. Just drag-drop will include the files with Wave.

-Google Wave will work on mobile devices such as Androids and iPhones.


A typical Wave screen will look like below screenshot.



If you see the Demo video, you will realize that it is unbelievable that everything is happening on web Browser.

As of now we can define Google Wave as below.

Google Wave=Email/Outlook on Browser + SharePoint + Twitter+Real time chat

As the Google is keeping Wave Protocol Open Source, we may expect more collaboration tools using Wave protocol. Even some of such Tools may perform better than Google's Wave.

More Articles...
Read more ...

Saturday, May 30, 2009

Will Google's Knol replace Wikipedia?


Currently Wikipedia is the most popularly used free online encyclopedia which is collaboratively created by many people.

Google is planning to release a product/tool similar to wikipedia. It is named as knol which stands for a unit of knowledge.

It seems Beta testing is going on for knol.

We know that currently Google is giving priority for Wikipedia articles when showing Search Results.

Many people are expecting that knol will replace wikipedia in future.

Google uses the word "knol" as the name of the project and as an instance of an article interchangeably.

Even when it is similar to wikipedia it is differing from wikipedia in some manners.

For example, in Wikipedia we don't know the Author of the article. But Google takes strict actions to show the Author of the knol articles. I heard that even Google is expecting Credit Card verification to verify the name of the author.

Knol is having an option to specify the category of the article.

It seems it will maintain a hierarchy of the categories in a tree structure automatically.

Knol is allowing the user to give Rating for articles.

Google allows to have multiple articles for the same topic. And, it is allowing the users to put adSense advertisements in their articles. So the people will show interest to create their own articles instead of editing articles created by other users. So the quality of articles may not be improved.

But the goolge's blog is saying that Competition of ideas is a good thing.

Google allows the authors to put Google Analytic in knol for knowing the traffic details.

You can see a Sample knol explaining QTP which is created by us.


Below youtube video will explain step by step procedure for creating knol.



Different people are having different opinion about knol. You can see the discussion about the knol here.

A visitor of http://sphinn.com has given below comment for this article.



As one of the top-ranked writers at Knol, and as a member of a Knol writing team dealing with Knol metrics and analytics, I do not agree with the "replace wikipedia" thrust of this post. Knol is destined to reside alongside Wikipedia as a high ranking search engine result for those seeking topical information. Knol has a long way to go, of course.

Wikipedia endeavors to be a trusted classic encylopedia. Knol endeavors to be a trusted pragmatic knowledge bank. Wikipedia tells us what something is; Knol tells us how to deal with it in everyday life. Wikipedia will never instruct how to fix stripped screw holes with toothpicks. Knol basks in such information.

At launch, Knol offered many well-done academic Knols on medical conditions, authored by doctors at research and teaching hospitals like UCSF and Tufts School of Dentistry. Most of these are peer-review journal worthy. This threw evaluation off. These authors wrote for their peers with visible by-lines, not for the hoi polloi. You need another Knol just to explain the medical language in most of these. However, they form a foundation of quality work.

In the 10 months since launch, Knol has accumulated 250K articles, most of them in the pragmatic space and far too many of them in the junk space. And, Google continues to push the high academic content on the landing page as if to say "we want to be another Wikipedia." Those of us who have established a reputation really think that Knol is trying to tell the junk writers to go away. If you are not an authority or expert on your topic, don't write a Knol. We think this is the real message. We hope this is the real message. Otherwise, Knol is just Web MD with an audience of peers, not patients.

My activity on Knol -- which often includes robust discussions in the comments area -- can be accessed here. In addition to ongoing metrics analysis that points to ways forward, my team has taken down one of the Internet's biggest plagiarizers (click here) and driven blatant advertising off the platform (click here). Our team is also busy helping other writers achieve high rank through quality work, and we mentor writers every day through Knol comments.

Finally, at Knol, your by-line is front and center and you control your license, even your collaborators and commenters. Knol is what you will make of it, and that's a much richer, more useful place than Wikipedia. What are you waiting for? Write a Knol!




More Articles...
Read more ...

Friday, May 29, 2009

Understanding Test Settings and Options settings in QTP


It is usual that people will be getting confused with different settings/options available in QTP IDE.

It is necessary to have clear understanding about different settings/options in QTP and the difference between them.

Remember the below two facts.

1.IDE Setting

Settings/options done for QTP IDE will be available only for the particular instance of the QTP installation. i-e If you set an option in QTP installed in Computer1 won't be available in QTP installed in Computer2.. It will be available for all the Tests in Computer1.

2.Test Setting

Settings/options done for particular Test (eg. Test1) will be available for that Test only. It won't be available for other Tests(e.g Test2). But, note that Test1 will keep the settings/options even when we copy the Test1 from Computer1 to Computer2.

Now we will see these two type of settings with examples and screenshots.

The Test setting can be done from below screen which can be accessed from Files->Settings.




In this screen if you do any change, that change will be applicable only to the particular Test. For example, if you set an Environment variable "username" for Test1, the environment variable "username" can be used within Test1 only.

We need not do anything manually to copy these settings when copying the Tests to another machine.


The QTP IDE settings/options can be changed from below screen which can be accessed from Tools->Options.



All the settings done in this screen will be applicable for all Tests. But it will be applicable within the same machine only. For example if you set Run mode as Fast in your Computer, then all the Tests will be executed in Fast mode in your Computer.

If you want to run all the Tests in Fast mode in other Computers also, then you need to transfer this setting to other computers.

Setting can be easily transferred from one machine to another machine using QTP automation object model vbs script. This vbs script can be automatically generated by pressing "Generate Script" button.

eBook for learning Software Testing and QTP Automation.

More Articles...
Read more ...

Tuesday, May 26, 2009

Will IIS on Windows XP support accessing website from remote machine?


Normally we used to access php webpages on Apache from remote machine by entering the ip address.

We have tried the samething with IIS also. But it seems IIS on XP is not supporting this option.
We tried to access ASP webpages from different machine within the LAN by entering the IP address. But it didn't work.

Even the "Ip address and Domain name restriction" option is disabled in "Directory Security" tab. Refer the below screenshot.



When I searched the internet forums, most of the people are saying that IIS on Windows XP won't support accessing website from remote machine within LAN.

It seems only IIS on Windows Server will support this feature.

But when I checked the websites tab I can see the option for entering IP address for the website. Refer the below screenshot.





I am just wondering why IIS on XP should have an option for specifying IP Address when it is not supporting this feature(i-e accessing remote websites by giving ip address).

More Articles...

Read more ...

Sunday, May 24, 2009

Deleting taskmger created by Virus


Booting of my Computer started taking long time and Browsers such as FireFox and IE also started hanging sometimes.

And, sometimes booting also interrupted.

So, I suspected virus infection in my computer. When I checked the Task manager I noticed some strange process "taskmger". Note the spelling, it is not taskmgr.

By searching this taskmger in the windows registry (start->Run->regedit), I came to know the physical path of the taskmger.exe file.

But windows explorer didn't show the taskmger.exe in the specified path. Even setting the option (Tools->Folder Options->View) as viewing hidden files didn't help to see this taskmger.exe

So used DOS command prompt to see the files dir *.exe /a showed the taskmger.exe.

del taskmger.exe /a didn't work. It showed access denied error.

When I checked the attributes of this file using attrib it was showing as SHR.

So I changed the attribute using attrib -s -h -r taskmger.exe.

It helped to change the attribute. But the attrbute was again set as SHR automatically before entering del command.

So I kept ready with del command and then again changed the attribute. Then quickly entered the pre-typed del command. Finally the taskmger.exe got deleted and as of now I am not seeing any booting problem or browser hanging issue.


More Articles...

Read more ...

Saturday, May 23, 2009

Handling iframe background color issue in IE


It seems IE (Internet Explorer) is taking White as default background color for iframe.

And, it looks like we couldn't change this default background color in IE.

I have tried by using inline style and CSS class. But it didn't help to change the background color of iframe.

Anyway we can set the background color of iframe by specifying background color for the webpage loaded within the iframe. But it will create an unwanted flickering when loading the page.

Find below the workaround to handle this issue.

First we should understand why this flickering happens.

Initially the background color of iframe will be White. Once after page loading is completed the background color will become the actual background (e.g black) specified the HTML file.

The change of color in short time period triggers flickering.

So we need to hide the iframe till the page is getting loaded to avoid this flickering.

Provide one div tag as below to hide the iframe.

<div id="iframediv" style="display:none">
<iframe frameborder="0" src="test.html" scrolling="auto"
height="100%" width="100%"></iframe>
</div>



Make this div tag visible once the page is loaded. i-e set the display as block during body onload event as below.


<body onLoad="document.getElementById('iframediv').style.display='block';">


Now, you won't see the flickering of color on loading the page.

More Articles...

Read more ...

Friday, May 22, 2009

How to keep Track of Changes in Excel?


Excel is having a feature similar to version control system. It is called as Track Changes.

We need to share the work book to make "track changes" work.

Track changes can be switched on by selecting "Track Changes while editing" check box in the below screen which can be opened from Tools->Track Changes->Highlight Changes



In the above screen we can see the options such Where, Who and When (e.g not yet reviewed, since date, since I last saved) which can be selected based on our need.

Once we set Track changes ON, excel will start showing the changes in each cell whenever any user changes the content. It will look like below screen.



And, we can accept or reject the changes by going to below screen from Tools->Track Changes->Accept or Reject Changes...



Now we understand that for using this Track changes the Excel work book should be shared. So if we want to turn off the Track changes we need to unshare the workbook.

You can refer below url which will explain how to turn off Track changes without unsharing the workbook.


http://excel.tips.net/Pages/T002511_Turning_Off_Track_Changes_without_Unsharing.html


This Track Changes feature of Excel will be more useful for doing review of Requirements and review of Test cases.

More Articles...
Read more ...

Thursday, May 21, 2009

Showing Post Title at first in the Title bar for Blogger Blog


By default, the Blogger blog (i-e blogspot.com)will show the blog title (e.g "QualityPoint Technologies") at first and then it will show the actual post title in the Title bar.

But it will be good for both Users and Search Engines to have the Post Title at first.

We can make this change by following below steps.

1. Go to Layout->Edit HTML in the blogger.
2. Take backup of the template.
3. Find the below code

<title><data:blog.pageTitle/></title>

and replace with below code.
<b:if cond='data:blog.pageType == "item"'>
<title><data:blog.pageName/> |<data:blog.title/></title>
<b:else/>
<title><data:blog.pageTitle/></title> </b:if>

Now Title for each post will look be in below format.
Posttitle|BlogTitle
Search Results also will follow the same format.


More Articles...

Read more ...

Formatting Code automatically in Blog Posts


It will be good if we format the coding (php,html,c#,javascript) sample in the blog posts.

i-e Keywords should be highlighted in one color and strings should be highlighted in another color.

Below website is providing an option to generate the formatted HTML code automatically.
http://manoli.net/csharpformat/
This online option/tool will the make blog post easy. Even we need not care about manually replacing special characters such < and > with html entities such as &lt; and &gt;.

Only thing is we need to include their CSS style sheet in our blog.

I came to know about this online formatting tool from a software testing blog.

More Articles...

Read more ...

Wednesday, May 20, 2009

WebHarvest - An Open source tool for extracting data from websites


Data from many websites can be extracted using different approaches such as using httpwebrequest/response object of C#.net, cURL of php and webbrowser control of .net.

In one of our project we have used an open source tool Webharvest for data extraction.

You can see the details of our project yahoo news scrapper in our website.
Basically, our project will collect the news from many publishers website for the specified Stock Ticker and the extracted details will be stored in a file based on published date and time.


Webharvest made the work very easy. If you are familiar with HTML, javascript and XML you can easily learn webharvest in two or three days.

It is written in Java. So we can use it in many different platforms (Windows,Linux) without any issue.


We know that each and every webpage format will be different which makes the data extraction difficult.

In webharvest, we can use xpath and xquery for easily extracting data from many websites using different formats.

Webharvest uses xml based configuration file to specify the extraction processes.
Within this xml config. file we can use javascript code also.

It seems it uses the ECMA based javascript. So the javascript working on Internet Explorer may not run with Webharvest. We may need to slightly change the script to make it work with webharvest.

We know that xpath can be used only with xml documents. So the webharvest is having cleaning processor to automatically convert any HTML page into xml page.

It provides an user-friendly GUI for developing, debugging and testing the code.


More Articles...

Read more ...

Resolving inconsistent behaviour of createElement in Javascript


In my previous post, we have seen how to dynamically create and add HTML elements such textbox using javascript.

The HTML elements can be created using two ways.
One way is, specifying all the attributes at a time while creating the element as below.

var textnode1=
document.createElement("<input id='partName' name='partName[]' type='hidden' />");


The another way is, we can add attributes one by one once after creating an empty element as below.



var textnode1=document.createElement("input");
textnode1.type="hidden";
textnode1.name="partName[]";
textnode1.id="partName";


But it seems IE (Internet Explorer) is behaving inconsistently for both these methods. (i-e First way will work sometimes and the second way will work sometimes).

So we can use try&catch to resolve this issue.

(i-e) We will first try with first way, and if it throws any error then we will go with second way.

Now the final code will look like below,



try {
var textnode1=
document.createElement("<input id='partName' name='partName[]' type='hidden' />");
}
catch(error)
{

var textnode1=document.createElement("input");
textnode1.type="hidden";
textnode1.name="partName[]";
textnode1.id="partName";
}


More Articles...

Read more ...

Tuesday, May 19, 2009

Will Prefetch (.pf) files improve Windows performance?


I came to know about windows prefetch (.pf) when searching the windows Registry for some strange files which are created by Virus.

It seems these .pf files will be available at C:\windows\prefetch folder.

I wanted to delete some of these .pf files as I suspected some of them are affected by Virus.

Initially, I hesitated to delete them as I thought deleting these files will affect the normal running of Windows.

But, after searching the Internet I came to know that these files are just used as cache to improve performance for frequently used applications.

So I deleted these .pf files, and windows is running without any issue.

Some websites say that we need to delete these .pf files to improve the performance of the system. Some says that we should keep these files to improve performance. I am not sure which is correct.

If anyone knows more about this, you can share it here thro' comments.


More Articles...

Read more ...

Monday, May 18, 2009

Tips and Tricks for doing AdHoc Testing


It is always not possible to follow proper testing such as writing Test Plan and writing Test cases.

In some cases we may need to go with adHoc Testing. because of time constraint or resource constraint.

AdHoc Testing is the part of Exploratory testing.

It is done without doing Planning and Documentation.

Adhoc testing will help to find the defects earlier. We know that earlier a defect is found the cheaper it is to fix it.

Here I am listing some tips for doing adhoc testing effectively.


  • In case of UI (User Interface) testing, test all navigation including Back button navigation.

    Go thro' all the pages of the application to find any broken links and also make sure that each and every page is having proper links to reach other pages either directly or indirectly.


  • Check whether all the images are having alt attribute


  • See the the application screen or webpage by changing/setting different screen resolution in your computer monitor


  • Test the webpage in many different web browsers such as Internet Explorer, FireFox, chrome, safari, etc.


  • Test the tab order and default focus in all the pages

  • Try to enter/save test data having special characters such as single quotes, double quotes and comma

  • You can try to enter text with HTML tags such as < and > also in the textbox

  • Try to load a authenticated webpage directly by entering url in the browser without doing login

  • Try all the possibilities of boundary values such entering lot of data in textbox and entering negative values in numeric fields.

  • Remember to navigate the application from two different machines/browsers simultaneously, especially concentrate to test concurrent database saving/updating operation.


  • If possible/necessary, test the application in different OS (Operating System)

  • If your webpage uses flash files, try to see the behavior of your webpage when it is loaded in a machine which is not having flash player.


  • Instead of testing everything from your local machine, just try to test some screens by hosting your site in some remote machine. It will help to identify unexpected issues which may occur due to network latency.


  • Test Session timeout, Cookie expiry and script execution timeout.

  • Try to refresh your confirmation screen many times to verify whether the multiple refresh saves/inserts the data multiple times.

  • Test with different Date and Time format if you webpage/application has date and time entry fields. And, think about Time zone also.

  • Make sure that Number/Currency/Name format is correctly displayed in all pages uniformly.


  • When testing edit/modify/update feature, modify values of all fields and make sure that everything is getting updated correctly.


  • Whenever testing Delete feature make sure that all the related data also getting deleted. For example, when deleting question and answers also will be deleted.

    And, make sure that necessary constraints are enforced correctly. For example, deletion of questions should not be allowed if the questions are already used in some other modules.

eBook for learning Software Testing and QTP Automation.


More Articles...
Read more ...

Showing Loading-Indication when loading HTML webpage


Completion of webpage loading will take more time if there is any time consuming process such as querying huge database needs to be completed.

If there is no indication about this time consuming process then user will be getting confused. They won't know whether any process is going on or some problem occurred.

In this case, we should show some indication to the user so that they can wait till completing the process.

In this article,I will explain about how to do this indication effectively.

1. Put an animated gif (e.g loading.gif as shown below ) to indicate loading of page in your web folder.


2.Within the body tag of html file place this code

<div id="PopUpBackGround" >
<img src="loading.gif" alt="Loading...." />
</div>


3. Then define the style for the above div tag in your CSS style sheet file as below.

#PopUpBackGround
{
z-index: 1400;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
filter: alpha(opacity=70);
opacity: 0.7;
display: block;
background: #333;
padding-top: 15%;
padding-left: 15%;

}


It will be used for graying out the webpage till the page loading is completed. By setting very high z-inex the user will be prevented from changing anything in the screen till the page loading gets completed.

4.By calling javascript function on onload event hide this div tag once after page loading is completed. It can be done by using below code.

<body onload="document.getElementById('PopUpBackGround').style.display='none';>




More Articles...

Read more ...

Sunday, May 17, 2009

Sharing and Protecting Excel Sheet.


Excel is having an useful feature for sharing the content across many users.

Consider below scenario.
You are having around 100 test cases in an Excel sheet. Your team is having 5 people.
Assume that your team has to complete execution of the all the 100 cases in very limited time. Execution of some test cases depend of test result from execution of some other cases.

In this above scenario, keeping 5 separate copies of Excel sheets is not an effective. But normally all 5 people can't update a single excel sheet simultaneously.

To resolve the above issue, we can use Share Work book option of Excel.

Clicking Tools->Share workbook will show below screen.


Check the checkbox in the above screen. Now the workbook will be shared. (ie Many people can simultaneously update the workbook).

But anyway we need to take additional care when working with shared workbook.

- Immediately save your changes to avoid any conflict with others changes, and also click save before making any changes. It will help to see recent updates of other users and also it will avoid any conflict with others changes.

- Adding new rows and any new columns should be handled carefully.

Protection feature of the Excel also will be helpful to prevent unauthorized people from changing the Excel content.

It can be done by clicking Tools->Protection->Protection Sheet.

If you want to hide the contents of an Excel sheet to an unauthorized person, then you can click Tools-Protection->Protect work book. Remember to check the "windows" checkbox in "Protect workbook" Dialog box.

More Articles...
Read more ...

Linkword - An Effective way of learning Foreign Language


Recently, I came to know about "Linkword" when we were doing project for one of our clients.

It seems Linkword will help to learn foreign languages easily and quickly.

Linkword was created by Dr Michael Gruneberg. It is a Mnemonic system which works based on similarity between the words.

Concept of Linkword is simple. When you are learning any word in foreign language you should imagine and remember a sentence which is framed from word in your language and a word which sounds similar to the word equivalent to the foreign language.

Wikipedia gives below example,

In Thai, khao means rice, imagine a cow eating rice

The background color of computer screen for this linkword course will be in black and the letter color will be in Yellow. It seems this color combination will make this learning very easy and effective.


More Articles...
Read more ...

Saturday, May 16, 2009

How to see Javascript error messages in FireFox?


Some browsers such as IE (Internet Explorer) will show the javascript error messages as an alert Dialog window.
Even if we choose not to show this error message it will be shown as yellow icon at left bottom corner of the browser window.

But FireFox won't show this javascript error messages. If you want to see this messages you have to open error console window by going thro' Tools->Error console (Ctl+Shift+J) in the browser window.

If you see lot of error messages there, then just click Clear to remove the existing error messages.


More Articles...

Read more ...

Use of Application.DoEvents method in C# Application.


When using any loop such as while loop in C# application, repainting of application window/form won't happen properly. i-e The window will be displayed in blur manner.

To avoid this issue we need to use/call Application.DoEvents() within the while loop.

It will process all the window messages currently available in the message queue.


More Articles...

Read more ...

Scheduling Script Execution and Continuously running QTP scripts.


Once after successfully completing dry run of QTP scripts there is no need to monitor the script execution.

We can schedule the script execution during night time also.
Scheduling can be done easily using window task scheduler for starting the execution of QTP script automatically at a predefined time.

For doing scheduling, we need to create .vbs file.

The Important steps required for scheduling are,

- Create a Driver script which calls all the scripts one by one.
- Complete Dry run to make sure script will continue execution without any interruption. Add Recovery scenario for handling any unexpected pop-up window or any other inconsistent behavior of the application under test.
- Create a .vbs file which will be used for starting the QTP using Automation Object Model. Remember to add the code for keeping settings/options of the QTP so that the scheduler will open QTP with same settings.

you can refer the below sample vbscript code for creating the .vbs file to be called from the scheduler.


Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True

qtApp.Open "C:\Tests\Test1", True ' Open the test in read-only mode. Include your driver script here.
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object

qtResultsOpt.ResultsLocation = "C:\Tests\Test1\Res1" ' Set the results location
qtTest.Run qtResultsOpt ' Run the test


The complete code and details can be found in the QTP help file for Automation Object Model.

The next step is we should merge the code for QTP options/settings within this code.

The options/settings code can be easily generated automatically.

Click Tools->Options from QTP IDE to open the below screen.



Click "generate" in the above screen to automatically generate the code.

- Then add a task in windows scheduler for calling the .vbs file.

You can do it by using Schedule Task wizard from settings->control panel->Scheduled Tasks->Add Scheduled Task

Click "Browse" in the below screen of the wizard to set specify your .vbs file.


- Locking the system while running the script will affect the script running.So don't lock your machine while running the script. Anyway, you can add the below code at end of your .vbs file to lock the system automatically once after completing execution of the script.


Set obj = CreateObject("WScript.Shell")
sCmnd = "%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation"
obj.Run sCmnd, 0, False
eBook for learning Software Testing and QTP Automation.

More Articles...
Read more ...

Friday, May 15, 2009

Understanding Action Iteration and Test Iteration in QTP


For beginners of QTP, it is very important to understand the difference between Action and the Test.

A QTP Test can have multiple Actions. The Actions can be arranged in nested manner (parent action-child action)also within the Test. Each Test will be stored as QuickTest Test. Actually it will be shown as Folder in windows explorer. Each Folder will have many files and many sub folders (one separate sub-folder for each Action).
Refer the below screenshot.


So it is clear that Actions are part of Test.

DataTables in QTP are used to enhance the script by doing Datadriven testing easily.

Refer the below screenshot.



The Datatable is having One Global Sheet and several local sheets based on number of Actions used in the Test.

The Global sheet is used for storing the data used for Test Iteration, and the local sheets are used for storing the data related to corresponding Action iteration.

The Test Iteration can be specified from Run tab of Test Settings (File->Settings).

The Action Iteration can be specified from "Action Call properties" window which can be opened from Right click menu (context menu) of the particular Action.

Now the next step is when we should use both Test iteration and Action Iterations.

Assume that you are testing flight booking application which comes along with QTP installation.

You need to test different test cases of booking tickets 5 times.

So, we can easily do it by entering the ticket details in 5 rows of Action sheets and setting "Run on All Row" in "Action Call properties".

We know that we need to login into the application before booking Tickets.
So now the tickets will be booked 5 times with single user login.

Assume that we need to test this with 4 different users.

So, we need to book the tickets 20 (5x4) times.

It can be handled by using both Test Iterations and Action Iterations.

The user login details can be kept in the Global Sheet and the "Run on All Row" should be set in the Test settings.

So now script will execute 20 times to make 5 bookings with 4 user logins.

eBook for learning Software Testing and QTP Automation.

More Articles...
Read more ...

About Metatag in HTML webpage


Metadata means data about data.

Meta tag/element in a HTML page gives information about that HTML page.

Meta tag should be placed inside the head section of the HTML webpage.

They are used to provide metadata such as Keywords, description and author.

Metadata will not be displayed on the webpage. But it will be used by browser and search engines.
Attributes of the Metatag are content, http-equiv, name and scheme. Content is the mandatory attribute.

Find below some sample meta data.

<meta http-equiv="Content-Type" content="text/html" />

It is used for specifying http header which should be delivered before sending actual content of the page. It notifies the browser that the content should be displayed as the html file.


Some years back search engines used "Keywords" for ranking the webpages when displaying search results.

The Keywords for the webpage can be added using below meta tag.

<meta name="keywords" content="quality, php, qtp, c#" />

But anyway, these days Search engines won't give much importance for these keywords as many webmasters are giving wrong keywords to attract more visitors to their site.

And also, meta tag can be used to automatically refresh the page at particular interval. It will useful for showing Cricket score.

Find below the sample code for automatic page refresh.
<meta http-equiv="refresh" content="600">

Even we can use this metatag for redirecting to another page after preset time.

<meta http-equiv="refresh" content="5;url=http://www.qualitypointtech.com">

The above code will redirect to qualitypointtech.com after 5 seconds.
You can see it by putting this code in Head section of an HTML page.

More Articles...

Read more ...

Thursday, May 14, 2009

QTP automation for testing .Net applications developed using Infragistic Components


Infragistics is mainly concentrating presentation layer of any software application.

They are developing many user-friendly UI (User Interface) Controls such as Treeview control.

NetAdvantage is their product that can be used in .net applications.

QTP (Quick Test Professional) won't recognize/identify the controls in any application which is developed using NetAdvantage even when QTP is equipped with .net add-in.

So, we should go for extending capability of .net add-in to make QTP recognize these NetAdvantage components.

Infragistics is providing TestAdvantage for this purpose.

We need to use this TestAdvantage in addition to .net add-in along with QTP.

We may face many difficulties when start using TestAdvantage.

To minimize the issues we need to follow below things.

1. We should follow the below installation order strictly.
QTP installation->.net add-in installation->TestAdvantage installation

2.Version of TestAdvantage should be exactly same as version of NetAdvantage. Even advanced version is not acceptable.
eBook for learning Software Testing and QTP Automation.

More Articles...
Read more ...

Wednesday, May 13, 2009

Expanding/Collapsing a list using javascript


Expand/Collapse feature should be necessary if we are having a very long list of items such as links in a webpage.

You can refer the all links page where I have used this feature.

It is done by using javascript which enables expanding/collapsing without requiring page refresh.

For doing this we need to do below steps,

1. Put the list content inside a div tag .
2. Put the + or - sign inside a span tag with anchor tag.
3. Onclick event of the anchor tag of + or - sign should call a javascript function which will toggle display property of style object of div tag.

Find below the sample code which is used in the sample


<h3>QA and QTP Automation (<a href="javascript:ExpandCollapse('divQA','spanQA')"><span id="spanQA">-</span></a>) </h3>

<div id="divQA" style="display:block;" >
list should come here
</div>





Find below javascript function which should be called on clicking + or - sign,

<script language="javascript" type="text/javascript">
function ExpandCollapse(divContent,spanSymbol) //javascript code for displaying resources into "+" and "-"
{
if(document.getElementById(divContent).style.display =="none")
{
document.getElementById(divContent).style.display ="block";
document.getElementById(spanSymbol).innerHTML = "-";
}
else
{
document.getElementById(divContent).style.display ="none";
document.getElementById(spanSymbol).innerHTML ="+";
}
}
</script>



setting none for style.display will hide the div contents and block will show the div contents.

Below part of code is used for showing the relevant section of the page on clicking the link using name of anchor tag.

<a href="#sectionQA">QA and QTP Automation</a>

<a name="sectionQA"> </a>



More Articles...

Read more ...

What is FavIcon and how to create them?


FavIcon (Favorite Icon) is a small 16x16 image which is shown in the address bar of a browser when loading a webpage.


It will be helpful to give identity for the website. The visitor will easily recognize the website by seeing the favIcon.

Refer the below screenshot which explains the FavIcon in the browser.



We can generate this favicon using some online FavIcon Generator by giving our logo or any other image as input for this favIcon Generator.

This generated should be uploaded to the root of the website and it needs to be included thro' link tag in the webpages.

If you are not having access to the root folder of the website, then you can place the .ico file in some other path and then you should specify the path using below code. This code should be included within head section of the webpage.


<link href='path of ico file' rel='shortcut icon' type='image/x-icon'/>


More Articles...

Read more ...

Tuesday, May 12, 2009

Javascript code for changing list box (select tag) value based on change in another listbox


Javascript can be effectively used for dynamically changing value in one drop down list (i-e select/option tag) when a value in another related drop-down list is changed.

Assume that a webpage is having list of names in one drop-down list and the corresponding ages in another drop-down list as below.












If you select "Name1" in the first drop-down list, corresponding value "Age1" will be selected in the second list box.

And, also if you select "Age2" in the second list then "Name2" will be selected automatically.

It is done using javascript function.


The HTML code will look like below for showing these two drop-down lists.


<form name="frmselect" id="frmselect" action="" method="post">
<table>
<tr><td>
<select name="name" id="name" onChange="javascript:return setage();">
<option value="" selected>Select Name</option>
<option value="1">Name1</option>
<option value="2">Name2</option>
</select>
</td>
<td>
<select name="age" id="age" onChange="javascript:return setname();">
<option value="" selected>Select Age</option>
<option value="a">Age1</option>
<option value="b">Age2</option>
</select>
</td></tr>
</table>
</form>



onChange event of the Name drop-down list calling javascript function setage()for changing value in Age drop-down list.

Find below the javascript code which needs to be included within Head section of HTML file.


<script language="javascript" type="text/javascript">
/*function for changing age when changing the name
*/
function setage()
{
var index_name=document.frmselect.name.selectedIndex;
document.frmselect.age.selectedIndex=index_name;

}
/*function for changing name when changing the age.
*/
function setname()
{
var index_age=document.frmselect.age.selectedIndex;
document.frmselect.name.selectedIndex=index_age;

}
</script>

The setage function gets the selectedIndex value of Name list and assign this value as selected Index of age list.

setname also behaves similarly for changing name when age is changed.

More Articles...

Read more ...

Dynamically adding text box in web page using javascript.


Some times we need to add text box dynamically in a web page.

For example, assume that our web page is having option to add email id of many friends.

It is very difficult to judge how many friends will be there for each person.
So we can provide few text boxes (e.g 3) for entering email id when loading the page and we need to provide a button for adding more text boxes if required.

Javascript can be used for adding more text boxes without doing page refresh.

Find below an example. If you click "Add Inputbox" button a new input box will be added.














The code used for doing above example is as below

The below HTML code should added within body tag of HTML page.



<form name="" action="" method="post">
<table border="0" width="100%">
<tbody id="inputtable">
<tr><td><input type="text" name="inputbox[]" /></td></tr>
</tbody>
</table>

<table border="0" width="100%">
<tr>
<td><input type="button" value="Add Inputbox" onclick="addRow();" /></td>
</tr>

</table>
</form>




onclick event of "Add Inputbox" button is calling a javascript function addRow().

This function should be added within head tag of HTML page as below.


function addRow()
{
tabBody=document.getElementById("inputtable");
row=document.createElement("TR");
cell1 = document.createElement("TD");
textnode1=document.createElement("input");
textnode1.name="inputbox[]";
textnode1.type="text";

cell1.appendChild(textnode1);
row.appendChild(cell1);
tabBody.appendChild(row);

}




On calling this addRow function, an object called "tabBody" is created using getElementById method of document object for representing the table to which we need to add new text boxes.

createElement method of document object is used for creating an object "row" for representing table row (i-e "TR" tag).

Similarly, textnode1 and cell1 objects are created using createElement method.

appendChild method is used for inserting these newly created objects in appropriate hierarchy to table.


More Articles...

Read more ...

NaN in Javascript and math constants


Javascript will return/alert the value as NaN (Not-a-Number) when a mathematical operation yields undefined result or an error.

For example, consider below sample code.
 
test1= "test1"/2;


Since dividing a string value with a numeric value is undefined, the division will return as "NaN". i-e alert(test1); will show "NaN".
We can not compare this "NaN" with any other number, so we need a special function for verifying it. isNaN() will be used for doing this test.

It will return "false" if the value is number, otherwise it will return "true" if it is not a number.

Properties of Math object can be used for getting math constants in javascript.

For example Math.PI will return value(3.14...) of PI.



More Articles...

Read more ...

Code for putting Flash File within HTML web page


Flash movie file will be stored .swf when exporting it from Flash.

We need to embed this .swf file within HTML code to display the flash movie in the webpage.

It can be done using below code.


<object width="550" height="400">
<param name="movie" value="home.swf">
<embed src="home.swf" width="550" height="400">
</embed>
</object>


Actually, Object tag and the Embed tag will do the samething. i-e Either Object tag or Embed tag is enough to display the flash movie.

But need to use both of them to make it work in all browsers.
More Articles...

Read more ...

Monday, May 11, 2009

Handling single quotes in PHP and Javascript


We need to take additional care when dealing with quotes especially single quotes in web development.

We can use single quotes as well as double quotes for specifying attributes for HTML tags.

i-e We can use as below,

<a href="http://qualitypointtech.com">QualityPoint</a>

or we can use as below also,
<a href='http://qualitypointtech.com'>QualityPoint</a>

And also, in javascript also we can use both single quotes and double quotes.

i-e Both alert("Hi") and alert('Hi') are valid.
But we need to take care when using them.

Consider below scenario.

We are having set of images stored in a folder and we are having image names in database.

Assume that our requirement is to display image based on the image name when clicking a link "Click here to Display Image".

So, the HTML/javascript code can be written as below,

$name="qualitypoint";
<a href="#" onClick="displayName('<?php echo $name; ?>');">Click here to Display Image</a>

function displayName(strname)
{

document.getElementById("namediv").innerHTML="<img
src='"+strname+"'>";

}

Assume that the $name is having single quotes as below
$name="qualitypoint's logo";

In this case, we will get syntax error from browser because of this single quotes.

So, to avoid this syntax error we can escape the single quotes using escape character as below.
$name="qualitypoint's logo";
$name=str_replace("'", "\'",$name);

It will avoid syntax error. But, still the image may not display correctly.

Because, we need to escape the single quotes within javascript function also.

We have tried to escape it as similar to previous one using below code.
strname=strname.replace("'","/'");

But, it didn't work correctly. Because single quotes were unexpectedly replaced with question mark symbol (?).

We have tried to use the HTML Entity ". But it didn't work.
Finally, the entity "&#39;" worked correctly to display the images having single quotes in their name.

We had to replace the single quotes as below in the javascript function,

strname=strname.replace("'","&#39;");

After making these changes everything worked fine.

Similarly, we may face issues for inserting data into database table if the data is having single quotes.

Normally for inserting string with single quotes, we can replace the single quotes in the string with two single quotes before inserting them into the database.

More Articles...

Read more ...

Use cURL in case allow_url_fopen is off in PHP


In the previous post I have explained about Inbound/Back links.

When I tried to implement the yahoo site explorer api using php code, I faced some issues.

The sample php code uses get_file_contents for getting contents of web page from remote site (i-e from yahoo server).

But it didn't work in our server. After doing some analysis, I came to know that allow_url_fopen is off in our server. i-e In php.ini file the value for allow_url_fopen is set as 0.


Since the server is in shared hosting , we couldn't change the php.ini file value.

As a work around, normally we can use ini_set for setting the php.ini values in the php code itself.

So I tried to add "ini_set("allow_url_fopen",1);" in the php code.
But I didn't work. I came to know that some properties of php.ini can not be overwritten in the php code.

Finally, after searching the net I found an alternate way to resolve this issue.

cURL in php is not expecting allow_url_open to be on for getting contents from remote websites.

So, I created the below function getContents using cURL as an alternate for the get_file_contents.


function getContents($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($ch, CURLOPT_HEADER,0); // DO NOT RETURN HTTP HEADERS
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE CONTENTS
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
$Rec_Data = curl_exec($ch);
return $Rec_Data;
}



Apart from above change, we need to do below things to make the yahoo api work.


  • Get appId from yahoo.

  • Enhance the sample code to show the results in multiple pages. It is required because yahoo will return maximum of 100 links only for each request.



Once after making above changes the php code will look like as below.



function backLink($input_url) {
$api_service_url = "http://search.yahooapis.com/SiteExplorerService/V1/inlinkData";
$apiid = "get yours from yahoo";
$query = $input_url;
$entire_site = "";
$omit_inlinks = "domain";
$linksperrequest = 30;
$startposition = 1;
$totallinks=0;
$request_url = $api_service_url."?appid=".$apiid."&query=".urlencode($query)."&entire_site=".$entire_site."&omit_inlinks=".$omit_inlinks."&output=php";
$currentpos = 0;
if (isset($_GET['pageno']))
{
$currentpos=$_GET['pageno']-1;

}
// while ($currentpos++ >= 0) {
if ($currentpos++ >= 0) {
$requrl = sprintf("%s&start=%s&results=%s", $request_url, ($currentpos-1)*$linksperrequest+$startposition, $linksperrequest);
if (($content = getContents($requrl)) === FALSE ) {
echo "HTTP error: $requrl";
exit;
} else {
$data = unserialize($content);
if (array_key_exists("ResultSet", $data)) {

$totallinks=sizeof($data["ResultSet"]["Result"]);

for ($i=0; $i<sizeof($data["ResultSet"]["Result"]); $i++) {
$url = $data["ResultSet"]["Result"][$i]["Url"];
$title = $data["ResultSet"]["Result"][$i]["Title"];
$domain = 'http://'.parse_url($url, PHP_URL_HOST);
$backlinks[$domain][] = array($url, $title);
}
} else {
echo "Error: Bad response from server";
}
if (sizeof($data["ResultSet"]["Result"]) < $linksperrequest) break;
}
}
define('BACKLINK_LIMIT',2);
define('BACKLINK_TRUNCATE',1);
define('BACKLINK_ALL',0);

foreach ($backlinks as $domain => $links) {
if (count($links) > BACKLINK_LIMIT) $backlinks[$domain] = array_slice($links, 0, BACKLINK_TRUNCATE);
}

sort($backlinks[$domain]);
function print_backlinks($domain, $links, $num) {
$limit = $num ? min($num,count($links)) : count($links);
for ($i=0; $i < $limit; $i++) {
list($url,$title) = $links[$i];
echo '<li><a href="'.$url.'">'.$title.'</a></li>';
}
}
echo '<ul>';

foreach ($backlinks as $domain => $links) {
if (count($links) > BACKLINK_LIMIT) {
print_backlinks($domain, $links, BACKLINK_TRUNCATE);
} else {
print_backlinks($domain, $links, BACKLINK_ALL);
}
}
if ($totallinks==$linksperrequest)
{
$currentpos++;


echo "   <a href='".$_SERVER['PHP_SELF']."?pageno=".$currentpos."&inputurl=".$input_url."'><h3><font color='maroon'>Next Page</font></h3></a>";
}
}


One of our clients we have done a flight search website, using cURL.

We are doing software development and testing projects cost effectively and with quality.

For your software development needs, you can contact us at qualitypointmail@gmail.com

More Articles...

Read more ...

Sunday, May 10, 2009

What is Inbound/Back Link and how to find them?


The Hyperlinks that link to our webpage from other websites are called as Inbound links or BackLinks.

For example, if a website "www.example.com" is putting a hyperlink as "<:a href="http://qualitypoint.blogspot.com">QualityPoint Blog</a>, then it is called as inbound link for the qualitypoint.blogspot.com. You can paste below code in your website or blog as inbound link for our blog.

<a href="http://qualitypoint.blogspot.com">Blog for Software Development and Testing</a>


If you paste this code in your website/blog, then it will be called as outbound link in your site.

Having good inbound links and outbound links will help to get good Page Rank from Search Engines. Having good page rank will enhance the possibility of showing the site in the search result page (SERP) at good position (i-e in first few pages).

Yahoo is providing Site explorer API for finding the inbound links.

Enter the URL in the below input box. It will find the inbound links using Yahoo API. Please let us know (qualitypointmail@gmail.com) if you face any difficulty.





Note: Adding 'www' to your domain will give different results. i-e Inbound links of http://www.qualitypointtech.com will be different from Inbound links of http://qualitypointtech.com.

For using this API we need to get appid from yahoo. This service will return results in many foramts such as xml and php. This example is using PHP output.

We have developed a desktop based tool also for getting the inbound links. It is using xml output.

The yahoo site explorer api will list inbound links purely based on indexing done by yahoo only.

If you want to know the inbound links based on indexing done by Google, you can see it simply by typing "link:url" in the Google search box.

For example, searching link:http://www.w3schools.com will return the inbound links of w3schools.com based on Google indexing.

And also, if you want to see all the pages within your website you can do it by simply searching "site:url" in the Google.

More Articles...
Read more ...

Saturday, May 9, 2009

Name for the performance/Load Test done after modifying Application.


We know that "regression testing" is the name of the testing done after modifying application to make sure existing functionality is not affected.

Similarly, is there any specific name for doing performance /load testing once after modifying application to make sure existing performance is not affected?

I had this question in my mind and asked this in a QA forum and got answer as "performance regression"
But I am not sure how many people are using this word.
More Articles...

Read more ...

Friday, May 8, 2009

Restricting user access based on IP Address


We can restrict access to webpages based on IP address of the user's computer.
In php, we can get ipaddress of the user' computer using REMOTE_ADDR as below.

$client_ipaddress=trim($_SERVER['REMOTE_ADDR']);

It will get the ipaddress in the ipv4 format (e.g 192.168.1.1).

Searching the database table using this format is very difficult and not efficient in terms of performance.

So, we can convert the ipaddress from this format to a numeric/integer value using below function.


$client_ipaddress_num=ip_address_to_number($client_ipaddress); //convert the
ipaddress from x.x.x.x formt to number



function ip_address_to_number($IPaddress)
{
//Converting IP address in x.x.x.x format into numeric values
if ($IPaddress =="")
{
return 0;
}
else
{
$ips = explode('.', $IPaddress);
return ($ips[3] + $ips[2] * 256 + $ips[1] * 65536 + $ips[0] * 16777216);
}

}

Once after converting the ipaddress into numeric form, we can easily verify whether the user's ip is valid (i-e exists between pre-stored range of ips.) using query similar to below one.


$query="select userid from ip_lookup_table where minip_num <=".$client_ipaddress_num." and maxip_num>=".$client_ipaddress_num;

Note that REMOTE_ADDR will return the ip address assigned by the ISP only, it won't return the internal ip of LAN connected to ISP.

More Articles...

Read more ...

Thursday, May 7, 2009

Writing Good Test Cases and Finding Bugs effectively


To develop bug free software application, writing good test cases is essential.

Here, we will see how to write good test cases.

Before seeing this, we should understand what is Good Test Case.

There won't be any solid definition for "Good Test Case".

I will consider a Test Case as "Good" only when a Tester feels happy to follow the steps in the Test Case which is written by another Tester.

Because, Test Cases will be useful only when it is used by the people.
If a test case is poorly written with excessive unwanted steps, then most of the Testers won't read it fully. Just they will read few lines and will execute it based on their own understanding which will be mostly wrong.

On the other hand, if it is having less details then it is difficult to execute it.

As of now, I am thinking below things for writing effective Test Cases.


  • Before start writing test cases, become familiar with the (AUT) Application Under Test. You will become familiar with Application by doing some adhoc/exploratory testing.


  • We should read the requirements clearly and completely. If we have any questions in the Requirements it should be clarified by appropriate person (e.g Customer or Business Team). And also, it is good practice to gather some basic domain knowledge before getting into reading requirements and writing Test Cases. And also, we can have discussion/meeting with developers/business team


  • Very Important thing is, we should use only simple language or style to write the Test cases so that any one can easily understand without any ambiguity


  • Give meaningful and easily understandable Test case ID/number.
    For example, if you are writing Test case for testing Login module you can Test Case ID as below.

    1a - for testing positive scenario such as entering valid username and valid password.
    1b - for testing negative scenario such as entering invalid username and invalid password.

    By giving Test Case number as above instead of giving sequential number, we can easily add any new case such as below one without needing to adjust/modify number of any other subsequent test cases.

    1c- for testing negative scenario such as entering valid username and invalid password.



  • And also, if we have any similar module we can give separate sequence number for specifying the module.

    For example, assume that we are having separate login modules for User and Admin with little changes.
    In this case we can give number as below,
    1.1-First case in User module.
    1.2-Second case in User module.
    2.1-First case in Admin module
    2.2-Second case in Admin module.

    If Test Description/Steps/Expected Results of 2.1 is mostly same as 1.1 then we should refer 1.1 in 2.1 instead writing the sample details again.

    By doing like this, we can avoid redundant details to have clear test case document.


  • Test Description should be short and it should uniquely represent the current test scenario without any ambiguity.


  • In any situation, don't use "if condition" in the Test steps. Always address only one scenario in one test case. It will be helpful to have unambiguous Expected Result.


  • Give some sample test data that will be useful for executing the test cases.


  • If the Test Case requires any Preconditions/prerequisite don't forget to mention them.
    The best way is, we should arrange/order the Test Cases such that the need for specifying precondition is minimum.

    For example, we need to write test case for testing user creation, user modification and user deletion.

    For doing user modification and user deletion we should have already created user as precondition.

    If we arrange the Test cases in below mentioned order, we can avoid the need for specifying any preconditions/prerequisites.
    1-Test case for creating user.
    2-Test case for verifying duplicate/existing user when adding another user with same username.
    3-Test case for modifying user.
    4-Test case for deleting user.

  • Keep Traceability Matrix to make sure that we have written test cases for covering all requirements.

  • Once after completing all positive scenarios, think about all possibilities of negative scenarios to have test cases which will effectively find most of the bugs.

    For doing this we can refer alternate flow section of use case document, and we can think about different data, boundary conditions, different navigations paths and multi user environment.


  • In the test case document, we can give link to screenshots explaining the steps and/or expected results with pictures. But anyway, it is not good practice to place the screenshots within the Test Case document itself unless it is very essential


  • Many tools are available to capture the screenshots with user action as video. We can make use of them to keep video explaining the steps and expected results clearly in case the test case requires any complex steps. We can give link to this video from the test case document.



More Articles...

Read more ...

array_slice function in php


php is having a function to extract slice of an array.
Find below the syntax of this function array_slice().

$outputarray=array_slice($inputarray,$offset,$length);

Here, the length argument is optional.

If you want to remove first two items from an array, you can use as below,
$arrNames=array_slice($arrNames,2);

We can specify negative number also as the offset. In this case, it will be taken from end of the array.

More Articles...

Read more ...

Wednesday, May 6, 2009

When to use $_REQUEST in PHP?


We know that php is having Super Global variables such as $_GET, $_POST, $_COOKIE, $_SESSION, $_SERVER, $_ENV, $_FILES and $_REQUEST.

Here $_GET is used for collecting data passed thro' querystring parameter in the url.
Form posted using get method will pass the values as querystring parameters.

Consider below url,

www.qualitypointtech.com/showprofile.php?userid=10

If we want to receive the userid, we need to use below statement in showprofile.php.

$userid=$_GET['userid'];

Consider below form,

<form name="frmprofile" action="showprofile.php" method="post">

<input name="userid" type="hidden" value="10">


</form>

In this case, if we want to receive the userid, we need to use below statement in showprofile.php.

$userid=$_POST['userid'];

Assume below scenario,

-We may get userid as querystring in url.
-We may get userid in the form using post method.


In this case, we are unsure about which one we need to use. $_GET or $_POST?

$_REQUEST will be useful in this case. In these situation, we can get userid as below,

$userid=$_REQUEST['userid'];

i-e $_REQUEST will have variables of both $_GET and $_POST.

We need to be very careful when using $_REQUEST. Because, in addition to $_GET and $_POST, it will have variables of $_COOKIE also.

We can assume $_REQUEST as an array which is clone of $_GET overwritten with $_POST which is further overwritten with $_COOKIE.

So, if $_COOKIE is set with userid in any of the page, then $_REQUEST will have this cookie value only.

i-e if $_COOKIE['userid']=11, then $_REQUEST will return 11 only even when userid is passed as 10 in the url.

And also, since $_REQUEST includes cookies it will lead to security issues.

So it is good if we design our pages/flow so as to avoid use of $_REQUEST.


More Articles...

Read more ...

Tuesday, May 5, 2009

Work around for sub query issue in older version of MySql


We had to work with previous/older version (4.x) of MySql in one of our Projects.

We faced some difficulties with sql queries. Actually the required sql query was to delete some child table records based on few parent ids.

By searching Internet, we came to know that older version of MySql won't support subquery.

And also, we came to know that everything that can be done with subquery can also be done with Joins (inner join and/or outer joins).

But in our case, Joins didn't help to resolve the issue. We got syntax error in our set up, whereas the same query was working fine in some other environments.

So finally we came up this below solution.
-just we joined/concatenated all the required parent ids with comma.
-Used this concatenated string in the IN clause of another query.

Find below the sample


$sql="select id from parent_table WHERE `ref_id` = $inputid";

$parent_id="NULL";
$result=mysql_query($sql);
while($resultrow=mysql_fetch_assoc($result))
{
$parent_id.=$resultrow['id'] .",";
}
$parent_id=substr($parent_id,0,strlen($parent_id)-1); //for removing last comma

mysql_query("DELETE FROM `child_table` WHERE `parent_id` in(".$parent_id.")");




In the above code we had to use "$parent_id="NULL";", as we faced issue if the query didn't return any value. (i-e $parent_id is empty)


More Articles...

Read more ...

All Links - QA, QTP, Web Development, C#.Net , Excel and Others




Buy eBook for learning Software Testing and QTP Automation




You can bookmark this blog for further reading, or you can subscribe to our blog feed.
Read more ...

Search This Blog