加入ImportNew的翻译试题

前两天在伯乐在线上面阅读文章的时候,偶然的机会看到了ImportNew小组正在招一些翻译的人员,而且自己的微信号也关注了这个小组,所以我就在伯乐在线网站上面回复了管理员,表达了自己希望加入翻译小组的愿望。当天唐尤华给我了回复,让我翻译一段儿文章,文章原文如下:

original:
Parameterized unit tests are used to to test the same code under different conditions. Thanks to parameterized unit tests we can set up a test method that retrieves data from some data source. This data source can be a collection of test data objects, external file or maybe even a database. The general idea is to make it easy to test different conditions with the same unit test method, which will limit the source code we need to write and makes the test code more robust. We can call these tests data-driven unit tests.

The best way to achieve data-driven unit tests in JUnit is to use a JUnit’s custom runner – Parameterized or JUnitParams’ JUnitParamsRunner. Using JUnit’s approach may work in many cases, but the latter seems to be more easy to use and more powerfull.

译文:
参数化方式的单元测试常常被用于测试不同业务场景下的同一段的代码。通过参数化方式的单元测试,我们可以建一个测试方法,从数据源中检索数据。数据源可以由测试数据对象,外部文件,或者数据库组成。一般的思路是这样的:使用相同的单元测试方法测试不同的业务场景,这就需要我们编写的测试代码更加健壮。我们将这些测试称作数据驱动的单元测试。

单元测试中,要实现数据驱动,最好的方式就是使用JUnit的自定义运行器(Runner)-JUnit’s Parameterized(JUnit的参数化方法)或者JUnitParams框架中的JUnitParamsRunner类。在大多数情况下,这两种JUnit定制工具都可以完成我们的工作,但是后者使用起来似乎更加方便,更加强大。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值