Saturday, June 27, 2009

How to create a low-memory conditions for Testing your Software Application

All this was shared by one of my team-mate for performance testing where we want to test our software performance at different memory levels. Here are the exact details:

*********************
Using the boocfg command, you can restrict the amount of physical memory available to windows. So typing the following command will reduce the memory available to Windows by 768 MB. After this, on a machine with 1GB RAM only 256 MB will be available to Windows, 768 MB
will not be available:

bootcfg /raw "/burnmemory=768" /A /ID 1

After this reboot the system and Windows will reboot with only 256 MB
of memory available to it.

*********************

To remove this entry, the following steps should be performed:

1. Go to Control Panel
2. Open System dialog
3. Open Advanced Tab on System Dialog
4. In Startup and Recovery Section, click Settings button
5. the Edit button in System Startup section
6. Boot.ini opens in notepad, delete the "/burnmemory=768" entry
7. Reboot the system

*********************

Thursday, June 18, 2009

Do you want to learn SQL : Try a different Learning approach on Web

Today when I came back from Office my friend Vikas was revising his SQL concepts on SQLZOO

This site is really good when you have some basic SQL knowledge and want to learn more by practically executing queries. Actually it has some divided sections where different quesries are asked for sample tables. My description may not be that effective but I would recommend to try out this site to improve your SQL skills..

By the way I am done with SELECT part today

Saturday, June 13, 2009

Setting up your automation to produce wiretraces

One of the requirements that came up when we were setting up automation for our hybrid application was to get wiretraces for the activity to help in debugging along with the other logs that our application produced. The request would genuinely help our team and would increase the validity of our automation results. So I started the investigations.

The only knowledge I had was the name of the tool that I had to use and it was "Wireshark".

Here is some excerpt from Wikipedia about Wireshark:
"Wireshark is a free packet sniffer computer application. It is used for network troubleshooting, analysis, software and communications protocol development, and education. Originally named Ethereal, in May 2006 the project was renamed Wireshark due to trademark issues...."
For more details, go ahead and read: http://en.wikipedia.org/wiki/Wireshark

The workflow of our automation was that every hour the automation would be triggered. It would map a required network location and start running 3 test cases using HP Winrunner. It would note the time being taken to complete several actions and save the logs being produced by the application. After which, it would force reboot the system and then wait for the next run.

We had to fit in Wireshark within this workflow.

First Step
The first step in this direction was to find out the interface for which we will be monitoring the traffic. For this we used the following command:

wireshark.exe -d>>c:\interface.txt

This listed the Network interfaces along with their IDs. We identified the interface that we had to monitor and proceeded.

Second Step
The plan was to start running Wireshark through commandline interface and instruct it to save logs to a specific file. This was where we faced the first challenge. Though the Wireshark commandline has an option to start capturing logs, it does not provide a 'good-enough' option to stop capturing them. The only commandline options available in this regards are:

-c stop after n packets (def: infinite)
-a ... duration:NUM - stop after NUM seconds
filesize:NUM - stop this file after NUM KB
files:NUM - stop after NUM files

None of these suited our needs. We needed to be able to tell Wireshark to tell when to start and to stop when our automation was complete. Packet number, duration, file size or number of files was variable in our case and none of the options listed above could be reliable for us.

The method that we adopted to get across this limitation was a bit crude but worked perfectly. We setup Wireshark to capture for 3600 seconds (1 hour). After our automation had completed, we would simply kill Wireshark through commandline using the following command:

taskkill /im wireshark.exe /f

and copy the traces to a network resource.

Third Step
One 'nice-to-have' option would have been to have an embedded timestamp within the name of the wiretrace log file so that whenever we would want to analyze the log for a particular run, we would only need to look at the timestamp and know which one to look at. Since we had the automation running 24 times in a day, it would also mean that we would have a unique log file for each run.

For this, I tricked wireshark into believing that I was capturing output into a ringbuffer*. W.R.T. Wireshark, it means that after saving n number of bytes in a file, it would move to the next file and store n number of bytes in that. And so on. In this case, wireshark embeds time-stamp in the name of each ringbuffer file.

We used the following command line option to set this up:

