Saturday, April 30, 2011

JMeter and OutOfMemory

I have been working on Jmeter for a week now. The tool is tough and good . There is lot to learn in this tool . Although i have faced quite a few problems to keep this running , the main one that troubled me was the OUTOFMEMORY error which really frustrated me well.

My requirement was to regenerate an out of memory error which a customer of our product was getting .That was a tricky one as we were not getting it here . So started my load test on my application . My intial requirement was to run 25 threads and see whether i can get outofmemory in my application. I recorded my application, got the setups ready and started the JMeter run .

I got an Out of Memory 1o minutes after the Jmeter got started.

Things i did starts from here

1. Increased the JVM head size settings in jmeter.bat file present under jmeter\bin location. First time i increased the settings from 512m to 1024m . Saved and stated running the Jmeter .Same OutofMemory again after 1 hour of running

Line to change in the bat file "set HEAP=-Xms512m -Xmx512m " .
Xms - starting RAM the jvm will take
Xmx - maximum RAM that is allowed for the HEAP.

2. Now i changed my test machine from 2GB Ram to 4 GB Ram and tried to allocate 2048m to it .But could not succeed as i was not able to start the Jmeter with the following error.
" JVM could not be initialized."

Now so had to reduce the Heap allocation size . Had it set to 1536m and ran it .It ran successfully for 1 hr and again the same problem .

3. Now the final thing i did was changing the 32 bit machine to 64-bit machine . This seems to be running well .

Will update the post if i run into some problem again

Also few more points

Listeners used in Jmeter while load testing can take lot of memory which can lead to a OutOfMemory . View Tree Results which is useful for debugging indeed takes more memory .Aggregate Listener and Spline Listener would be better to use .Graph Listener is also better , but this also consumes more memory.

Thursday, April 28, 2011

What will/can a good bonus do to a person


Bonus and Appraisal are 2 big words which a Software Employee breathes on .And what can a good appraisal or a bonus do to a person who works well.

There are many reasons for which a person normally works. Majority of us work for a living, some work for personal happiness, some work to achieve challenges which may or may not have a good return and some work to pass time. Let us take the mindset of the majority of the people who work for a living.

The people who work for a living can be

1. People who are satisfied with normal life and the facilities they have .
2. People who work to have a better comfortable life
3. People who have big dreams

How does a bonus affect each of them. A good bonus might not have a great affect on the first type of persons. These people will be happy with or with out a good bonus. Being satisfied with there lifestyle, they wont get hurt much if a comparatively less appraisal or a bonus is given. They continue to work well all through the year

The second set of people are the majority. They always plan well .It might be office work or personal life. A good bonus will have a great impact on this people. They feel proud, happy and continue to work well to achieve and reach there comfort life levels. They will become the backbone of the company . The immediate output levels will be drastically high after the bonus. On the other side, a bad bonus will have a great impact on this people and the organization. While some continue to work well expecting for a better bonus or appraisal next time , a majority of them will be in a disappointed state. As this people are the majority, it will have a great impact on the productivity levels of the organization. As there nature is to work well , they continue work with half hearted ness and bit of dull atmosphere.

The third set of people are the great ones. A great bonus will not have much affect on them. While some of them feel happy that they have got a good bonus, a majority of them will not be happy as there aims are higher. They expect an even better pay than what they got. A bad bonus will be real bad for this set of people. Many of them will quit the organization and continue to go where they feel there work will get them achieve there big dreams. While a few people reduce there work and change their life style to a sedate state. And a few people will become 200% workaholics thinking that they need to get superb appraisals next. As these people are less in number, the organization will not have much impact what ever the bonus is.

While there people who work for Appreciation and Recognition and not for a money sake , but these 2 wont make any sense if not backed by a good pay .

So what ever a person is , a good bonus will act like a catalyst and will increase his productivity. And hope all managers , organization realize it and also hope my manager is too listening

Note : I am talking about people who work well, only because of the fact that a bad working person will always be happy with a bonus and the bonus can either be good or a bad one.

PS : Thoughts of a immature blogger

Wednesday, April 27, 2011

Selenium and self-signed SSL Certificates(https)

For quite some time , i have postponed this task of running my product in https mode and add this part in the selenium framework we have designed.

The following is my learning in this part . Though half baked (yet of find an answer for this in IE) , it might be useful for someone .

Basic of selenium RC , ie starting a new firefox profile everytime and so we will be loosing the https added certificates which we have stored by default . The best workaround is to create a new custom firefox profile , add the exception to it . And use this firefox profile to start the selenium session.

Following blog posts would be well suffice to do get it work on this workaround

