Dans cet article
When developing extension we strongly encourage to use the test functionalities and add testcase to you project so that when making change you can see if there have been regressions.
How tests works
The test framework operates similar as a typical testunit.
For example if you need to test an accounting report.
- Preparing the test:
- You create a test case in the sub-directory your extension (see extension package and project).
- For the report case in the test directory you will put a the accounting file with the data that is necessary for the test.
- You create a expected results directory.
In our case it will contain the expected report.
The first time you run a test, you will copy the results to the expected directory. - You write a test function that load the accounting data and call the extension function that generate a report.
The first time you run a test, you will check manually that the report is correct.
- Running the test.
- You start the test.
- The framework will run the test case.
- The result will be compared to the expected result and if the result is different the test will fail.
- You start the test.
Documentation and examples
- Banana.Test
Class used when creating unit tests. - How to for the Test Framework
Step-by-step guide for creating a simple test case example that uses Extensions Test Framework to run unit tests of Extensions.