YaK:: WebLog #535 Topic : 2006-02-13 22.36.51 matt : on the road to NUnitAsp supporting JavaScript [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   
  [Back to weblog: pretention]  
[mega_changes]
[photos]

on the road to NUnitAsp supporting JavaScript

NUnitAsp doesn't support JavaScript or AJAX-like things, but HttpUnit does. I gotta fix that..


HttpUnit (http://httpunit.sourceforge.net/) uses the mozilla Rhino library (http://www.mozilla.org/rhino/) for its JavaScript emulation, as discussed in a previous posting (http://wiki.yak.net/647). NUnitAsp (http://nunitasp.sourceforge.net/) is a nice NUnit extension for doing the same thing under .NET. Which NUnitAsp doesn't appear to be ASP.NET specific, probably you won't use it if you aren't using .NET somewhere in your project. Regardless, NUnitAsp doesn't interpet JavaScript, which means that things like AJAX.NET (http://www.borgworx.net/) or even simple javascript functionality can't be totally tested via NUnitAsp.

Logically, it seems like someone should just make NUnitAsp use Rhino, like HttpUnit. The small problem is that Rhino is itself written in Java. So, how do we access that java library from C#? There are a couple of ways: 1) Convert Rhino's Java source code to C#, thereby making a "fork"; 2) Use IKVM (http://www.ikvm.net/) to run the compiled Java code 'natively' and access the code from C#; 3) Compile the Rhino code in Visual J#, leaving the code (relatively) as-is and resulting in a pure managed assembly from NUnitAsp to reference.

I chose to try out option #3 first since it won't fork the code, require another component (IKVM), and would be relatively simple to try out. I tried it out in Visual J# 2005 (http://msdn.microsoft.com/vjsharp/). First, I had to manually create a new J# project and add the *.java files from Rhino 1.5R5. I chose that version of Rhino because it doesn't have external library dependencies, and it looks like 1.6R* does. Once all the files were in, I compiled. Most of the compiler errors were uninitialized variable false positives which I fixed by explicitly initializing some variables.

THAT WAS IT, FOLX.

I now have Rhino compiled to a native .NET assembly. Now I just need to figure out how to integrate NUnitAsp with it, but I'm sure I'll need an NUnitAsp developer's help with that. It was really cool that my hunch played out -- guess some good came out of waking up at 3am and being unable to get back to sleep :)

I also don't know about the dependencies on the J# libraries -- that may impair this working OOTB on mono. Those are secondary goals, of course :) Any takers for getting NUnitAsp to use some of Rhino .NET's capabilities?

Discussion:

showing all 0 messages    

(No messages)

>
Post a new message:

   

(unless otherwise marked) Copyright 2002-2014 YakPeople. All rights reserved.
(last modified 2006-02-13)       [Login]
(No back references.)