[Reprint] Software functional testing 21 failure models

Source: Internet
Author: User

Non-original, from 51Testing software testing network loading, thanks again for the original

The goal of the test is to find errors, so follow this goal when writing test cases, and write test cases as much as possible in the weakest links of the software. While testing has many individual input variables and multiple input variables, good software testers do not rely on luck, they have a wealth of experience and intuition to find out what needs to be tested, which do not need to be tested, and which operations may cause software failure. The experience and intuition of these testers are summed up and cured as much as possible, and some failure models are formed. The failure model indicates how and why the failure occurred during software execution. During the testing process, we can find as many defects as possible based on the types of defects provided by these failure models and the method of finding such defects.

1. Enter illegal data

1.1 Causes of defects

Developers typically use the following 3 techniques to handle illegal input:

Prevents incorrect input from entering the software under test. Filter out incorrect input and allow only legitimate input through the interface.

After the incorrect data has been entered, the software prompts for an error message and rejects the incorrect input.

Allow incorrect input to enter the system and handle it, call the exception handler when the software fails, and display some error messages.

It can be seen that developers, in addition to writing the main functional code, must also write a check code for the illegal input, which is often forgotten, or after writing this part of the code, developers seldom examine carefully, resulting in processing illegal input often error.

1.2 How to find this kind of problem

The following three points are generally considered when testing from the properties of the input values:

INPUT type: Typing an invalid type often produces an error message.

Input length: For character types, typing too many character constants leads to error messages.

Boundary value: The input boundary value or data that exceeds the boundary value.

1.3 Summary of test methods

Application: GUI input.

Test method: From the input data type, length, boundary value and other aspects of consideration.

Test information check:

The error message and error are consistent.

The content of the error message is empty and the user does not know why it was wrong.

The error message displayed is used by developers for debugging, such as "Error 5-unknown data", where developers can easily find the type of error, but the user simply does not understand and does not know what to do wrong.

Test Knowledge Reserve: Keep in mind the boundary values for each basic data type.

2. Enter default values

2.1 Causes of defects

Once a variable is used in the software, it must be assigned to the initial value, and if the variables are used before the assignment, the software is invalidated, and the order of the variables is correctly used: Declare the variable and assign the variable a value à use the variable. The default value for a variable is usually incorrect for the following two reasons:

Assigning values to variables this step is often inadvertently passed by developers.

Developers sometimes do not know exactly what to assign the initial value, give a value, but the user does not recognize the value, in this case, the software does not necessarily expire, but the use of users will cause a lot of inconvenience. For example, a program that sets the number of print default output copies to 2 copies can cause a lot of trouble for users.

2.2 How to find this kind of problem

The following are some basic principles for determining the data used in the application software:

Find option buttons, configuration panels, installation screens, and more. The data displayed on this screen is often used in many parts of the application.

Review the data declaration portion of the source code (if available).

The data that you want to test is determined, and you can force or not use the default value by doing the following:

Accept the default value displayed by the software. Sometimes the software requires the user to enter a value, and if no value is entered, the software may fail. You can simply click the "OK" button to accept the default values and complete this functional test.

Type a null value. Delete the default value so that the input field becomes null.

Change the default value to another value, which causes the application to run with a different value.

Change the input value to another value, and then change to a null value.

A good software will handle the above situation, the illegal content entered by default to a reasonable value within the legal boundary, or return an error message.

2.3 Summary of test methods

Application: Where a default value is required.

Test methods: From the Options button, configuration panel, installation configuration, start interface and other aspects of consideration, force or not use the default value and so on.

Test Knowledge Reserve: Fully understand the requirements of the default values in the requirements specification, and deeply understand the industry background of the software being tested.

3. Enter a special character set

3.1 Causes of defects

The application accepts string input, and if the program does not specifically program for special input, it can cause the program

Hangs, mainly includes the following 3 kinds of situations:

The character set includes ordinary characters and special characters. For example, the ASCII character set includes ordinary characters and special characters. An application can sometimes handle only ordinary characters, and an error occurs when a special character is entered.

The programming language that implements the application has a specific way of handling some characters and strings. For example, the C language uses characters such as \ n, + +, and & for special purposes. If you type these strings into a dialog box, the program must do error handling, otherwise it is prone to errors.

Applications sometimes also use set names, system objects, and a collection of reserved strings for programs. As long as these strings are used in the program, they can result in invalidation.

