Sunday, January 29, 2012

Unix Alias

Create Unix Alias to get rid of entering long paths every time.

Login into su
prompt>cd
prompt>vi .bash_profile

alias tcb2='cd /local/apps/tomcat/apache-tomcat-7.0.23-2/bin'
alias logs2='cd /local/apps/tomcat/apache-tomcat-7.0.23-2/logs'
alias tclogs2='tail -f /local/apps/tomcat/apache-tomcat-7.0.23-2/logs/catalina.out'

prompt>. .bash_profile

Next time, you do not need to enter complete path like cd /local/apps/tomcat/apache-tomcat-7.0.23-2/bin just type "tcb2" and will be in directory.

Sunday, January 8, 2012

RAP (Rich Ajax Platform) and JMeter

The purpose of this article is to share my experience with JMeter tool when recording the test cases for RAP application using URL Rewriting. This is in continuation with http://wiki.eclipse.org/RAP/LoadTesting

Env:
Tomcat 7.0.23
Java 1.6.0_06-b02

RAP(Rich Ajax Platform):
RAP 1.5M4

File to Deploy:
app.war

Set Up:
Deploy the war file in Tomcat.It creates folder app(name of the war) inside webapps folder. Inside the plugins, we need to add the org.eclipse.rap.widgetidgenerator plugin.You can do this manully. Open the buldles.info (app\WEB-INF\configuration\org.eclipse.equinox.simpleconfigurator) add the org.eclipse.rap.widgetidgenerator,1.0.0.201112291625,plugins/org.eclipse.rap.widgetidgenerator_1.0.0.201112291625.jar,4,true. Copy the org.eclipse.rap.widgetidgenerator_1.0.0.201112291625.jar in plugins folder. This plugin need to be build from the source code and does not come in the rap tool.It will be good to test if the plugin is in active state when the war is installed using the ss command of the osgi framework.

In RAP application the session id is passed from server to client in the result of the first request. Session id can be viewed in the result

Sample Portion of Response Data:

"target": "w1",
"action": "call",
"method": "init",
"properties": {
"rootId": "w1",
"entrypoint": "sapphire",
"url": "rap;jsessionid=7F829865016AD6D0634595306844108A.sapphire01"
}

It can be anywhere in the response from server but it will be having the same format.

Our purpose is to use the session id and pass it into every request to server. Create a regular expression extractor which will extract the jsession id. See the attached image. This should be attached to the first request to server or HTTP Sampler.Store it in a variable.




Now we need to pass this session id in each and every request to sever.In the second HTTP Sample add a pre bean shell processor.




Recording the test case:
Hit the first request on the browser.
Stop to make the below changes.
In Jmeter, If you notice that we have session id in the request. Now we store this in the User Defined Variable. When we further keep recording the test case, session id is replaced by ${snum}

So the actual request
/sever5/rap;jsessionid=AD08983085AB2DA747EC6B6E158E6EC8?nocache=1326086526260
will be presented as
/server5/rap;jsessionid=${snum}?nocache=1326086526260

Now when we run testcase, ${snum} will be replaced with actual session id.




Our Final Test Case will look like