Thoughts on language independent rep

I'd really like to be able to round-trip the language independent representation (LIR) with JUnit code, that is be able to generate the  LIR from JUnit as well as generate the JUnit from the LIR
without degradation.  This would help rapid development of tests since the tests could be developed within Java IDE's and exported to LIR.

I haven't had any experience with it, but JavaML  (http://www.cs.washington.edu/homes/gjb/JavaML/, related article at http://www-106.ibm.com/developerworks/library/javaml/) could be used to XML-ify
the JUnit based tests and then an XSLT transform could be used to extract the essential core of the tests in a LIR representation.  This would allow pretty rapid iteration of the LIR design against
the existing DOM 1 tests.

I would suggest that there be explicit elements for the various xUnit asserts, for example that there be elements like:


<assertEquals expected="ABCD" actual="somevar">Desc could go here</assertEquals>
<assertNull actual="othervar"/>
<assertNotEquals.../>
<assertNotNull.../>

Fetching a document and binding it to a variable should be a distinct element:

<document var="doc" href="staff.xml"/>

Invoking a method, probably the best approach would be to mimic the best of IDispatch::invoke and java.lang.reflect.Method.invoke.  Maybe a good design criteria would be if you could implement an LIR
interpreter on top of IDispatch::invoke or java.lang.reflect.Method.invoke.

<invoke target="doc" property="documentElement"/>

<invoke target="doc" method="getElementsByTagName" arguments="employee"/>

I had thought about using a $ to distinguish between variable references and literals, but it is probably better to have distinct elements for literals and had everything either take variable
references or work on the result from the last invoke.

<string var="ABCD">ABCD</string>
<int var="FIFTH">4</int>

Received on Friday, 27 April 2001 15:23:53 UTC