Object-oriented software test

zhaozj2021-02-16  121

Object-oriented software test

- A similarities and differences between talking about traditional test methods

soft

The crisis is the hottest topic of the software industry or even the entire computer. In order to solve this crisis, software practitioners, experts and scholars have made a lot of efforts. Now people have gradually realized that the so-called software crisis is actually only one situation, that is, there is a mistake in the software, which is these errors lead to software development at cost, progress and quality out of control.

The quality of the software is not only reflected in the correctness of the program, but it is closely related to the demand analysis of the previously made, software design is closely related. At this time, the corrective correction of the error often cannot be traced back to the initial stage of software development through a simple repair of more errors. Therefore, in order to ensure the quality of the software, we should focus on the entire software survival period, especially to the work of the previous development phases. Thus, the concept and implementation scope of software testing must be expanded and should be included in the entire development phase of review, evaluation, and testing. As a result, the generalized software test is actually composed of three aspects of confirmation, verification, testing.

At the entire software survival, confirmation, verification, tests have its focus on the stage. Confirmation is mainly reflected in the planning phase, the demand analysis phase, will also appear in the test phase; the verification is mainly reflected in the design phase and the coding phase; the test is mainly reflected in the coding phase and the test phase. In fact, confirmation, verification, test is complementary. Confirmation will undoubtedly produce standards and test standards, and verification and testing usually helps complete some confirmation, especially in the system test phase.

Traditional test computer software strategy is from "small test", step by step to "large test". That is, we start from the unit test and then gradually enter the integrated test, and finally the validity and system testing. In traditional applications, the unit test focuses on minimal compileable program unit-subroutines (such as modules, subroutines, processes), once these units are tested, it is integrated in the program structure, at this time To perform a series of regression tests to find the side effects caused by the incorrect of the module and the addition of the new unit to join the side effects, the system is finalized as an overall test to ensure that the error discovered in the demand.

The structure of the object-oriented program is no longer a traditional functional module structure, and as a whole, the original integrated test is gradually built into the development of the module for testing. It has become impossible. Moreover, the object-oriented software abandoned the traditional development model. There are different previous requirements and results for each development phase, which is impossible to use functional refinement to detect the results of object-oriented analysis and design. Therefore, the traditional test model is no longer applicable to object-oriented software.

1 Object-Oriented Test Model

Object-oriented development models break through the traditional waterfall model, which will be divided into three phases of object-oriented analysis (OOA), object-oriented design (OOD), and object-oriented programming (OOP). In response to this development model, combined with the traditional test steps, we divide the object-oriented software test into: object-oriented test, object-oriented programming, object-oriented unit test, object-oriented integration Test, object-oriented system test.

2 Test for object-oriented analysis

Traditional process analysis is a functional decomposition process, which is a collection of features that can be decomposed. This conventional functional decomposition analysis method has an eye in which a system is needed to treat the system to treat the system in the abstraction of the process. Object-oriented analysis (OOA) is "the concept of the ER] and semantic network model, that is, the concept of information styling, combined with important concepts in object-oriented programming languages, and finally get problem space Description of the form of the chart. OOA direct mapping problem space, comprehensive implementation of the realistic abstraction of the functionality. Abstract the instance of the problem space to object, reflects the complex instances and complex relationships of the problem space with the structure of the object, indicates the features and behaviors of the instance with the attributes and operations. For a system, in contrast, the behavior is relatively stable, and the structure is relatively unstable, which is more fully reflected in the real characteristics. The result of OOA is to provide a platform for the selection and implementation of the rear stage class, organization and implementation of class hierarchies. Therefore, the test of OOA should be considered from the following aspects: Test of the identified object

Test of the identified structure

Test for identified themes

Test for defined properties and instances

Test for defined services and messages

3 Test for object-oriented design

The usual structured design method, is used as a job-oriented design method. After breaking the system, it is proposed a group of work. These homework is based on the process of implementing the system, and the analysis of the problem domain is converted into a solution domain. Design, the result of the analysis is the input of the design phase. " Object-Oriented Design (OOD) uses "viewing view", induction of OOA, and establish a class structure or further constructing a class library to achieve an abstraction of problem space. It can be seen that OOD is not a big way of simmering the way to OOA, but the further refinement of OOA and the higher level of abstraction. Therefore, the boundaries of OOD and OOA are usually difficult to distinguish. The OOD determination class and class structure not only meets the requirements of current demand analysis, but more importantly, it can facilitate the reuse and amplification of functions by re-combining or proper supplements, to facilitate the implementation of the user's requirements. Therefore, the test of OOD should be considered from the following three aspects:

Test for identified classes

Test of class hierarchical structure

Support for the class library

4-directional objective programming

