Wednesday, March 4, 2015

Simple Example Script With JMeter

Till now we learn how to setup JMeter and little bit exposure on different component.

Now we try to make a simple script using JMeter.

Step 1: Open JMeter in GUI Mode

       Run jmeter.bat or double click on ApacheJMeter.jar


Step 2:Add Thread Group

        Right click on Test Plan then Add->Threads(Users)->Thread Group


        After adding this component we can see some option.We will learn about it later but here we just left it as default.It looks like below:
 


Step 3: Add HttpRequest From Sampler

         Right click on Thread Group then Add->Sampler->HttpRequest




         After adding this component we can see there is also lots of option available.We will set here only Name or IP: "www.google.com"
Port Number:443
Protocol[http]:https


         After setting all of this option it will looks like below

Step 4: Add Listner

          We need to analyze result after run this script so we need to add listener by which we can get details of this test.We can add this listener under Thread Group or Sampler,if we add this under thread group then it shows the result of all Sampler or if we add under any of the Sampler then it will show only the result of this sampler.Here we add this under Thread Group
     
          Let add this component Right click on Thred Group Add->Listener->View Results Tree
         We choose View Result Tree here as a listener but we can select any other type of listener also.

         So after following above mentioned steps our test plan looks like that
Step 5: Save Test

         Now we save the test for future use.We can save our test using following option Click on File->Save 
then new window will open now we give a name and click save button from it. 


Step 6: Run Test 

          To Run this test we just click on the the green color button on JMeter tool.
 

Step 7: Result Analysis

            After run our test we can observe that our listener component shows the result with the combination of Red and Green color text green text means this request Pass and Red color means fail.We will try to learn later how to analyze this report and finding the cause to fail.