Software testing-Object-oriented unit testing

Source: Internet
Author: User

Object-oriented unit testing (OO unit test)
A traditional unit test is a program block that is designed to function, process, or perform certain functions. With the concept of unit testing,

The actual test class member function. Some traditional test methods can be used in object-oriented unit testing. such as equivalence class row

division, Causality diagram method, Edge value analysis method, logic cover method, path analysis method, program interpolation method, etc. for cell-level Measurement

Test Analysis and test cases, scale and difficulty are much smaller than the test analysis of the whole system that will be introduced later and the

Test cases, and emphasize that the statement should have 100% code coverage for execution. When you design a test case to select input data,

Can be based on the following two assumptions:

1. If a function (program) executes one of the data in a class of input correctly, the other input in the same type can be executed correctly.

2. If the function (program) executes the input of a certain complexity correctly, the input of higher complexity can be executed correctly.

For example, if you need to select a string as input, based on this hypothesis, it is not necessary to care about the length of the string. Unless the length of the string

is a string that requires a fixed, such as an IP address. in object-oriented programs, class member functions are usually small, functional, and function

Frequent calls, prone to some undesirable errors.

Therefore, when doing test analysis and design test cases, should pay attention to the object-oriented program of this feature, carefully test points

Analysis and design test cases, especially for the selection of function return values as criteria, string manipulation, and so on.

Object-oriented programming features enable testing of member functions, It's not exactly the same as a traditional function or process test. especially following

Seung-te Sexual and polymorphic properties, a parent class member function that inherits or overloads a subclass has an issue that has not been encountered in a traditional test.

There are several different forms of polymorphism, such as parametric polymorphism, including polymorphism, overload polymorphism. Contains polymorphic and overloaded polymorphism in object-oriented language

in Words usually embodied in the inheritance of the subclass and the parent class, the tests for the two polymorphic are described above for the parent class member function inheritance and

contained in the discussion. Package polymorphism Although there are several types of parameters for member functions, it usually only adds complexity to the test. to the tool

There are member functions that contain polymorphism

when testing, it is only necessary to enlarge the type of input data in the test case based on the original test analysis and foundation. The class is granular into the

line-oriented the unit test for the object.

Software testing-Object-oriented unit testing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.