JMeter Hello World – Submit Form

I used JMeter recently to generate load on a webapp for debugging a production issue. Below is a simple step-by-step details for submitting a form using JMeter

  1. Start JMeter
  2. Add Thread Group

     

  3. Define thread group properties.
    • Generate 50 current requests
    • Start with one request initially, generate two requests after two seconds from start time, generate three requests after four seconds from start time, etc.
    • Repeat for1000 iterations

     

  4. Add HTTP Request Sampler
  5. Define HTTP Request properties
    • Define the server name (localhost in screenshot below)
    • Define port number (8080)
    • Define path — relative path (/signup.do)
    • Change the method to “POST”
    • Add form fields (name and password)
  6. Add listener “Save responses to a file”
  7. Define response file location
  8. Start the test by selecting “Start” from “Run” menu

NOTE: listener “Save Responses to a file” can be disabled by right clicking on the item and selecting “Disable”. For my test, I enabled this with thread and user count 1, ran the test and verified the response. Once everything is working as expected, I disabled it and generated load by increasing the thread and loop count.

Bash Tips and Tricks #1

Below are a few aliases that I use almost everyday at work:

  • Navigating directories
    alias ..='cd ..'
    alias ...='cd ../..'
    alias ....='cd ../../../..'
    alias .....='cd ../../../../..'
    

    With these aliases in place, use “..” to navigate one-level up, “…” to navigate two-levels up, etc.

  • Navigating to project related directories
    alias cdtomcat='cd "/cygdrive/c/appservers/tomcat"'
    alias cdlogs='cd "/cygdrive/c/appservers/tomcat/logs"'
    alias cdws='cd "/cygdrive/c/satish/eclipse/workspace"'
    

    To navigate to Tomcat logs directory, type “cdlogs” at the command prompt; To navigate to project workspace, type “cdws”. You get the idea, right?

  • Converting cygwin directory in to windows format
    alias cpwd='echo $PWD | sed -e "s/\/cygdrive\/c/c:/g" | sed -e "s/\//\\\/g"'
    

    Look at the screenshot below to get an idea

  • Open windows explorer
    alias winexp='explorer.exe `cpwd`'
    

    typing “winexp” at the command prompt will open windows explorer in the current working directory — this alias uses cpwd alias set up above

  • The cd command in cygwin takes directory that is in cygwin path format. For example, to navigate to C:\Satish\Software, the command is “cd /cygdrive/c/Satish/Software”. Below is a tiny function that changes to a directory given path in windows format (e.g. c:\Satish\Software)
    function wincd(){
    	dir=`echo "$1" | sed -e 's/\\\\/\\//g'`
    	cd $dir
    }
    

    Command wincd “C:\Satish\Software” changes the working directory to /cygdrive/c/Satish/Software — note that double quotes around the path are required. See picture below:

Find Jars

Below is a tiny bash function to find jar file(s) containing a particular class:

function findjars(){
	for i in `find . -type f -iname "*.jar"`; do
		count=`jar tvf $i | grep -i $1 | wc -l`;
		if [ $count -ge 1 ]; then
			echo $i;
		fi;
	done;
}

I have added this function in .bashrc file in home directory and whenever I need to fnd a jar containing a particular class, I just type findjars classname (e.g. findjars BasicDataSource)