Welcome To User Friendly Software Technical concepts

This Blog contains information of various technical concepts,The concepts are precise,informative with examples.visitors can easily understand the concepts of different technical related subjects like software Testing concepts , practice questions on sql And JMeter(Open source automation tool ) for Performance testing of an web application and about selenium tool used for functional testing of an web application

Tuesday, August 17, 2010

JMeter Samplers and Assertions

Samplers and Assertions :

1) SAMPLERS:Samplers tell JMeter to send requests to a server and wait
for a response.


JMeter samplers include: 
FTP Request 
HTTP Request
Java object request 
LDAP Request 
SOAP/XML-RPC Request 
WebService (SOAP) Request





3) Server Name or IP -- Mention the server name or the IP
address of the machine which is running the application to be tested.
Port Number -- Give the port number on which the Web applications
run which is usually 80. 
Protocol -- Mention the protocol to be used here i.e. either  
HTTPS or HTTP. Method -- The GET or POST method is to
be mentioned here
Path -- You need to mention the path of the resource that will handle
this request
Ex:
Server name: localhost
Port: 8080

2) ASSERTIONS

Assertions allow you to assert facts about responses received
from the server being tested.


Using an assertion, you can essentially "test" that your application

is returning the results you expect it to.

For instance, you can assert that the response to a query will

contain some particular text. The text you specify can be a Perl-style
regular expression, and you can indicate that the response is to
contain the text, or that it should match the whole response. You can
add an assertion to any Sampler.
For example, 
you can add an assertion to a HTTP Request that checks for the text,
"". JMeter will then check that the text is present in the HTTP response.
 If JMeter cannot find the text, then it will mark this as a failed request.
To view the assertion results, 
Add an Assertion Listener to the Thread Group.
1) Click add>Assertions>Response assertion



Response assertion :

2) Click on Response assertion 
3) Click on add button at the bottom of the window . 

4) Now we can add  an assertion to a HTTP Request that checks
for the text in the “www.gmail.com”
Eg) username
JMeter will then check that the text is present in the HTTP response.


5) After making all these changes save and run.

Username matches HTTP response so “status” showing as correct.
6) Now enter the invalid pattern ex:abc .Save and run again.
 
  
“abc” mismatches HTTP response so “status” showing as incorrect.



Duration Assertion:
The Duration Assertion tests that each response was received within a
given amount of time.

Why we need Duration Assertion?
Buisiness reqirement needs reponse for a particular request or reponse
of a page should be x millisec.The X should be defined Duration in
Milliseconds.If the Any response that takes longer than the given number
of millisecond.

The test case is said to be failed.Again no need of verifying with
the requirement.

When test case fails we can see the in view listeners tree under the
request as "Assertion failure message: The operation lasted too long:"
It took x plus milliseconds, but should not have lasted
longer than x milliseconds.

Size Assertion :
In the Same way from the  Size Assertion ,we  comes to know
whether Response contains defined number of bytes .

Defined number can be
=
!=
>
<
>=
<=

No comments:

Post a Comment

You Can Post Your Comment Here