使用 TDD/BDD 开发 XSLT
我被分配的任务是对数据库中的 XML 转储创建 XSLT 转换。作为测试/行为驱动开发的信徒,我想知道是否有人以前尝试过,或者有关于如何进行的建议。
我的直觉反应是用 rspec 测试这个“黑匣子”。是否有用于测试 XSLT 的单元测试框架?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个用于测试 XSLT 的 BDD 框架,名为 xspec,它基于 Jeni Tennison 开发的 rspec 。
There is a BDD framework for testing XSLT called xspec which is based on rspec developed by Jeni Tennison.
我最近发现自己在问类似的问题,但是是用 Java 而不是 Ruby。我正在编写一个 XSLT 样式表,并希望对其进行一些自动化测试。最后,我采用的方法是使用 XSLT 样式表来转换一些示例 XML 文档,然后对每个结果运行 XPath 查询。我想这与你的“本能反应”非常相似。
快速 Google 一下就会发现许多 XSLT 单元测试框架,但其中大多数似乎都是针对 Java,而不是 Ruby。我选择不在我的项目中使用它们中的任何一个,因为几乎所有它们似乎都不再得到积极维护。
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.