3.2 How to find this kind of problem

According to the software's operating system, the programming language used, the character set and other information to list the table, through the discussion of the Test team, indicating which characters and data types in the application table as input to test.

Based on experience, software rarely crashes because of this operation, and usually it hangs without responding.

3.3 Summary of test methods

Application: The place where character input is to be accepted.

Test method: Enter illegal characters according to the specific situation of the software being tested.

Testing knowledge reserves: As much as possible to understand the character set, programming language and operating system of the reserved strings and their specific meanings, we can better distinguish such defects.

4. Enter data that overflows the buffer

4.1 Causes of defects

The developer does not consider the size of the string that is passed to the memory buffer. If the buffer retains only a fixed-length string, entering a longer string overwrites other memory storage units, causing the operating system to terminate the application forcefully.

4.2 How to find this kind of problem

This test is done through a GUI control (such as a text box), or through the parameters of an API call, when the application allows the input of letters and numbers.

First, figure out the length of the input field you want to test, and enter the maximum string test.

Enter a string longer than the maximum string, the application may have an error message indicating that it is not allowed, or a longer string is entered to crash the application.

4.3 Summary of test methods

Application: The place where character input is to be accepted.

Test method: Enter the maximum string or enter a string longer than the maximum string, depending on the specific situation of the software being tested.

Test the Knowledge Reserve: Discuss with the developer as much as possible to understand and determine the reasonable length of the input domain.

5. Enter the legal data combination that generates the error

5.1 Causes of defects

Test a combination of multiple input values, each of which has been individually tested, but the combination of these values may affect each other and cause the software to fail.

5.2 How to find this kind of problem

The first step is to determine which input combinations to test and to figure out the "relationship" between them. If you have any of the following features, you can think of these variables as having a "relationship".

Describes the properties and content of a single internal data structure. For example, Input Panel requires the user to enter "Rows" and "columns" of the list, when the tester enters the attribute "rows and columns" of a single internal data structure list.

Used together in a calculation, that is, to use multiple inputs as an internal computation operand, so these input variables have a mutual "relationship".

5.3 Summary of test methods

Application: There is a dependency between the input values.

Test method: Enter a combined value that may be problematic.

Test the Knowledge Reserve: As many properties and content of internal data structures as possible, and discuss with the developer to determine the input data values.

6. Produce various possible outputs of the same input

6.1 Causes of defects

The situation in which a single input produces multiple outputs is related to the previous input and the state of the system under test. For example, if you click the Close button in a word-processing program, if the file is edited and not saved, the program will prompt you to save the file. If the file has been saved, the file is closed directly.

6.2 How to find this kind of problem

Testers must have knowledge of the business aspects of the system software under test and have a variety of program documentation to determine what output an input can produce. A list of program inputs and outputs can be listed accordingly, and then tested.

6.3 Summary of test methods

Application: The same input corresponds to multiple output cases.

Test method: Test each output corresponding to the input.

Test Knowledge Reserve: Fully understand the content of the requirements specification and find out the relationship between input and output.

7. Output that does not conform to business rules invalid output

7.1 Causes of defects

Sometimes the developer may not be aware of the business, and some of the problems are smattering, so the written software will produce a problem that does not conform to the business logic. In the vast majority of cases, developers ignore input that does not follow the general rules, and if these special cases are not programmed, the software produces incorrect results.

7.2 How to find this kind of problem

Testers should try to learn as much as possible about the area of the problem involved.

Sometimes after enumerating the invalid outputs, it is difficult to know which input combinations can force the output to occur. At this point the tester must first determine which inputs are relevant to the output, and then test them with the input combinations that produce unexpected results, paying attention to the order of input execution, which may result in different orders. If an invalid output cannot be enforced, the software does not have this flaw.

7.3 Summary of test methods

Application: Enforces knowledge that does not conform to the business context.

Test method: Enumerate all the invalid outputs and test them individually.

Test Knowledge Reserve: Fully understand the contents of the requirements specification, familiar with the industry background knowledge.

8. Output Properties Modified results

8.1 Causes of defects

The output often has modifiable properties, such as color, shape, dimensions, and size, that users can modify. In this case, the developer must encode, set an initial or default property value, and then encode to allow the user to edit these properties. When the user changes these attributes, the values of the corresponding variables in the interior change, and when they are processed again, the values are not restored to their default values, and the output properties are forced to change.