-b duration:3600 -w c:\wiretraces\wiretrace

where -b is the duration for which 1 buffer file will be used
and -w is the common name for all buffer files in one capture.

As our automation would complete within an hour, it never went beyond one buffer file and at the end we had a buffer file with the following name:

wiretrace_00001_20090613083111

which was exactly what I wanted.

Fourth Step
The Fourth and the last challenge with this was the huge size of the trace logs. Typically, wireshark would capture all ports and protocols, which resulted in a huge amount of data that we did not need. We only needed to capture the http traffic. For this we had to set up a capture filter from the command line. Wireshark accepts the filter in 'libpcap filter syntax'. To get a suitable filter string, you can launch Wireshark and go to Capture->Capture Filters.

For HTTP, the value of the capture filter is HTTP TCP Port (80), for which the corresponding string is "tcp port http" in libpcap filter syntax. Wireshark command line option -f can be used to specify this.

The final command line option that we arrived at is:

wireshark.exe -i 2 -f "tcp port http" -k -b duration:3600 -w c:\wiretraces\wiretrace

where -i us the ID of the interface to monitor
-f is the capture filter in the libpcap filter syntax
-k instructs wireshark to start capturing immediately
-b duration:3600 intructs wireshark to capture in a ringbuffer and to move to the next file in the buffer after every 1 hour
-w is used to specify the base name of the output file

Happy Wiretracing!!!


*A circular buffer or ring buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams.

Nice presenation about Cloud Computing... Do you have doubts about the concept of Cloud Computing???

This is really a good video about Cloud Computing. Here presenter has tried to explain Cloud Computing in really easy way.. Watch it

Thursday, June 4, 2009

Hyper Terminal

what says communications theory? - transmitting info from one person to another? OR who says what to whom in what channel with what effect. It depends on the context being used. In terms of computers it could be as simple as connecting two devices.

HyperTerminal is an application you can use in order to connect your computer to other remote systems. It comes with Windows as preinstalled. Search your programs list if you could find it (hint: Communications). It allows to connect using modem, Ethernet, or serial port. I could possibly talk only about connecting a GSM phone to Hyper Terminal, coz i never connected modem.

When we connect GSM phone over a COM port say COM1, Windows automatically detects the phone and ask for COM port to use (if using IrDA then use COM4 since IrDA is mapped to serial on COM4). Then after setting the port settings like baud rate, data bits, parity and flow control etc, we are connected to the GSM phone. Use AT commands to test if it is really connected. At Basic level type AT on the Hyper Terminal screen and hit the return key. OK means successful response. When i had connected my SE w550, the first thing i did was to transfer a game (from getjar.com) to it and i did succeded.

You could also connect to a remote PC or your friends PC and try chat with him/her. Its like sending messages using net send commands.

Wednesday, June 3, 2009

HTTP Status Code : 1XX Informational

1xx Informational

This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define any 1xx status codes

100 Continue

This means that the server has received the request headers, and that the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). If the request body is large, sending it to a server when a request has already been rejected based upon inappropriate headers is inefficient. To have a server check if the request could be accepted based on the request's headers alone, a client must send Expect: 100-continue as a header in its initial request

101 Switching Protocols

This means the requestor has asked the server to switch protocols and the server is acknowledging that it will do so.

102 Processing

Tuesday, June 2, 2009

HTTP Status Codes : 2XX for Success

2xx Success

This class of status code indicates that the client's request was successfully received, understood, and accepted

200 OK

Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a POST request the response will contain an entity describing or containing the result of the action.

201 Created

The request has been fulfilled and resulted in a new resource being created.

202 Accepted

The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.

203 Non-Authoritative Information

The server successfully processed the request, but is returning information that may be from another source.

204 No Content

The server successfully processed the request, but is not returning any content.

205 Reset Content

The server successfully processed the request, but is not returning any content. Unlike a 204 response, this response requires that the requestor reset the document view.

206 Partial Content

The server is serving only part of the resource due to a range header sent by the client. This is used by tools like wget to enable resuming of interrupted downloads, or split a download into multiple simultaneous streams.

207 Multi-statuses

The message body that follows is an XML message and can contain a number of separate response codes, depending on how many sub-requests were made.