Discussion Forum

Welcome to the Discussion Forum, we encourage you to REGISTER on our forum and participate in the debate.For more details Click here

Online Advertising

Viewers now you can promote Your Websites/Blogs/Products by using our online advertising program.Using this feature you can place your Ads in my blog and can attract the people logging over here.To place your ads, just sign in my Guest Book and leave your details over there.

Tuesday, March 31, 2009

Unix Basics for Testers

Unix Day1
Commands to Learn,
  • ls
  • cd
  • pwd

1.ls
When invoked without any arguments, lists the files in the current working directory. Files whose names start with "." are not listed, unless the -a flag is specified or the files are specified explicitly.
Without options, ls displays files in a bare format. This bare format however makes it difficult to establish the type, permissions, and size of the files. The most common options to reveal this information or change the list of files are:
-l long format, displaying Unix file type, permissions, number of hard links, owner, group, size, date, and filename
-F appends a character revealing the nature of a file, for example, * for an executable, or / for a directory. Regular files have no suffix.
-a lists all files in the given directory, including those whose names start with "." By default, these files are excluded from the list.
-R recursively lists subdirectories. The command ls -R / would therefore list all files.

2.cd
Is a command line command used to change the current working directory in the Unix and DOS operating systems. A directory is a logical section of a filesystem used to hold files. Directories may also contain other directories. The cd command can be used to change into a subdirectory, move back into the parent directory, move all the way back to the root (/ in UNIX, \ in DOS) or move to any given directory.

3.pwd
command (print working directory) is used to print the name of current working directory from a computer's command-line interface.
Example:
$ pwd
/home/foobar

Monday, March 30, 2009

Webload script to count the occurance of searched string

Scenario:
1.Open the Google search site
2.Search with keyword "testing"
3.Need to count the number of occurance of string "Cached" in the Searched result page of google
Use the script below to complete the above scenario,
function countString ( SearchForStr, msg, count )
{
i = 0;
msg = document.wlSource
do
{

offset = msg.indexOf(SearchForStr)

if (offset == -1)
{
return i;
}

l = SearchForStr.length;

offset = offset + l;
msg = msg.substring(offset,65535);
i++;

}
while (i <= 65535)
}

SearchForStr = "Cached"
count = 0
x = countString (SearchForStr, msg, count )
InfoMessage(x)

x - is the count for the number of times searched string occurs.

Friday, March 27, 2009

Working with Java in Webload

We can access the Java class through Webload, this can be done by the following steps,
1.You need to install jdk in your machine, i have installed jdk1.5.0_05 in my machine
2.After installing the jdk, we need to set the classpath
3.Inorder to set the class path, right click on the My Computer icon - choose Properties - click the Environment Variables button - set the path as Ex: C:\Program Files\Java\jdk1.5.0_05\bin
4.Create one notepad file with name as Account and extension as .java
5.Inside that file create one class as follows,
public class Account
{
private double balance; // instance variable that stores the balance

// constructor
public Account( double initialBalance )
{
if ( initialBalance > 0.0 )
balance = initialBalance;
}

public void credit( double amount )
{
balance = balance + amount;
}

public double getBalance()
{
return balance;
}

}

6.Save this file
7.Open the Command prompt, change the directory to the directory where the above mentioned java file was placed.
8.Compile the file with command javac filename.java, by compiling this one class file will be created.
9.Copy that class file and put it under the Liveconnect/classes folder of Webload installation directory.
10.Open the Webload IDE and place the following script,
/***** WLIDE - JavaScript - ID:2 *****/
InitAgenda()
{
var account1 = new Packages.Account( 50.00 );
a = account1.getBalance();
InfoMessage(a)
}
// END WLIDE
11.Run the script
12.Output will be displayed as 50

Thursday, March 26, 2009

Performance Testing : Potential Problems

Excessive Paging
Paging is where the system writes or reads a page of memory to the disk subsystem. This is done because more physical memory (RAM) is needed than was available. The disk subsystem takes the place of memory in this case.
Writing and reading from disk is exponentially slower than writing or reading from memory and therefore too much paging will have a performance impact.

Paging File Size