8.2 How to find this kind of problem

The test method can be used in those functions where the output is editable and modifiable. The tester first has to carefully understand the output that can be produced, especially the output with editable properties. The tester's task is to force each output to be produced, edit its properties, and then force the output to produce again.

8.3 Summary of test methods

Application: The result of the output can be obtained by modifying the properties of the user.

Test method: Forces each output to produce and edit its properties, and then forces the output to be generated again.

Test Knowledge Reserve: Fully understand the content of the requirements specification and understand the outputs that can be produced.

9. Screen refresh Display

9.1 Causes of defects

Usually GUI software creates a refresh problem because the GUI must refresh the screen to make the object appear again when it overwrites, moves, and resizes the window. However, if you refresh frequently, it is easy to slow down the application, and if you do not refresh, it will affect the user's use of the program, so that the user must stop working and find a way to refresh to continue to work. So developers sometimes don't really know when to refresh and how much area to refresh, which is a disturbing refresh problem.

9.2 How to find this kind of problem

The way to test the refresh problem is to add and remove objects that are called on the mobile screen, which will cause some objects to be displayed again. Failure to re-display correctly and in a timely manner results in a software defect. We can check the refresh by following several methods:

Moves the object from the starting position. Move a bit first, then increase the moving amplitude, move it one or two times, and then move it multiple times to ensure that all areas are covered.

A little overlay begins at the boundary of the overridden object, causing one of the objects to obscure one object.

Use different types of objects. If your application supports multiple types of objects, such as text objects, graphic objects, and so on, mix the different objects together.

9.3 Summary of test methods

Application: One object is contained in another object, and a refresh problem may occur when dragging a contained object.

Test method: Add, delete, and move objects on the screen.

Test Knowledge Reserve: Fully understand the contents of the requirements specification and understand the relationship between the objects in the program.

10. Data structure Overflow

10.1 Causes of defects

There is an upper limit on the size of all data structures. Some data structures gradually increase in length to fill the machine memory capacity or disk space, while other data structures have a fixed upper limit. Developers often encode the contents of the data structure, forgetting the physical limitations of the structure itself.

10.2 How to find this kind of problem

Determine the bounds of the data structure and try to enter too many values into the data structures. Special attention should be paid to the bounds of the data type boundary 256, 1024, 32768, and so on overflow test.

For underflow testing, you can try to delete more data, such as when the structure is empty, try to delete it again, or add a data to try to delete two data.

10.3 Summary of test methods

Application: An array exists in the program.

Test method: Try to import too many values into the data structure, test overflow, and for underflow testing, you can try to delete more than one data.

Test knowledge Preparation: Fully understand the content of the requirements specification and determine the boundaries of the data structure.

11. Data structure does not conform to constraints

11.1 Causes of defects

Internal data structures are constrained during programming, including size, number of dimensions, type, shape, location on the screen, and so on. The focus of our testing is on the properties that users can set, which are constrained by a set of parameters. Constraints on data properties are checked at any moment when a data item is created and subsequently modified on the data item. The modified code in the initialization code has errors, when the error is modified only to modify the initialization part, and ignore the other parts of the modification, so that its modification is incomplete, not complete.

11.2 How to find this kind of problem

Confirm the candidate data and list the properties that it can modify. Lists the allowable ranges, constraints, and so on for each attribute for valid values.

Determines the functional location of all modifiable properties.

Initializes the data, changing each property to determine whether the constraint is correct.

If data constraints are compromised, it can cause the system to crash or behave as a response time delay, incorrect information, and invalid output with incorrect data.

11.3 Summary of test methods

Application: There is a constraint on the data structure within the application.

Test method: Destroys the constraints of the internal data structure.

Test Knowledge Reserve: Fully understand the contents of the requirements specification and determine all constraints on the internal data structure.

12, the operand does not match the operator

12.1 Causes of defects

Almost every operator has an operand that is not valid, and for specific operators, developers must write error-checking code when they use them. For example, divide the problem by zero.

12.2 How to find this kind of problem

Find the calculation (that is, the operator) of the data contained in the program or the input (that is, the operand), the mathematical expression (the combination of operators and operands), and the operation of the graph. In addition, combining multiple operands is more prone to errors. For example, the "+" operator can be used for both characters and numbers. The characters are connected by "+" to a string, and the number is "+" for the addition operation. If the system attempts to add characters and numbers together, that is, conflicting actions can cause the software to fail.

