Wednesday, November 26, 2014

Your way through JMeter

Its pretty easy to get your way through JMeter. I did face some hiccups though.
So am jotting down a few pointers, possible places where you might hung up.
1) Since 2.10 Jmeter has brought in the HTTPs recorder. It needs a few configurations to be done before you start recording.
a) The Java path and the keytool.jar. The keytool.jar is present in Java7. So make sure the path is set for Jmeter. You can set it in Jmeter.bat:
rem for example
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_51
set PATH=%JAVA_HOME%\bin;%PATH%
b) Secondly, the JMeter creates a certificate ApacheJMeterTemporaryRootCA.crt. The property of the location needs to be set in the Jmeter.properties file-
proxy.cert.directory=E:/Performance/apache-jmeter-2.11/bin
It has to be in the bin of the JMeter.
c) Next, this certificate needs to be imported in the browser. For more info, visit the links:

Keep watching this space for more.

Other links:

http://stackoverflow.com/questions/19550472/jmeter-2-10-http-recorder-throws-keytool-exception
https://wiki.apache.org/jmeter/TestRecording210
http://ivetetecedor.com/how-to-use-a-csv-file-with-jmeter
http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config

Friday, October 31, 2014

HashMap Constructors

Over a couple of blogs from now, I wil try answer the questions that I have mentioned here.
This is the answer to question number 4.
When we create a new hashmap we generally use a no-arg constructor
Hashmap h = new Hashmap(); 
So, what arguments can the hashmap constructor accept?

Answer:

Hashmap has the following constructors:

a) HashMap()
     Constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75).
b) HashMap(int initialCapacity)
Constructs an empty HashMap with the specified initial capacity and the default load factor (0.75).
c) HashMap(int initialCapacity, float loadFactor)
Constructs an empty HashMap with the specified initial capacity and load factor.
d) HashMap(Map<? extends K,? extends V> m)
Constructs a new HashMap with the same mappings as the specified Map.

Where, initial capacity is the starting number of entries which can be put in a Hashmap ie the capacity of the hashmap as soon as it is created.
I assume you know that Hashmap doubles its capacity after getting filled upto a certain %. This % is nothing but load factor. The default value is 0.75. However, this can be changed. So as soon as the hashmap gets filled to that percentage, it increases its capacity using rehashing technique.