views:

44

answers:

2

I recently recorded a test script in Jmeter intended for use as a load test script (using this handy set of instructions. The recording itself worked great and I even figured out how to grab and parametrize the session ids and timestamps. However, if I run the recorded steps just as they were recorded some of them don't work -- they generate "500--Server encountered and internal error ...nested exception is java.lang.NullPointerException" The failing steps are all Ajax calls that populate sidebar elements. If I copy the request GET call (Request tab, ViewResultsTree) and paste it into a browser I get the exact same error. Do I need to record my script differently, or hand-code the ajax calls? Other, earlier steps work correctly and send the expected POST data, so it isn't the application under test or forgotten proxy settings. Currently running against Firefox 3.6.10

Any suggestions on how I can debug this would be greatly appreciated.

A: 

It sounds like Jmeter isn't executing the AJAX calls, and this can be fine depending on your site. Can you simply do an HTTP request to get the pages the AJAX calls populate?

I would recommend reading this post, as it looks pretty good: http://jmetertips.blogspot.com/2009/04/ajax-testing-with-jmeter.html

I've seen that situation caused by a few things: 1. a page is required to load and be cached BEFORE making the failing request 2. The failing page needs to automatically redirected to work properly 3. The failing page has sub-requests JMeter failed to record. Devs can help with this.

Hope this helps.

BlackGaff
It turns out the Ajax request calls were relying on session information usually cached in the browser (but not in jmeter) such as the sessionid. I added that parameter to the GET request and now everything is happy. Thanks for your help!
Sabrina
A: 

The first thing I'd do is determine if the java.lang.NullPointerException is happening on the client side (JMeter) or on your server. If it is happening in JMeter, than something is terribly wrong with either your script or with JMeter.

But assuming that the error is encountered on your server, then looking into the cause of the exception may shed light on what is wrong with the request issued by JMeter. Do you have access to the code where the exception is thrown?

I would also recommend comparing the request in the recording with the request that generated the error. You may need to determine which parts of the request are session-specific and ensure those fields are populated correctly.

CMerrill