title: JavaScript unit testing with Rhino
body: <p>I hope someone out there might be able to help me out with a coding problem I am having. I am currently working with server side JavaScript code that executed within a third party Java application (mirth connect) that executes the implemented JavaScript using the Rhino JavaScript compiler. This is of of special interest since I sometimes have the need to interact with external Java packages. </p>
  
  <p>I have been looking at ways of formalising our testing process on this code.
  With this in mind I have been looking at JavaScript unit testing frameworks such as QUnit and Jasmine. Unfortunately as I understand it, these frameworks are primarily aimed at testing JavaScript code running in a browser environment, but I need to test as if the code were being executed on a server. But this could be achieved by running these frameworks with a headless browser browser.</p>
  
  <p>What I'd really like to know is if this is at all possible? I have looked at many resources that claim to be able to implement this but have been unable to do this myself. If it is indeed possible, does anyone have any links or simple walkthroughs I could follow?</p>
  
  <p>I'd be more than happy to provide examples of the JavaScript code I'd want to test, the Java class I'd want to call from the JavaScript and the unit tests once anyone can confirm I'm sure I'm not barking up the wrong tree with this as a possible solution.</p>
  
  <p>Thanks in advance!</p>