Developing XSLT with TDD/BDD
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 i开发者_JAVA百科s to test this 'black box' with rspec. Is there a unit testing framework out there for testing XSLT?
There is a BDD framework for testing XSLT called xspec which is based on rspec developed by Jeni Tennison.
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.
精彩评论