12.3 Summary of test methods

Application: A program or graphical operation that requires numerical calculation.

Test method: For the numerical calculation to consider the relationship between the operand and the operator, for the graphical calculation also consider the combination of various input data.

Test Knowledge Reserve: Master the requirements of operators in the tested software. Master the different valid and invalid range of values for different operators and operands.

13, recursive call itself

13.1 Causes of defects

Functions sometimes recursively call themselves, and if there is no limit to the number of executions, there is a problem with recursion, which constantly calls itself, quickly consumes machine resources, and eventually overflows, causing the program to crash or hang. The main reason for this type of problem is that developers do not have the code to guarantee the termination of loops and recursive calls, usually at the beginning or end of a loop.

13.2 How to find problems

Look for features in the software that can use recursive calls. You can then make a list of the features in the software that might embed recursion, and then refer to yourself to check to see if the program is working correctly.

13.3 Summary of test methods

Application: Where you need to interact with other objects.

Test method: Consider the object's self-interaction or replication.

Test the Knowledge Reserve: Master The requirements of the software under test.

14, the Calculation results overflow

14.1 Causes of defects

When all inputs and data are valid, the final result of the calculation can also be invalid. All variables have a range of values, and sometimes developers forget to check those caps when they perform calculations.

14.2 How to find this kind of problem

Perform calculations over and over again or use large or small inputs and data to focus on testing values near the initial or boundary values of the data type.

14.3 Summary of test methods

Application: The application performs calculations that export the results to be generated and store them internally.

Test method: Force the data to produce overflow or underflow.

Test Knowledge Reserve: Master The requirements of the tested software, and understand the upper and lower limits of the calculated variables.

15. Data sharing or correlation function calculation error

15.1 Causes of defects

There are usually no pitfalls when testing isolated features, and many software flaws can occur when you combine separate functions with other features in the same software. This flaw is often caused by the use of shared datasets in two or more functions, and each feature allows different ranges of data to be used. For example, a feature might set a data item to a specific size, but another feature would allow the data item to be larger than the first function's processing power. Developers simply do not consider that the data item can be modified at other functions, they just encode to ensure the legitimacy of the data in the function, and when the data is used, there is no re-coding to check the scope can be used, and at this time, another function modifies the shared data, when the use of this data will create a flaw.

15.2 How to find this kind of problem

This method can be used to test when an application completes more than one function at a time, or when more than one function is running at the same time. Use one function to influence the calculation of input, input data, or another function. Before testing, determine which features are interdependent or share data:

can apply each function as input. If these functions have overlapping input fields, there may be an interaction problem.

There is a similar output generation function. If some functions combine to produce a single output, there is a relationship between these components and should be tested together.

A function is included in the calculation of another function. For example, to test the mouse to select the function of the object, not only to measure the mouse to select the text on the screen function, you can also include hyperlink text, bold, italic, symbols and graphic elements together to test the mouse to select the functions of these elements.

15.3 Summary of test methods

Application: More than one function is running at the same time.

Test methods: Take a point-and-click Approach to test a feature and test it with other features that may be connected to the feature.

Test the Knowledge Reserve: to master the requirements of the software under test, before testing the function of the dependency between the relevant to grasp, in addition to the sharing of data to be mastered.

16, File system overload

16.1 Causes of defects

Developers may forget to write code to handle the full state of the file system, ignoring the error-checking code for operating system APIs such as Createfile,writefile, without which the API call will fail when the full state of the file system is displayed. The software crashes without warning.

16.2 How to find this kind of problem

Create a full-capacity or nearly full-capacity file system, and then force a variety of operations to access the file system through input or output, or open enough files to force a copy of the backup created when the file is opened, thereby consuming double the amount of storage that will reach a certain level of capacity for that system. You can then test the ability of the application to handle the file system in an overloaded state. (typically implemented through disk quotas)

16.3 Summary of test methods

Application: The system is large, the operation needs larger space.

Test method: Force the disk System full capacity or capacity is less than equal to the measured software run time required capacity, run the tested software or use test tools to simulate the disk condition.

Test the Knowledge Reserve: Master The requirements of the software under test, and understand the ability of the software under test to handle the overloaded state of the file system.

17. Media is busy or unavailable

17.1 Causes of defects

