How to do Unit Testing of SmartPaste override

Post here questions and problems related to oXygen frameworks/document types.
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

How to do Unit Testing of SmartPaste override

Post by Pascale » Thu Mar 27, 2014 6:34 pm

Hi,

We have a custom doctype, and have customized the SmartPaste feature by taking a copy of the Docbook XSLT files in our ${framework}/resources folder and we have updated them to adapt the conversion to our DTD. In Oxygen Author, I can now copy a section, table or list from MS Word and paste it as a valid XML fragment in my document. So far, so good...

Now, I would like to do some Unit Testing of the XSLT stylesheets in my Eclipse project.
I tried to use Juxy, but when my test case is loading the XSLT it crashes with an exception

Code: Select all

java.lang.NoClassDefFoundError: com/saxonica/bytecode/ExpressionCompiler
at net.sf.saxon.style.XSLMessage.compile(XSLMessage.java:130)
...
at org.tigris.juxy.JuxyTestCase.applyTemplates(JuxyTestCase.java:82)
...
Caused by: java.lang.ClassNotFoundException: com.saxonica.bytecode.ExpressionCompiler
...
Note that I have some simple test cases, based on Juxy and using a rather modest XSLT, that work OK.

Therefore, my interpretation of the error is that the SmartPaste XSLT requires some function which is available only in Saxon EE and this version of Saxon is embedded in the Oxygen Auhor, which explain why it runs with no error in the editor; but is not included in the SDK, which causes the exception when running my unit test.
Is this correct ?

If yes, shouldn't you provide Saxon EE also in the SDK ?
Or is there another way to do unit testing of the XHTML2zzz.xsl stylesheet ?

Thanks for your help,
Pascale

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: How to do Unit Testing of SmartPaste override

Post by sorin_ristache » Fri Mar 28, 2014 6:39 pm

Hi,
Pascale wrote:I tried to use Juxy, but when my test case is loading the XSLT it crashes with an exception

Code: Select all

java.lang.NoClassDefFoundError: com/saxonica/bytecode/ExpressionCompiler
at net.sf.saxon.style.XSLMessage.compile(XSLMessage.java:130)
...
at org.tigris.juxy.JuxyTestCase.applyTemplates(JuxyTestCase.java:82)
...
Caused by: java.lang.ClassNotFoundException: com.saxonica.bytecode.ExpressionCompiler
...
The com/saxonica/bytecode/ExpressionCompiler class looks like a juxy requirement. The XSLT stylesheets used for the smart paste work with Saxon PE too. Saxon EE is not required.
Pascale wrote:Therefore, my interpretation of the error is that the SmartPaste XSLT requires some function which is available only in Saxon EE and this version of Saxon is embedded in the Oxygen Auhor, which explain why it runs with no error in the editor

...

Or is there another way to do unit testing of the XHTML2zzz.xsl stylesheet ?
Did you try to set Saxon PE instead of Saxon EE as the XSLT processor in juxy? That should remove any Saxon EE class requirement and should run the smart paste stylesheets without errors.


Regards,
Sorin

Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: How to do Unit Testing of SmartPaste override

Post by Pascale » Wed Apr 02, 2014 11:17 am

Hi Sorin,

thanks for your answer.

We investigated a bit around Juxy and could not find a solution for our case, so we are wondering if we could use XSpec instead.
We however want to run the Unit Tests from our Eclipse/Jenkins integrated development environment.
Do you have any experience doing this, and any tip or advice to share with us ?

Kind regards,
Pascale

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: How to do Unit Testing of SmartPaste override

Post by sorin_ristache » Wed Apr 02, 2014 11:39 am

Hi Pascale,

We have only JUnit tests for the Smart Paste transformations. I think you can add XSpec tests to your code and run them on a Jenkins server by using this Maven plugin for XSpec. This Maven plugin allows you to add your tests in the src/test/xspec subdirectory of the plugin directory and after that just declare this plugin for XSpec in your pom.xml, because it is already deployed on Maven Central. I have not tested it, but I think there are people that already use it.


Regards,
Sorin

Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: How to do Unit Testing of SmartPaste override

Post by Pascale » Wed Apr 02, 2014 11:46 am

Hi Sorin,

cool, we will try it - stay tuned for more feedback ;-)

Pascale

Post Reply