Most Powerful Open Source ERP

Guideline Write Testable Code And Test Smart

To create quality code and tests.
  • Last Update:2019-07-15
  • Version:001
  • Language:en

Write Testable Code And Test Smart

A good test is a test covering well existing code, using small amount of lines of code an which is fast to run.

Whenever possible, it's important to organize the code into distinct parts (documents, classes , methods) that could be tested separately. Like this every part could be easily modified and tested without checking the whole code every time.

It is not necessary to test huge amount of data. Let's say you would like to test the method setTitle on a document, checking a very few values is enough (like simple ascii value and utf8 values with a string in Japanese), you do not need to test various complete dictionaries.