Contents
Suggestions for any APLTree sub-project
Definitions
APLTree is an Open Source tool and utility library. It has it's own category, CategoryAplTree
- Projects declaring themselves as part of the APLTree project are called sub-projects.
Licensing and copyright
APLTree is an Open Source project. All sub-project must conform to this and therefore contain a conforming note. See AplTreeLicensing for details.
Suggestions
How to implement test cases
Generally, there are two different ways one can implement test cases: Either in a workspace or by running a script. Both approaches have their pros and cons. Choose what is appropriate for you.
Workspace approach
All test cases are supposed to be in a namespace #.TestCases.
- At least there is one function "Test_001". Depending on the complexity of the tests there may be up to 999 different other functions.
- Every function "Test_{number}" is supposed to implement one test case.
There should be a function #.TestCases.RunAll which is supposed to run all test cases in one go.
- That function should accept a right argument of length 1 to 3:
- Default is 1 meaning that all errors are trapped (broken) when a test case is executed.
Default is 0 meaning that in case of a failure the test case is reported as having failed and then RunAll carries on. Setting this to 1 let the program halt for investigation.
- Default is 0. This indicates that the test case it not executed in batch mode.
Note that following these suggestions makes it much easier for others to get familiar with a sub-project, and to fiddle with them. This is not because these suggestion are so particularly good, it is because if everything follows the same route, one knows where to go. It is also the only way to perform tests automatically (batch mode). Note that these are excellent reasons to stick with these rules.
Batch mode
There is an application available that executes all test cases of all members of the APLTree project automatically. The vector 1 0 1 is then passed as the right argument to RunAll . In order to make that work every test case must accept both a left and a right argument. Therefore, the header signature of a test case function must always look like this example:
R←stop Test_0001 batchFlag
The right argument is the third element of RunAll's right argument. It tells it that the test is performed in batch mode. Of course any test case is supposed to avoid performing any tests in batch mode that rely on interaction with a user, or execute a GUI app that is not specifically designed to work under batch conditions.
The left argument is the second element of RunAll's right argument. It tells any test case not to stop in case of a problem.
- The explicit result is supposed to be a 0 in case everything went okay, otherwise 1.
- In batch mode nothing shall be written to the session.
Scripted approach
(to be developed....)
APL Wiki