How to write test cases for functional testing

The writing of test cases needs to be carried out according to a certain idea, rather than thinking about where to write. Generally, companies with mature testing mechanisms will have their own custom test case templates and a complete set of test process concerns. Of course, we are testing You should also accumulate a set of your own testing framework in your career. All functional tests can be carried out according to the framework's ideas to achieve twice the result with half the effort.

The functional testing framework may include: interface friendliness testing, functional testing, link testing, fault tolerance testing, stability testing, general performance testing, configuration testing, algorithm testing, etc.

1.1.1 Interface friendliness test

1. Whether the style, style, and color are coordinated.
2. Whether the interface layout is neat and coordinated (make sure that all are displayed, and try not to use scroll bars
3. Whether the interface operation and title description are appropriate (the description is ambiguous, pay attention to whether there are typos)
4. Whether the operation conforms to people’s regular habits (is there any controls with similar functions put together for easy operation)
5. Whether the prompt interface conforms to the specification (cancel and ok in English should not be displayed, but confirmation in Chinese should be displayed, etc.)
6. Interface Whether each control is aligned
7. Whether the date control can be edited
8. Whether the length of the date control is reasonable, subject to the fact that all the time can be displayed when modifying
9. Whether the column width of the query result list is reasonable, and whether the label description is reasonable
10. Query results The list is too wide and there is no horizontal scrolling prompt
11. For the text with relatively long information, does the text box provide an automatic vertical scroll bar
12. Is the data entry control convenient
? 13. Does it support the Tab key, and the order of the keys must be organized and not messy Jump
14. Are there relevant hotkeys provided
? 15. Are the prompts and descriptions of the controls correct? 16. Are the module calls unified, and are the same
modules calling the same interface ? . The correct format of the date should be XXXX-XX-XX or XXXX-XX-XXXX:XX:XX 19. Whether there are redundant buttons or labels on the page 20. Whether the window title or icon is consistent with the menu bar 21. Maximization of the window, Whether the minimization can be switched correctly 22. For normal functions, users can use them without reading the user manual






23. When performing risky operations, are there prompts for confirmation, deletion, etc.
24. Is the order of operations reasonable? 25.
Correctness check: Check the form, button, table, header, footer, prompt information, and other spellings and sentences on the page Is the grammar etc. correct.
26. The system should give a warning and prompt information before the user performs a wrong operation.
27. Check the page resolution, browse the system at various resolutions to check the friendliness of the system interface.
28. Reasonability check: After performing delete, update, add, cancel, back and other operations, check whether the page returned by the information is reasonable.
29. Check whether the localization is passed: the English version should not have Chinese information, and the English translation is accurate and professional.

30. Background grayscale freeze

1.1.2 Function test

1. Test with all default values

2. According to the content described in all product documents and help documents, the traversal test should be performed

3. Input judgment

4. The logic of yes and no in all interfaces needs to be tested

5. Exception handling

6. Sensitive words

7. Traverse all flow chart paths according to the flow chart of the requirements document

8. According to the content of the program, the logical point of traversing the if elif else switch needs to be traversed

9. Test various controls on the interface

For example, for the input box test:

1. Character input box:

1. Character input box: English full-width, English half-width, numbers, empty or space, special characters "~!@#¥%...&*?[]{}" pay special attention to single quotation marks and & symbols. When direct input of special characters is prohibited, use the "paste, copy" function to try to input.

2. Length check: minimum length, maximum length, minimum length -1, maximum length +1, input extra characters such as copying the entire article.

3. Space check: there is a space between the input characters, there is a space before the character, there is a space after the character, there is a space before and after the character

4. Multi-line text box input: Allow carriage return and line feed, after saving, display the format that can save the input, only enter carriage return and line feed, check whether it can be saved correctly (if yes, check the saving result, if not, check whether there is a normal prompt ),

5. Security check: input special strings (null, NULL,, javascript, <script>, </script>, <title>, <html>, <td>), input script function (<script>alert(" abc")</script>), doucment.write("abc"), <b>hello</b>)

2. Numeric input box:

1. Boundary value: maximum value, minimum value, maximum value +1, minimum value -1

2. Number of digits: minimum digit, maximum digit, minimum digit-1 maximum digit+1, input super long value, input integer

3. Abnormal value, special character: input blank (NULL), space or "~!@#$%^&*()_+{}|[]\:"<>?;',./?;:' -= and other characters that may cause system errors, when direct input of special characters is prohibited, try to use paste copy to check whether it can be submitted normally, the special function in word, copy to the input box through the clipboard, page break, section break are similar to formulas Subscripts, subscripts, etc., special symbols of numerical values ​​such as ∑, ㏒, ㏑, ∏, +, -, etc.,