When multiple applications access the hard disk (or other memory) at the same time, the operating system slows down to provide a multi-request service, and the application must be programmed to handle these delays, and applications that do not respond to these errors will get an error when the latency becomes very long.

17.2 How to find this kind of problem

By launching a large number of applications, forcing them both to open and save the file so that the file system can handle the busy state, or to download a large number of files at the same time to make the background crowded; Check that the tested software can handle this situation correctly, the application should give an error message or wait for instructions, prompting the user is processing

17. 3 Summary of test methods

Application: The application needs to run a lot of memory or the runtime requires other related software to run concurrently.

Test method: Start a large number of programs or use test tools to simulate disk status.

Test Knowledge Reserve: Fully grasp the requirements of the software under test, and understand the requirements of the system under test software operation.

18. Media Damage

18.1 Causes of defects

Damaged media may cause the operating system to pass back the error code, which is not programmed in the application.

The operating system cannot detect all such errors, and the operating system itself has errors or damaged media that are damaged by some operating systems.

18.2 How to find this kind of problem

Use damaged media, such as scratches, dust, magnetic interference, etc. Check the application's ability to handle errors, the application can process the error or tell the user about the problem, and make sure that the user data file is not lost or corrupted.

18.3 Summary of test methods

Application: The application has higher security requirements and higher requirements for disaster recovery.

Test method: Test the application with the actual method of damaging the media.

Test Knowledge Reserve: Fully grasp the requirements of the software under test, and understand the requirements of the system under test software operation.

19. File name is not valid

19.1 Causes of defects

The operating system itself has its own file naming specification, for example, the 8.3 format of DOS. In Windows, the file name cannot be more than 255 characters, and the file name cannot contain/\: < >? * | These 8 characters and the operating system reserved words for aux, COM1, COM2, COM3, COM4, CON, LPT1, LPT2, LPT3, LPT4, nul, and PRN.

Developers use different rules in the application to manage file names, and problems occur when the application and operating system use a file name naming convention that is inconsistent.

19.2 How to find this kind of problem

Save the file as the operating system does not allow the file name, for example, the file name contains/\: < >? * | These 8 characters, test whether the application does not allow you to enter a file name that contains these characters.

Enter the file names that some applications do not allow, for example, using long, potentially interacting characters that contain special characters as file names, to check that the application recognizes the file.

19.3 Summary of test methods

Application: Almost all applications that involve the ability to enter a file name.

Test method: Enter filenames not allowed by the operating system and file names that the application does not allow.

Test Knowledge Reserve: Master The requirements of the tested software and understand the requirements of the operating system and applications for file names.

20. Change file access rights

20.1 Causes of defects

In the operating system, you can set different users to have different access rights to different files (such as read-write, read-only, and so on). The programmer must consider access to the file in functions that access the file, such as checking the access rights of the file before each file is written. If you do not check, you will cause the program to fail. In addition, if the file access fails, the programmer must have the correct error code to ensure that the program can correctly capture the resulting error.

20.2 How to find this kind of problem

Open two applications and close the same file. For example, installing a different version of the same application on the same machine, opening and closing the same file in a different version of the application, or trying to open a file that is already open in another program in one application can cause conflicting file access rights.

Open a file to modify the access rights of the file in the operating system. Some operating systems allow users with high permissions to control files that are already open by the general user.

20.3 Summary of test methods

Application: An application that requires read and write operations to the file.

Test method: Modify file access permissions or use a low-privileged user to access the file.

Test Knowledge Reserve: Master The requirements of the tested software and understand the permissions required to read and write files.

21. Damaged File Contents

21.1 Causes of defects

Developers write code to read and write files, they also write code to invoke system APIs to get file pointers, and to open and close files. For some reason, these system APIs fail or pass back the return value of the exception. If the developer does not write code to verify the expected return value returned, the application fails because it cannot handle the exception.

21.2 How to find this kind of problem

Corrupt files manually. Edit the file format and content by starting with a complete file that the application has created.

Use the Test tool. Simulates a CRC (cyclic redundancy check) error, or forces the file API to return an invalid return code.

21.3 Summary of test methods

Applications: Applications that require validation of file formats and content.

Test method: Manually damage files or use test tools to simulate CRC errors.

Test Knowledge Reserve: Fully grasp the requirements of the software under test, understand the need for file read and write permissions.

[Reprint] Software functional testing 21 failure models

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.