Showing posts from October, 2012

Running Jstestdriver with PhantomJs in Windows

Using JSTestDriver with PhantomJS Locally
PahntomJS is command line web browser JSTestDriver can be integrated to Jenkins; it can also be used for unit testing JavaScritpt Code; Only that it needs a browser running to execute the test cases.Using PahntomJs as the browser will  remove the need for a GUI browser to be launched from the script driven CI evnironment. Steps First start JStestdriver D:\Coding\lib>java -jar JsTestDriver-1.3.5.jar  --port 9876 --captureConsole --runnerMode DEBUG Starting Phantomjs browser and using it to capture the JStestdriver Download Phantomjs Download and use the javascript that is used to capture the pahntom browser d:\Program_Files\phantomjs-1.7.0-windows>phantomjs.exe phantomjs-jstd.js Wed Oct 31 2012 12:07:26 GMT+0530 (India Standard Time): Attempting (1) to load: http://localhost:9876/capture Run your JStestdiver tests…

JAX-RS with GSON and Jersy

Following from the excellent tutorial from Vogella ( ), extending with some extra details.
 Using GSON in this as my  class had  a custom class wrapped in Java collection, GSON makes it very easy to marshall JSON, same also with JAXB using Jersy; But with GSON unmarshalling to Java is also pretty easy.  Also multiple parmeter support is shown
So let us start with the interface first. Kindly read Roy Thomas Fielding's 2000 Dissertation, where he described his architecture style for the web This is a must read for , especially 'architects'. Enough Talk, Let us show some code Yes read about JAX-RS annotations, otherwise it is a simple Java Class (packaged as a servlet - WAR, see Vogellas article first. Okay here goes the interface (in rest everything is HTTP,GET,SET, POST etc package com.test.prog; import java.util.ArrayList; import java.util.List; import; import; import…