technology > box testing charge
  Unit testing tasks
  Unit testing tasks include: a module interface test; each error processing pathway test five modules; 2 module local data structure of the test; 3 module boundary conditions tested; 4 module execution paths of all independent tests.
  Interface test module is the foundation of unit tests. Only the data correctly inflows, outflows under the premise of modules, other tests can be meaningful. Test Interface correctness should consider the following factors:
  The actual number of parameters in the form of an input parameter is the same;
  2 properties enter the actual parameters and formal parameters match;
  Dimensionless parameters and actual parameters of the three forms of input are consistent;
  4 When you call other modules to the actual number of parameters is the number of parameters to be adjusted with the same module;
  Property when calling other modules to whether the actual parameter 5 tone module parameter attributes are matched;
  6 call other modules to the dimensionless parameter is the actual shape is adjusted with the dimensionless parameter module is consistent;
  7 predefined function calls used when the number of parameters, properties, and the order is correct;
  8 if there is nothing to do with the current entry point parameter references;
  9 is a read-modify parameters;
  10 definition of global variables of each module are the same;
  11 is passed as a parameter to certain constraints.
  If the module includes external input and output, you should also consider the following factors:
  1 file attributes are correct;
  2 open / close statement is correct;
  3 format with input and output statements match;
  Are 4 buffer size and the record length match;
  5 whether the file has been opened prior to use;
  6 whether to deal with the end of the file;
  7 whether to deal with the input / output error;
  8 output if there is the text of the error;
  Check the local data structure is to ensure that data is temporarily stored in the module during the execution of the program complete and correct. Local data structures are often the root cause of the error should be carefully designed test cases, and strive to find the following types of errors:
  A description of the type of inappropriate or incompatible;
  2 variables without initial value;
  3 variable initialization or default values ​​provincial wrong;
  4 Incorrect variable name (misspelled or incorrectly _truncate_d);
  5 appear on the overflow, underflow and address anomalies.
  In addition to local data structures, if possible, unit testing, consideration should identify global data (eg fortran common areas) on the module.
  Deal with every execution path in a separate module for basic tasks testing, unit testing is to ensure that the module each statement executed at least once. At this test is designed to find errors due to miscalculation, incorrect and inappropriate comparison control flow caused. At this time the basic path testing and loop testing is the most common and most effective testing techniques. Calculation of common errors include:
  A misunderstanding or using the wrong operator precedence;
  2 mixed-type operation;
  3 variable initial mistake;
  4 precision is not enough;
  5 expression symbol wrong.
  Comparative judgment is often closely related with the control flow, test cases should be devoted to the discovery of the following errors:
  A comparison is made between different types of data objects;
  2 errors using logical operators or priority;
  3 due to the limitations of the computer representation, and in fact the two are equal theoretically expected amount equal to not equal;
  4 comparison operator or variable error;
  5 loop termination condition or impossible;
  Not exit 6 iterations diverge;
  7 incorrectly modify the loop variable.
  A good design should be able to foresee all kinds of error conditions and error handling various pre_set_ path, error processing pathway also requires careful testing, testing should be focused on checking the following issues:
  An output error message is difficult to understand;
  Errors and error actually encountered two records do not match;
  3 in the program from a defined period before the error handling operation, the system has been involved;
  4 improper exception handling;
  5 misstatement failed to provide enough information to locate the error.
  Boundary condition test is a unit test Finally, and most important a task. Congregation known, the software often fail on the border, using boundary value analysis techniques for boundary value and its left and right design test cases, is likely to find a new error.
Translated by Google