views:

33

answers:

2

I've been assigned the task of creating an XSLT transform on an XML dump from a database. Being a believer of Test/Behavior Driven Development I was wondering if anyone has attempted it before or has advice about how to go about it.

My gut reaction is to test this 'black box' with rspec. Is there a unit testing framework out there for testing XSLT?

+1  A: 

I recently found myself asking a similar question, but with Java rather than Ruby. I was writing an XSLT stylesheet and wanted to have some automated tests for it. In the end, the approach I adopted was to use the XSLT stylesheet to transform some sample XML documents and then run XPath queries on each of the results. I guess this is much the same approach as your 'gut reaction'.

A quick Google turns up a number of XSLT unit-testing frameworks, but most of these appear to target Java, not Ruby. I chose not to use any of them with my project since almost all of them seem to no longer be actively maintained.

Pourquoi Litytestdata
Yes, what your describing was my plan. Thanks for confirming that what I was thinking is probably the best way to go about it.
Jeff Waltzer
+1  A: 

There is a BDD framework for testing XSLT called xspec which is based on rspec developed by Jeni Tennison.

Per T