zoukankan      html  css  js  c++  java
  • NUnit和JUnit

    不知道大家看过这两本书没有:《Pragmatic Unit Testing——In Java with JUnit》 和 《Pragmatic Unit Testing——In C# with NUnit》。内容是非常不错的。比如就启发你测试什么这个方面吧,提出了非常Pragmatic的几天建议:
    Are the results right?
    Are all the boundary conditions CORRECT?
    Can you check inverse relationships?
    Can you cross-check results using other means?
    Can you force error conditions to happen?
    Are performance characteristics within bounds?
    这个合称为:Right-BICEP
    还有关于帮助你发现边界条件的口诀CORRECT:
    Conformance — Does the value conform to an expected format?
    Ordering — Is the set of values ordered or unordered as appropriate?
    Range — Is the value within reasonable minimum and maximum values?
    Reference — Does the code reference anything external that isn't under direct control of the code itself?
    Existence — Does the value exist? (e.g., is non-null, non-zero, present in a set, etc.)
    Cardinality — Are there exactly enough values?
    Time (absolute and relative) — Is everything happening in order? At the right time? In time?
     
    但是这真的是两本书吗?其实并不是。两本书相似度有多少呢?我觉得至少有95%。把NUnit版本的转换为JUnit的大致只需要:
    1、把C#替换为Java
    2、把NUnit替换为JUnit
    3、把大写开头的方法名变成小写开头的
    4、把使用Attribute的内容换成类继承
    5。。。
    基本上就是几条简单的原则就把一本书变成了另外一本了。
    这就说明了一个问题了。技术的同质化已经非常非常严重了。正如书中所说:
    But while the examples are in Java, using the JUnit framework,the concepts remain the same whether you are writing in C++, Fortran, Ruby, Smalltalk, or VisualBasic. Testing frameworks similar to JUnit exist for over 60 different languages; these various frameworks can be downloaded for free.
    类似的,整个J2EE和.NET的开发思路也在融合。对于市面上越来越喧嚣的技术尘埃,我已经觉得麻木了。开始怀念书橱中已经开始上灰的计算机教材了。怀念第一次看Andrew S.Tanenbaum 的书的时候的激动感觉。。。
  • 相关阅读:
    一步一步CCNA之二:路由器特权模式
    uncompress bz2
    Protothreads Lightweight, Stackless Threads in C
    sohu的正版美剧都挺不错的
    Ebot crawler
    大数据时代的创新者们
    technology company
    slogan
    娱乐新闻都怎么搞的,真不给力啊
    售楼小姐比较漂亮
  • 原文地址:https://www.cnblogs.com/taowen/p/58940.html
Copyright © 2011-2022 走看看