Skip to content

For developers

Hiroshi Ukai edited this page Nov 12, 2018 · 1 revision

Since JCUnit is a general purpose testing framework, it must be able to test various products from a library to applications in various phases from unit testing to system testing. Therefore product domain specific features and phase specific features are not in focus of it and they should be provided outside this product, e.g., Log collection mechanism, which will be useful for system testing, or adapters for web applications will not be included as a part of this product.

Followings are design policies of JCUnit (0.8.x or later),

  • It must be run under Java SE 8. If you need to work with older versions of Java, please use 0.7.x.
  • No external libraries unless carefully designed and explicitly stated. Its dependencies on external libraries are only combinatoradix, a very small and predictable library to enumerate permutations and combinations, and JUnit itself as of now.
  • When a checked exception is caught by JCUnit's code and thrown to upper levels, it should be wrapped with a JCUnitException, which is extending RuntimeException, or its subclasses.

And the author of JCUnit considers following items are important to use it in practice.

  • JCUnit must run test cases in a test suite it generates in a fixed order always to let the user be sure if a defect he/she finds is reproducible one or it's a one that happens from time to time.
  • Try to generate manageable size of test suite. (But the author does not try hard to generate the smallest one in the world. There are already so many fine products/algorithms like PICT that do it.)

Collections

  • Avoid using raw-type collections.
  • Use LinkedHashMap when we need key-value mapping unless it is very clear that it's safe
  • Lists are preferred to arrays.

Coding style

  • Popular styles, coding such as 'fluent' object building, StringUtils.join, etc, are preferred. But we cannot use popular libraries such as apache-commons or google guava for reasons above. When we need to implement similar things, they will be written in classes named XyzUtils.
  • Instead of Preconditoins.checkXyz, use Checks.checkxyz.

References

  • 1 JUnit
  • 2 combinatoradix
  • 3 PICT by Microsoft

Clone this wiki locally