Archive for October, 2009

Let’s start Performance Test analysis with Grinder Analyzer


To generate performance analysis I found Grinder Analyzer. Some step to start:

  1. Download and unzip Grinder Analyzer
  2. Download jython_installer-2.2.1.jar (at least version 2.2.1)
  3. Install jython: java -jar jython_installer-2.2.1.jar (I suggest the “All” installation type)
  4. Create the run.bat batch:
    set CLASSPATH=…\grinderAnalyzer.V2.b10\lib\commons-collections-3.2.jar
    …\Jython-2.2.1\jython.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. To run: run “data_agent-10.log” out_agent-10.log [# of agents]

The number of agents is an optional multiplier you can apply to the bandwidth and transactions per second graphs. Other options in …\grinderAnalyzer.V2.b10\conf\ The output generated report will be in …\grinderAnalyzer.V2.b10\grinderReport directory.

Let’s start Performance Test with Grinder in 10 steps


A very quick tutorial about how to start with Grinder 3:

  1. Download and unpack Grinder 3.2
  2. Create a mygrinder directory (wherever you want)
  3. Copy …\grinder-3.2\examples\ to mygrinder
  4. Create in mygrinder the batch console.bat: java -cp …\grinder-3.2\lib\grinder.jar net.grinder.Console
  5. Create in mygrinder the batch agent.bat: java -cp …\grinder-3.2\lib\grinder.jar net.grinder.Grinder mygrinder\
  6. Create in mygrinder the batch tcpProxy.bat java -cp …\grinder-3.2\lib\grinder.jarĀ  net.grinder.TCPProxy -console -http [-httpproxy {host} {port}] > (-httpproy parameter only if required)
  7. To record a test script set your browser proxy settings to localhost and port 8001, disable cache, execute tcpProxy.bat, while you use the browser the tcpProxy will record the requests-responses flow. If you use a proxy server you have to uncomment the script line “connectionDefaults.setProxyServer(…)”.
  8. Edit and add the line: grinder.jvm.arguments = -Dpython.cachedir=”mygrinder” (for example “C:\\tools\\mygrinder”)
  9. The line grinder.script contains the name of the script which will be executed during the performance test: put a reference to the recorded
  10. Execute console.bat, agent.bat and finally Start the Test!

The Console process is the collector of the performance data and Agents are the executor of the tests. They will send test data to the Console. By default the Console and the Agents communicate on port 6372 of the localhost machine. You can change this values of grinder.consoleHost and grinder.consolePort into

Facebook Java API


Some days ago I found the useful Facebook Java API (v3.0) and I began to use this library. I loose some hours to understand how to make a server-side login (without facebook-side authentication):

// Initialize HTTPClient
HttpClient http = new HttpClient();

//create facebook client & get auth_token
FacebookJsonRestClient client = 
     new FacebookJsonRestClient(apiKey, secretKey, timeOut);
String token = client.auth_createToken();
HttpClientParams params = new HttpClientParams();
HttpState initialState = new HttpState();
GetMethod get = new GetMethod("/login.php?api_key=" 
     + apiKey + "&v=1.0&auth_token=" + token);
int getStatus = http.executeMethod(get);
token = client.auth_createToken();

// Log into Facebook with user info to get session_id
PostMethod post = new PostMethod("/login.php?login_attempt=1");
post.addParameter("v", "1.0");
post.addParameter("auth_token", token);
post.addParameter("api_key", apiKey);
post.addParameter("return_session", "0");
post.addParameter("email", email);
post.addParameter("pass", passwd);
int postStatus = http.executeMethod(post);
System.out.println("LOGIN - Http status returned when executing POST: " 
     + postStatus);
if (postStatus != 302) {
  System.out.println("Failed.. try again!");
} else {
  String sessionId = client.auth_getSession(token);
  String secret = client.getCacheSessionSecret();

  // From here down to what you will... but use secret to create RestClient:
  // FacebookXmlRestClient restX=new FacebookXmlRestClient(apiKey,secret,sessionId);

Now I’m going to find how authorize status changes… I think that it’s mandatory to explicitly allow the application on one’s own Facebook profile… I’m investigating…

JMeter and SOAP Request


Today I’m trying to execute a test for a Web Service(SOAP) Request but it doesn’t works! To fix it, I put mail.jar and activation.jar into the LIB directory and I restarted!