Dynamic white box test
Dynamic white box test refers to the use of information that views code features and implementations to determine which to test, which don't test, how to carry out test
. Another common name for dynamic white box testing is a structural test because the software tester can view and use the internal structure of the code to design and
Execute test. Dynamic white box test is not just viewing code, but also direct parameters and control software. The dynamic white box test includes the following four parts: - Test the underlying function, process, subroutine and libraries directly. That is, the application interface (API) - from the top layer test software in a full program, but to adjust the test case based on the software running. - Access to the read variable and status information from the software to determine whether the test is consistent with the expected results, and forced software
It is difficult to implement the normal test. - Estimate the amount of code and specific code "hit" when the test is executed, then adjust the test, remove extra, supplement omissions.
Dynamic white box test VS debugging
The goal of white box test is to find software defects, and the purpose of debug is to fix them. But the two have a cross-crossed phenomenon. Tester should reduce the problem
In order to demonstrate the most simplified test cases of software defects. In the white box test, even the code row information that is worthy of doubt is to make it easy.
The staff has targeted analysis, and it is determined to repair.
Be sure to distinguish between software testers and programmers. Programmer write code, tester find software defects, may also write some code to drive
Move test, then the programmer repairs the software defect.
To make such a underlying test, use the same tool as the programmer. If the program has been compiled, use the same editor, but
Use different settings to enhance the error detection function.
Segmentation test
From the perspective of testing, there are two reasons for high cost: - It is difficult to understand the causes of problems - some software defects cover other software defects. It is difficult to make a core error.
Unit test and integrated test
Tests in the underlying test are called unit tests or module tests. After the unit test, the underlying software defect is found and repaired,
To integrate, the module group is integrated. Finally until the entire product (at least the main part) is integrated into system testing. This test strategy is easy to isolate software defects. There are two main ways: - The test drive module needs to be prepared up soon to test the object module. The test drive module is mounted in the same manner in the future, to the test
The bottom case sends a test case data, accepts the return result, whether the verification result is correct. - In this case, in this case, you can use the test stub code, act as a lower interface module, and provide parameters directly from the file to the upper layer mold.
Piece. In this way, various test values can be tried from head to tail, verify the operation of the upper module.
Example: C language, convert the ASCII characters into a function atoi (). - First, determine the location of the module in the program - underlying module, can be called by the high-level module, but you can't call other models.
Piece. You can confirm this by checking internal code. - Determined by the previous step, it is determined that a test driver should be used to test the module independently of other regions of the program. This test is driven
For test strings, read return values, compared to expected results. Writing test-driven languages can be different from the language of the function;
On, it can be a simple dialog (interactive and flexibility), or a separate program (fast from the file read and write test case). - Analysis manual, determine the black box test case that should be used, and then uses the equivalent distribution technology to test the case collection. - How to find a function of research code is implemented, using the module's white box knowledge increase or decreases test cases. Note: Before performing a white box test, it must be established according to the instructions to establish a black box test case. This will guarantee the true test module
Intertwined, complete test expected operations, and avoid the influence of the code in white box testing and biased toward module work mode to establish test cases.
When the white box test, reasonable practices are also divided into data and status (or program flow). From the same perspective, you can easily
The white box information is mapped to the black box test case that has been completed.
data range
Data includes all variables, constants, arrays, data structures, keyboards, and mouse inputs, files, screen input / output, and modems,
Other equipment such as other devices. 1. The data stream range of data streams is mainly to track a batch of data throughout the software. In the unit test level, the data only passes a module or function.
. If you test at the underlying test, you will use the debugger and observation variable to view the code at runtime, check the intermediate value, so that quality is guaranteed.
2. The border white box test To carefully check the code, find the subordinate condition, and establish a case of testing them. In addition to the ASCII code table and 2 of the passenger
For common examples, such as: operation, it is possible to turn to usage formulas by using data tables; data may be turned from RAM; numerical analyzer may
Digital size uses different equations ...
3. Formulas and equation formulas and equations are typically hidden in the code, from outside, performance and influence are not obvious. However, in some formulas, such as:
A = P (1 r / n), after seeing this formula, you know that n = 0 as a test case will result in zeroing error, so you don't need to run test
Use the example to predict the defect. However, if n is the result of the calculation (there may be many possibility values), then the tester should consider whether there is a zero value.
Shape, and point out what kind of program input can cause it. 4. Error Force When the test case is executed, it cannot be achieved if a variable reaches a set value, and the purpose can be achieved by enforcing the value. Be careful not to set up the situation in the real world when you use the error. For example, in the above example, if the function begins to be judged
The broken n value must be greater than 0, and N is only present in the formula, then the test case for the n value is forced to zero is unreasonable. Using error is forced to force all the error prompt information in the software to display a good way. Because many mistakes are difficult to establish,
For example, 2049 printers are hung. If you just want to test whether the error prompt information is correct, it is most effective to use the error.
Code range
The status of the test program and the program flow, you must try to enter and exit each module, perform each line of code, track each
Strip logic and decision branch. Check the software according to the level detailed inspection software called code range analysis. Code range analysis requires full access to code to view operational testing
Which parts have been passed when trying a case. Its simplest form is to view the code by a single-step execution program with a debugger using a compilation environment. For large procedures,
A special tool called a code range analyzer is required. It can be easily known from the data obtained: the test case does not cover the software?
Some of the test cases are redundant (increasing this case but does not increase the code overlay ratio), which is to determine which new tests need to be established.
Case.
The most direct form of program statement and code line range code is called statement range or code line range. If the statement range is monitored while the test software, the target is to ensure that each statement in the program is at least once. However, from some extent, the scope of statement is a misleading, because even if all statements are
Executed, it does not mean all the paths that have been spread.
The branch range attempts to overwrite all paths in the software called path testing. The simplest form of path test is called a branch range test. Pay attention to each judgment
Broken conditions (combinations) produce branches, that is, each judgment condition (conditional combination) is taken out, and it should be performed once.
Condition range
Condition range test takes into account the additional conditions of the branch statement. The different parts of the branch is mainly reflected in the combination of multiple conditions. The branch range regards the combination of conditions as a whole, and the conditions
This combination is disassembled and analyzes each particular condition. It is guaranteed that the true and false value of each specific condition is done.