The paging file is the file used when the system pages information in and out of memory (process mentioned above). The file is configured through control panel…system…performance. Processor Queues 100% processor usage is not always bad, although it is true that a faster processor will improve things, it may be that a single application easily uses 100% of the faster processor as well. This becomes a problem is other processes are queued waiting for processor time

Processor Congestion

The server work queue is the queue of requests waiting for processor time. This is the list of work the system must do to answer server network requests.

Network Throughput

If the number of pages/sec increases and the number of bytes Total/sec decreases then the server is doing more work but handling less network traffic, which may be a sign that physical memory is the bottleneck. Note, network cards use nonpaged memory, so the physical memory may be taken up with network tasks, leaving less for the paged memory processes use, hence the excessive paging.

Tuesday, March 24, 2009

Performance Testing Process

1.Planning
a.Scope of Testing
b.Workload Model
2.Design
User Journeys
Identify the key user journeys that mimic the typical production load profile you expect. For example, you’ll have more browsers that buyers, you’ll have a number of people who abandon their session, etc.
For each step in the user journey identify the data that is needed as input and the data that should be checked as output.

Measurement Metrics
There are several types of metric:
Speed -
The time it takes for something to happen. e.g.Response Time
Throughput - The number of things that happen in a given period. e.g. Requests per second
Utilisation - How used something is e.g.Processor is 80% busy
3.Development a.Recording a Script b.Modifying the Script c.Timers d.Response e.Separating Scripts from Data  
4.Testing  
5.Execution
6.Analysis

Script to View and Edit the Cookies

1.Paste the following JavaScript in the address bar of browser to view the cookies:
javascript:alert(document.cookie.split(';').join('\n'))

2.Paste the following code to edit the cookie:
javascript:alert(window.c=function a(n,v,nv) {c=document.cookie;c=c.substring(c.indexOf(n) +n.length,c.length);c=c.substring(1,((c.indexOf(";")>-1) ? c.indexOf(";") : c.length));nc=unescape(c).replace (v,nv);document.cookie=n+"="+escape(nc);return unescape (document.cookie);});alert(c(prompt("cookie name:",""), prompt("replace this value:",""),prompt("with::","")));

Monday, March 23, 2009

Testcase for Cookies

01. Verify application response while Browser - Privacy is set to "Do Not Accept Cookies"
02. Verify application response while Browser - Privacy is set to "Warn Me Before Accepting Cookies"
03. Verify that application displays proper message for enabling the cookies if attempt of web server to set cookies fails.
04. Verify that Page functions if cookies are selectively rejected.
05. Verify that cookie is encrypted.
06. Verify that sensitive information like username, passwords, credit card numbers are not stored in encrypted and non encrypted cookies.
07. Verify that cookie expiry date is relevant (according to requirements).
08. Verify that domain attribute of cookie matches with domain name of the URL from where the cookie is fetched (regular match or tail match).
09. Verify that path name attribute of cookie matches path name component of URL.
10. Verify that cookie decoding does not reveal any sensitive information.
11. Verify application response while permanent cookies are modified.
12. Try altering the name of permanent cookie.
13. Try altering session id value from data field of cookie.
14. Verify that manipulating the session id does not gain access to another user’s session.
15. Verify application response while login names, session/user ids, signatures are modified.
16. Verify application response after sending two cookies under the same name.
17. Verify application response after sending cookies that are too large in size.
18. Verify that cookie size does not exceed 4 kb.
19. Verify that total number of cookies does not exceed 20 cookies per domain.
20. Verify that total number of cookies does not exceed 300.

Information about Cookies

What is cookie?
Simply put, cookie is a piece of information been passed back and forth between a web server and browser to keep the state of the web surfing session. It is a piece of opaque data. By opaque I mean that its structure is not well understood by the client. It is a piece of data that's stored, then given by the server to the client, stored by the client, and returned to the server each time the client returns. So said the father of cookie, Lou Montulli.
How do cookies work?


Here is the essence of the cookie mechanism:
  1. The browser first requests a page on the server;
  2. The server sends back a cookie with the requested page to the browser;
  3. The browser sends the cookie to the server with subsequent requests.