Typical object-oriented programs have new features of inheritance, packaging, and polymorphism, which makes traditional test strategies must change. The package is hidden on the data, and the outside world can only access or modify the data by the operation provided, which reduces the possibility of any modification and reading and writing, which reduces the illegal operation of the data in the traditional program. Inheritance is an important feature of object-oriented programs, inherits the reuse rate of code, and also increases the probability of error propagation. Polymorphism makes the object-oriented programs exhibited powerful processing power, but at the same time, the behavior of the "same" function in the program is complicated, and the code and behavior of different types of specific implementation have to be considered when testing.

Object-oriented program is distributed in the class. Correctly implement the functionality class, through message delivery to achieve the function of design requirements. Therefore, in the object-oriented programming (OOP) phase, the rules of the functional implementation are ignored, and the testing gaze is concentrated in the implementation of class functions and the corresponding object-oriented program style, mainly reflected in the following two aspects.

Does data members meet the requirements of data packages

Whether the class implements the required functionality

5 Object-oriented unit test

The object of the traditional unit test is the minimum unit - module for software design. The basis of unit testing is to set up a description, and the unit test responds to all important control path design test cases in the module to discover errors within the module. Unit tests are multi-white box test technology, and multiple modules in the system can be tested in parallel.

When considering object-oriented software, the concept of the unit changes. Package drivers the definition of classes and objects, which means that instances (objects) of each class and classes are packaged in the property (data) and manipulating the operations of these data. Instead of individual modules. The smallest test unit is a package or object, and a class contains a set of different operations, and a special operation may be existing as part of a set of different classes. Therefore, the meaning of unit testing has changed. We no longer test a single operation, but will operate as part of the class. 6 Object-oriented integrated test

Traditional integrated tests, there are two ways to measure by integrated function modules. (1) Since the top downward integration: Since the top down integration is an incremental method of constructing the structure structure. It starts from the main control module, according to the software control hierarchy, with a deep priority or breadth priority strategy. Integrate each module together. (2) Since the beginning of an upward: the upward test is to assemble tests from the "atom" module (ie, the lowest layer of the software structure).

Because the object-oriented software does not have a level control structure, the traditional auto-down and bottom-up integration strategy is meaningless. In addition, an integrated operation is often impossible (traditional incremental integration methods), this It is due to "Direct and indirect interaction of components of the composition". There are two different strategies for integration testing of OO software. The first set of thread-based tests, integration of a set of classes needed for an input or event of the response system, each thread is integrated and tested separately, and the application regression test To ensure that no side effects are generated. The second test is called based on the use of the test, starting the construction system by testing the class (called independent classes) that almost unused, after the independent class test is completed, the next layer uses the independent class, called Dependent class, tested. This dependency level test sequence has continued until constructing a complete system.

7 Object-oriented system test

Through unit testing and integration test, it can only be achieved by ensuring software development. But it cannot be confirmed whether it meets the needs of users when actual operation. To this end, the software that is developed must be specified by the software. System testing should try to build the same test platform as the user's actual use environment, should ensure the integrity of the measured system, the temporary system equipment components, should also have corresponding analog tools. When the system test, the results of the OOA analysis should be referred to, corresponding to the objects, attributes, and various services described, whether the software can fully "reproduce" problem space. System test is not only the overall behavior performance of the test software, but also from the other side, it is also a repudiation of software development design.

Object-Oriented Test Overall Objectives - Up to the smallest workload discovery - and the goal of traditional software tests is consistent, but OO testing strategies and tactics have great different. The angle of testing is enlarged to include review analysis and design models. In addition, the focus of the test is moved from the process component (module) to the class.

Whether it is a traditional test method or an object-oriented test method, we should follow the following principles:

1. The "testing as soon as possible" as the motto of the developer.

2. Programmers should avoid checking their own procedures, and testing should be done by an independent professional software testing organization.

3. When designing test cases, the legal input and illegal inputs should be considered, as well as various boundary conditions, special circumstances to create extreme conditions and unexpected states, such as network abnormal interruption, power power off and other conditions.

4. Be sure to pay attention to the occurrence of errors in the test, which has a great relationship with the programmer's programming level and habits.

5. There must be a confirmation process for the test error result. Generally there is an error that is tested, be sure to have a B to confirm that serious errors can be convened to discuss and analyze.

6. Develop a strict test plan, and arrange the test schedule as soon as possible, do not want to complete a high level test in a very short period of time.

7. The relevance of the regression test must cause adequate attention to modifying an error and causing more errors. 8. Properly save all test procedure documents, meaning is self-evident, and the reproducibility of tests often rely on test documents.

转载请注明原文地址:https://www.9cbs.com/read-13734.html

New Post(0)