使用两种不同语言的代码和单元测试?
我最近开始用 Ruby 编写 PL/SQL 代码的单元测试。
是否有其他语言组合可以用两种完全不同的语言编写代码和单元测试?
I've recently have started writing unit tests for PL/SQL code in Ruby.
Are there any other language combinations where you write your code and unit tests in two completely different languages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
常见的组合是 Java 代码和 Groovy 测试。这特别有趣,因为 Groovy 是构建在 Java 之上的,例如 Groovy 甚至使用与 Java 相同的测试框架。
A common combination is code in Java and tests in Groovy. Which is particular interesting because Groovy is built "on top of" Java, for example Groovy even uses the same testing framework as Java.
我们为 Java 应用程序编写常规测试。主要是因为我们想学习和体验其他编程语言。
We write groovy tests for our Java application. Mainly cause we want to learn and experience other programming languages.
我见过用 Ruby 为用 swig 包装的 C 库编写的单元测试。
与用 C 编写的相同单元测试相比,主要优点是交互式 Rub 解释器 (irb) 允许进行探索性测试。
I've seen unit tests written in Ruby for a C library wrapped with swig.
The main advantage compared to the same unit tests written in C being the interactive Rub interpreter (irb) that permits to do exploratory testing.
几年前,我们使用 Python 来测试 C++ 代码,使用 Boost 导出类。
单元测试是用 python 编写的。
这个架构有趣的部分是我们能够从 python 控制台访问活动对象,因为逻辑是用 python 表达的,C++ 用于构建低级类。
Few years ago we used Python to test C++ code, using Boost to export classes.
Unit tests were written in python.
The interesting part of this architecture is that we were able to access to living objects from a python console, because the logic was expressed in python, C++ was used to build low level classes.
如果您要向现有项目添加新语言,那么使用现有语言进行功能/验收测试是完全合理的。
当我们第一次采用 Ruby on Rails 时,我们仍然使用 JUnit 和 HTMLUnit 来测试Web 前端并直接针对数据库后端进行断言。
如果您仍在学习如何使用新的基础设施,那么在进行转换时继续使用您可以信任的测试方法是有意义的。
我们最终开始在 ruby 和 selenium 中使用 test/unit - 但它对于我们依赖现有的基于 Java 的测试的过渡期很有用......
If you're adding a new language to an existing project it's perfectly reasonable to do functional/acceptance tests in the existing language.
When we first adopted Ruby on Rails, we still used JUnit and HTMLUnit to test the web front-end and did assertions directly against the database backend.
If you're still learning how to use a new piece of infrastructure it makes sense to keep using a testing method that you can trust whilst you do the transition.
We did eventually start using test/unit in ruby, and selenium - but it was useful to a transition period where we relied on our existing Java-based tests...