With the unique information stored in the cookie, the server would be able to tell the identity of the browser by examining the cookie embedded in each request.
The cookies are usually stored in small text files on the hard disk of clients machine, and will be destroyed after its designated expiration date. This type of cookie is also referred as persistent cookie, since they will remain on hard disk even the browser has been closed.
Another type of cookie will be stored in the memory by the browser, called transient cookie or session cookie. They will be destroyed once the browser is closed.
As mentioned earlier, the information stored in the cookie need not be understood by the browser. The browser only needs to return the cookie to the server in the subsequent requests to maintain the state of the surfing session. The information stored inside the cookie are some key/value pairs. These key/value pairs can be anything of the servers choice to facilitate the web application, be it username/password (putting username/password in cookie is a very dangerous thing and generally avoided) or users preferences about the website. This makes the use of cookie very flexible, which is desirable. In the mean time, this flexibility also leads to some poorly designed home-brew web authentication system.
The detailed description of cookie can be found in RFC 2965 HTTP State Management Mechanism (Kristol and Montulli), which was announced on October 7, 2000 by IETF (Internet Engineering Task Force).

Friday, March 20, 2009

Connecting Database through Webload

In this post we will see how the SQL server and MySQL can be connected thru webload.
1.Connecting to SQL server
Use the script below to connect to the SQL server,
function InitAgenda()
{
//Start generation for Building Block DB GetLine
ConnDetails = new ConnectionDetails()
ConnDetails.DBType = "SQLServer"
ConnDetails.ServerName = "wst00x" //Name of the server where the Sql server is installed
ConnDetails.DatabaseName = "xxx" // Data Source Name
GLFile = DBGetLineInitAgenda (ConnDetails, "select * from dbo.emp", "DBGetLine.tmp", "#", 100, 100)

//End generation for Building Block DB GetLine
}
/***** WLIDE - BuildingBlock:DB GetLine - ID:9 *****/
strArr = GetLine(GLFile, "#")
InfoMessage(strArr[0])
//strArr[0] -> Full record
//strArr[1] -> First field
//strArr[2] -> Second field

// END WLIDE

function TerminateAgenda()
{
//Start generation for Building Block DB GetLine

DBGetLineTerminateAgenda(GLTempFileObj)

//End generation for Building Block DB GetLine
}

Note:
You need to include the line "Integrated Security=SSPI" in the file "DBBuildingBlocks" under Include folder if the SQL Server is using windows authentication.

2.Connecting to MySQL
Use the script below to connect to the MySQL,
function InitAgenda()
{
//Start generation for Building Block MySQL DB GetLine
ConnDetails = new ConnectionDetails()
ConnDetails.ServerName = "xxx.xxx.x.xxx" //Name of the server where mysql is installed
ConnDetails.DBType = "MySQL"
ConnDetails.DatabaseName = "vj" //Database Name
ConnDetails.UserName = "root"
ConnDetails.Password = "xx"
GLFile = DBGetLineInitAgenda (ConnDetails, "select name from elango", "DBGetLine.tmp", "#", 100, 100)

//End generation for Building Block MySQL DB GetLine
}
/***** WLIDE - BuildingBlock:MySQL DB GetLine - ID:2 *****/
strArr = GetLine(GLFile, "#")
InfoMessage(strArr[0])
//strArr[0] -> Full record
//strArr[1] -> First field
//strArr[2] -> Second field
//...
// END WLIDE

function TerminateAgenda()
{
//Start generation for Building Block MySQL DB GetLine
DBGetLineTerminateAgenda(GLTempFileObj)

//End generation for Building Block MySQL DB GetLine
}

Note:
Need to install "mysql-connector-odbc-3.51.27-win32" driver in your system, if you are using the Webload8.1

Thursday, March 19, 2009

Verification in Webload

Verification could be done using the options available under Webload Console or by scripting,
1.Verification thru options in Webload Console
a.Record one test session agenda
b.Save the script
c.Debug to ensure syntax error free script
d.Open the Webload Console
e.Choose the option "Create a new template using Webload wizard"
f.Click Ok
g.Click Next
h.Select the type of Agenda to run and press Next
i.Browse and select the Agenda to run
j.Schedule the Test session
k.Uncheck the checkbox of "Run this Load template immediately" and click Finish
l.Configure your verification test selections through the Functional Testing tab of the Tools | Default or Current Project Options dialog box
m.Check the Verification checkbox under the Verfication Frame
n.Check the "Text Search" checkbox to search for a text in the agenda
o.Click the Add button and add the text we would like to verify.
Note that, Verification tests may be run either on a single Web page or on all Web pages
accessed in a test session.

