четвртак, 17. април 2014.

XPath Extraction in JMeter


Using the XPath Extractor in JMeter

 

In practice, we usually need to send as parameter value we retrieved in previous response. We can extract value from response using Xpath Extraction.


  1. Right click on SOAP/XML-RPC Request.  
  2. Add – Post Processors – Xpath Extractor
  3. Fill fields as it is shown on the picture.


понедељак, 14. април 2014.

How to extract value from response when response is sometimes null

During the testing, I had the next issue. I need to extract name from response. However, for some valuse of input parameters (language), response was null because there were not name in database for some languages. In that case, it was not possible to do xpath extraction from null response and test fail.

I solved it on the next way. I Sent request without any extraction. In the next step (shown bellow) I got size of response. Further, using IF controller I checked if data_length is bigger than 0 and I sent again request, this time with xpath extraction.

response = prev.getResponseDataAsString();
data_length = new Integer(response.length());
vars.put("data_length", data_length.toString());

if(data_length == 0)
{
vars.put("name", "NOT_FOUND");
}



четвртак, 6. март 2014.

How to set/get relative path in Jmeter

Sometimes, we need to read content of external file during run time. Instead to use hardcoded path, like D:\input\private.pem, you should use a relative path (using a property). 

You can define it on the command line

-Jjmeter.input.path=%CD%\input

Place your data file in folder "input" (one level under jmeter.bat file) and set path in test: ${__P(jmeter.input.path)}/private.pem

среда, 26. фебруар 2014.

How to Create a JMeter Script to Check Email


How to Create a JMeter Script to Check Email

 

User registration is a core functionality and e-mail verification is a standard part of this functionality.  The Mail Reader Sampler can read (and optionally delete) mail messages using POP3(S) or IMAP(S) protocols. 
 
If you use gmail account, firts of all you should enable IMAP. Go to your e-mail account - Settings - Forwarding and POP/IMAP - Enable IMAP.
 
Configure Mail Sampler as it is shown on the picture:
 

 
 
How to validate response?

Add Response Assertion as child of Mail Sampler and validate response.