Input negative integers, negative decimals, fractions, input letters or Chinese characters, decimals (if the 0 point before the decimal is rounded off, if there are multiple decimal points), the number with the first digit as 0 such as 01, 02, whether scientific notation supports 1.0E2, Full-width numbers and half-width numbers, mixed numbers and letters, hexadecimal, octal values, currency input (allow several digits after the decimal point),

4. Security check: copy if not directly input

3. Date input box:

1. Legality check: (input 0 day, 1 day, 32 day), month input [1, 3, 5, 7, 8, 10, 12], day input [31], month input [4, 6, 9 , 11], day input [30] [31], input non-leap year, month input [2], date input [28, 29], input leap year, month input [2], date input [29, 30], month input [0, 1, 12, 13]

Consider the start date compared to the end calendar, especially when querying.

2. Abnormal values, special characters: input blank or NULL, input ~! @#¥%...&*(){}[] and other characters that may cause system errors

3. Security check: If you cannot directly input, just copy. Is there a data verification error?

1.1.3 Business process test (main function test)

The business process generally involves the data of multiple modules, so when testing the business process, first of all, it is necessary to ensure the correctness of the function of a single module, and secondly, it is necessary to test the data transmitted between each module, which is often prone to problems When testing, different data must be designed for testing.

If a functional module has the most basic addition, deletion, modification and query functions, the following tests are required:

1. Single function test (addition, modification, query, deletion)

2. Increase --> increase --> increase (continuous increase test)

3. Add --> Delete

4. Add—>Delete—>Add (the newly added content is consistent with the deleted content)

5. Add—>Modify—>Delete

6. Modify --> Modify --> Modify (continuous modification test)

7. Modify --> Add (the newly added content is consistent with the content before modification)

8. Modify --> Delete

9. Modify --> Delete --> Add (the newly added content is consistent with the deleted content)

10. Delete——>Delete——>Delete (continuous deletion test)

1.1.4 Link Test

It is mainly to ensure the availability and correctness of links, which is also an important aspect in website testing.
Link testing can be done using specific tools such as XENU.

1.1.5 Fault tolerance test

1. Enter data that is not allowed by the system as input

2. Stop a related module or subsystem to verify the impact on the current system

3. The configuration file is deleted or configured incorrectly

4. Database injects wrong data

1.1.6 Stability test

1. The system runs continuously (7*24), verifying whether there is a memory leak or other system resources leak

2. If it is urgent to go online, you can run for one night or two days on weekends.

Generally, under high pressure, problems with the number of database connections and memory leaks will be exposed relatively quickly, but deadlocks may not be reflected, so it depends on the importance of the system. For example, the stability of 12306 is best for 7*24 hours

1.1.7 Routine performance test

1. Connection speed test

The speed at which users connect to the Web application system varies according to the way they access the Internet. They may use dial-up or broadband Internet access. Users can wait a long time when downloading a program, but not if only visiting a page. If the web system takes too long to respond (for example, more than 5 seconds), users will leave due to impatient waiting.
In addition, some pages have a timeout limit. If the response speed is too slow, users may need to log in again before they have time to browse the content. Moreover, if the connection speed is too slow, it may also cause data loss, so that the user cannot get the real page.

2. Load testing

Load testing is to measure the performance of the web system at a certain load level to ensure that the web system can work normally within the required range. The load level can be the number of users accessing the web system at the same time at a certain moment, or the number of online data processing. For example: How many users can the web application system allow to be online at the same time? What happens if this amount is exceeded? Can the web application system handle a large number of user requests for the same page?

3. Stress test

The load test should be arranged in the actual network environment after the release of the Web system. Because an enterprise's internal staff, especially the project team, is always limited, and the number of requests that a web system can handle at the same time will far exceed this limit, so the result is only correct if it is placed on the Internet and subjected to load testing Believable.
Stress testing refers to actually destroying a Web application system and testing the reflection of the system. Stress testing is to test the limitations and fault recovery capabilities of the system, that is, to test whether the web application system will crash and under what circumstances it will crash. Hackers often serve erroneous data payloads until the web application crashes, then gain access when the system restarts.
Areas for stress testing include forms, login and other information transfer pages, etc.

1.1.8 Usability testing

1. Whether the controls on the system interface can be traversed through the tab key, and the order is reasonable

2. Whether the entrance and operation of the main functions are easy to understand

3. Whether the layout of the interface is reasonable and whether the functions are easy to find and use

4. Operation steps

5. Operating habits

6. There are sufficient reminders, and the text description of the information is accurate

1.1.9 Compatibility testing

Compatibility testing not only refers to the compatibility of the interface under different operating systems or browsers, some functional tests also take into account compatibility,
including operating system compatibility and application software compatibility, and may also include hardware compatibility,
such as involving ajax, For technologies such as jquery and javascript, compatibility issues under different browsers must be considered.

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey, and I hope it can help you! Partners can click the small card below to receive

Guess you like

Origin blog.csdn.net/kk_lzvvkpj/article/details/131789550