2.Verification thru Scripting
Consider this scenario, we need to check whether the logged in username is displayed in the screen next to Login page i.e in Home page.
For the above scenario we need to add the following verification script under the Post url of Login screen,
a.Add this script(wlGlobals.SaveSource = true) at the first line of script
b.wlHttp.Post("http://www.xxxx.com/login.php")
msg = document.wlSource
msg1 = msg.indexOf(user)
if(msg1 == -1)
{
InfoMessage("Page doesn't Contain the String "+ user +"- Verification Failed")
}
else
{
InfoMessage("Page Contain the String "+ user +"- Verification Success")
}

Glossary:
user - its the username we need to find in the Home page.
document.wlSource - the HTML response

Tuesday, March 17, 2009

Next Topic

Obviously our next topic will be on Verification....

Parameterization

Follow the steps below to Parameterize in Webload,
a.Open the Project that you like to parameterize.
b.Drag the GlobalInputFile icon from the General Toolbox into the Agenda Tree.
c.GlobalInputFile winodw appears, click on the Create New Data File icon to create a new database file.
d.Specify the number of Rows and Column you would like in the Rows and Columns combo box.
e.Use the First row to fill in the Column names ex.(Username, Password), after specifying all the details click the OK button.
f.Save the File.
g.Click Yes to use the file we created as the file for the Global Input File.
h.Click the "Use first row as title row" checkbox to define first database row as a title row, which means that first row information will be used as parameter names(Username, Password).
i.Click the Save & Close icon at top.
j.Our database parameter names will be added in the script as,
Username = strGlobalInputFileLine[1]
Password = strGlobalInputFileLine[2]
Move on to the Editing mode to use these Username and Password parameters.
k.Consider the following script,
wlHttp.FormData["login"] = "demo"
wlHttp.FormData["password"] = "demo"
In the above script replace the values "Demo" with our parameters Username and Password,
wlHttp.FormData["login"] = Username
wlHttp.FormData["password"] = Password
l.Click on the Tools - Settings to change the iteration number, from 1 to 2 or 3.
m.Now Run this parameterized agenda.
n.You can see on the browser view,for each iterations different user logins will be chosen..

Thursday, March 12, 2009

Correlation

The purpose of Correlation is,
To simplify or optimize your code
For example, if you perform a series of dependent queries one after another, your code may become very long. To reduce the size of the code, you can nest the queries, but then you lose precision and the code becomes complex and difficult to understand. Correlating the statements enables you to link queries without nesting.

To generate dynamic data
Many applications and Web sites identify a session by the current date and time. If you try to replay a script, it will fail because the current time is different than the recorded time. Correlating the data enables you to save the dynamic data and use it throughout the scenario run.

Correlation in Webload
a.Record the script
b.Search for script failures.
c.Check under the DOM view, whether the cookie is saved as a Header or as a Hidden value
- Use any of the following script to capture it,
myCookie = wlHtml.GetHeaderValue("set-cookie")
(or)
myCookie = extractValue("Sessionid=", ";",document.wlHeaders[10].value)
(or)
myCookie = extractValue( "sessionID","/>", document.wlSource)
Use this varibale(myCookie) to replace a dynamic field.
d.Verify that the script is running correctly.

If neccessary it can be explained in detail manner..

Neccessary Things to Load Test an Application

a.Correlation
b.Parameterization
c.Verification
d.Database Connection

These are the four major things that one needs to be known before he starts load test an application.

Wednesday, March 11, 2009

Load Testing

Objective:
To determine the response times for various time critical transactions and business processes and ensure that they are within documented expectations (or Service Level Agreements - SLAs). Load tests also measures the capability of an application to function correctly under load, by measuring transaction pass/fail/error rates.

Load Testing Process:
a.Identify the Performance-critical scnarios.
b.Identify the workload profile for distributing the entire load among the key
scenarios.
c.Identify the metrics that you want to collect in order to verify them against your
Performance objectives.
d.Design tests to simulate the load.
e.Use tools to implement the load according to the designed tests, and capture the
metrics.
f.Analyze the metric data captured during the tests.
Free advertising


Lowes Coupon
How to Blog

Free Advertising