http://jktechtrip.wordpress.com/2011/04/14/selenium-and-self-signed-ssl-certificates-in-firefox-java-linux/

  1. Close down any running Firefox instances.
  2. Start Firefox (the one you're going to run your tests with) with the profile manager: firefox -ProfileManager
  3. Create a new profile. You'll be prompted to choose a directory for the profile. Put it somewhere inside the project where you're writing the tests.
  4. Select the profile and run Firefox using it.
  5. Browse to the HTTPS URL (with self-signed certificate) you're going to be testing against.
  6. Accept the self-signed certificate when prompted. This creates an exception for it in the profile.
  7. Close the browser and go to the Firefox profile directory.
  8. Copy the files cert_override.txt and cert8.db files in the new firefox custom profile directory
  9. When you run your Selenium server (like in my Ant example above), pass a -firefoxProfileTemplate /path/to/profile/dir argument to it. This tells Selenium to use your partial profile (with certificate exceptions) as a basis for minting its new profile. So you get the certificate exceptions, but without any of the other clutter you would get if you used a whole profile. Ie java -jar selenium-server.jar -firefoxProfileTemplate “

You can check for the newly created firefox profile at

C:\Documents and Settings\Administrator\Application Data\Mozilla\Firefox\Profiles\hpgmv92o.testprofile (This will change based on the location u create ur profile)

Info : cert_override.txt is a text file generated in the user profile to store certificate exceptions specified by the user. This file is used by Firefox, Thunderbird, and other XUL-based applications.

Why is that trustAllSSLCertificates flag can't be used . Yup the following blogpost tells you in detail how to use that

http://mogotest.com/blog/2010/04/13/how-to-accept-self-signed-ssl-certificates-in-selenium

For a long time , i was searching for a answer to find a way how to start selenium in IE in https mode . But still not have found a way . Comment and say if you have an answer for this

Friday, April 15, 2011

How to declare browsers in Selenium

Following are the Supported browsers of Selenium

Firefox
Internet Explorer
Google Chrome
Safari
konqueror
Opera

Firefox browser declaration itself is of 7 different types , firefox , chrome , firefox2, firefox3,firefoxproxy, firefoxchrome and pifirefox . There is no much difference in using firefox, chrome , firefoxchrome ,firefox2 and firefox3 . All these have a common functionality .


firefox -FirefoxLauncher
chrome - FirefoxChromeLauncher
firefoxchrome - FirefoxChromeLauncher
firefox2 - Firefox2Launcher
firefox3 - Firefox3Launcher
firefoxproxy - FirefoxCustomProfileLauncher
pifirefox = ProxyInjectionFirefoxCustomProfileLauncher

iexploreproxy = InternetExplorerCustomProxyLauncher
iehta = HTABrowserLauncher
iexplore = InternetExplorerLauncher
piiexplore = ProxyInjectionInternetExplorerCustomProxyLauncher

opera = OperaCustomProfileLauncher

safari = SafariLauncher
safariproxy = SafariCustomProfileLauncher

konqueror = KonquerorLauncher
mock = MockBrowserLauncher
googlechrome = GoogleChromeLauncher

Iexplore,Chrome are for basic IE launchers .

Firefox , firefox2 , firefox3 ,firefoxchrome are basic for Firerox .Where firefox2 and firefox3 are specific for Firefox versions 2 and 3 respectively.

iexploreproxy , firefoxproxy and safariproxy are launchers for IE , Firefox and Safari under proxy injection mode In proxy injection mode, the selenium server is a proxy for all traffic from the browser, not just traffic going to selenium-server URLs. The incoming HTML is modified to include selenium's JavaScript, which then controls the test page from within

Monday, April 11, 2011

Difference between seleniumserver.boot() and seleniumserver.start()

when you use .boot() your user-extensions.js is invoked too, which is not the case when you use .start() .

Seleniumserver.boot internally calls Selenium.server ..So using boot and start in same code means like trying to start the server twice .

Sunday, April 10, 2011

Why Name Selenium

I was wondering all this time why Selenium Testing Tool name clashes with chemical element "Selenium" having atomic number 34 . Seems i got an answer now . Jason Huggins started selenium in 2004 in order to find an alternative to QTP and selenium mineral supplements serve as a cure for mercury poisoning ..Hence he choose the name Selenium .

Dont know whether it is good or bad , but Selenium Testing tool dominates Selenium element in google search results in the top ten (7 : 3)

Friday, April 8, 2011

Selenium IDE on Firefox 4

Just saw in Samit Badle Post that Selenium IDE v1.0.11 is getting ready for release .It will be released as soon as possible . See the post in this link for more details


Until then use this Workaround to use Selenium on Firefox4

1. Type about:config in your browser address bar
2. Agree to the warning message
3. Right click inside the browser and the choose New -> Boolean
4. Set the preference name to "extensions.checkCompatibility.4.0"
5. Set the value to False
6. Restart Firefox

Selenium IDE should work now ..With due respect the above workaround was given by Mark Collin in Selenium User Groups