当前位置:网站首页>About test cases
About test cases
2022-07-02 21:44:00 【Building Zzzz】
Test column
One . The basic elements of test cases
1. What is a test case
This has already been said before , For details, see The basic concept of software testing This blog , Here is a brief introduction : A test case is a set of sets initiated to the system under test , Include Test environment , testing procedure , Test data , Expected results !
2. Why do software testers write test cases ?
Here are several reasons :
- The test case is Basis for test execution ;
- The test case You can reuse , There is no need to rewrite it when doing regression testing ;
- Test cases can Measure demand coverage ;
- Future generations can learn from ;
- The manual test case is The basis of automated testing
Two . Design method of test case
1. Design test cases based on requirements
Requirements are the basis for testers to test , Testers analyze requirements , Verify the rationality and correctness of the requirements , No ambiguity , Extract test items from requirements , Further subdivide according to the test items , Extract the test data , To write test cases , There can be the following considerations :
- from The interface starts to test ( accord with UI Design draft );
- Verify the function of the software , Wear business-related functions for testing ( Relevant functions ), Instead of focusing on an isolated function ;
- A different function Input Different from the corresponding Output ;
- Interaction between functions ( The interaction between different roles in the same system is similar to that between sellers and buyers );
- Abnormal function test ;
- Functions used Verification of Algorithm ( This needs to look at the code level );
- from Ease of use , Compatibility performance Wait for several aspects to consider .
- Non functional testing : Non functional testing is to make some restrictions on the functions of the software itself , Non functional tests mainly include Ease of use , Compatibility , performance , Security , Portability , reliability , Maintainability ; In addition, different applications have different requirements for these non functionality :
Suppose it's client-side software , Be similar to Word, For performance , Security requirements are generally not too high , For compatibility , Portability , The stability will be relatively high ;
Suppose it's software for the enterprise , Similar to flying book , Its compatibility with , Performance requirements are not very high , But for functionality , Reliability requirements will be very high ;
Suppose it is large-scale commercial software , Similar to wechat ,QQ, Its impact on performance , Compatibility , reliability , Portability , Security requirements will be very high !
So for different software , Its non functionality is also different !
2. Methods of designing test cases
2.1. Equivalence class
We can input ( Output is considered only under special circumstances ), Divide the input into several equivalent classes , Then select one or more test cases from each equivalent class to test , If this test case passes , Let's say that the equivalence class represented by this test case passes ! In this way , We can solve the situation that the test cases cannot be exhausted !
In addition, equivalence classes can also be divided into effective equivalence classes ( A data set that meets the data specifications of user needs ) And invalid equivalence classes ( Data sets that do not meet the data specifications of user needs ), And if you test , Both valid equivalence classes and invalid equivalence classes need to be tested , Guarantee " Be on the safe side "!
Do a simple exercise : Suppose a user name is required 6-15 Its character type is A-Z Case insensitive :
Effective equivalence class :6~15 Upper case characters ,6 ~15 Lowercase letters .6 ~ 15 Mixed case
Invalid equivalence class : Less than 6 Characters , Greater than 15 Characters ,6 ~ 15 Other characters , Numbers + Letter , Numbers + Special characters , Special characters + Letter
2.2. The boundary value
in the light of The boundary between input and output is used to design test cases , The assumption is 6 ~ 15 position ,5 unqualified ,6,7 qualified ,14,15 qualified ,16 unqualified ; Therefore, the boundary value is not only the value on the boundary of the region , And take the values on both sides of the boundary , In addition, boundary values and equivalence classes are combined to design for testing !
2.3. Wrong guess
This method is mainly According to the tester's experience , And the accumulation of knowledge , guess Is there a problem with a certain function , Write targeted test cases , This is a detective test , More targeted , Rely more on the personal level of the tester , For example, the space problem in the search box , You need testers to do guessing tests !
2.4. Scene method
Many different scenarios of software , Is based on the triggering of different events , Triggering of different events , Lead the scene to different event flows , and Different function points are strung together to form a scene , Different function points have different outputs , Different outputs lead to different test scenarios , Here we can simulate a ATM Withdrawal scenario : Card insertion – Input password – Enter the withdrawal amount – Withdraw money – Withdraw card , Then there can be many test cases according to each function :
- Card insertion : Insert the wrong card ( Various other cards , Non bank card ), The card is inserted backwards , Non bank card , The magnetic stripe of the bank card cannot be recognized , The card is damaged , Card number is frozen , The account is locked , The network is not good , Can't recognize …
- Input password : Confirm directly without entering the password , Enter the wrong password , Enter the wrong password , The password was entered incorrectly more than three times , The account , Whether the password input box supports deleting input , Test whether the password is encrypted …
- Enter the withdrawal amount : Enter the amount of money less than the card balance , Enter the amount of money greater than the card balance , Enter the amount of money equal to the card balance , Do not enter whether the withdrawal button can be executed …
- Withdraw money : Enter the amount of money less than or equal to the card balance, and the withdrawal is successful , Enter the amount of money greater than the card balance, and the withdrawal fails and the balance is insufficient , Exceed the upper limit of daily withdrawal balance , Exceed the maximum number of withdrawals per day …
- Withdraw card : Return the card normally after withdrawing money , Operation timeout swallowing card …
- ATM machine :ATM Everything is all right ,ATM The machine is abnormal (ATM Lack of balance ,ATM The machine is powered off , Broken net , Hardware failure , The software system crashed ) Unable to perform the above functions , Abnormal situation ATM Whether the machine supports transaction rollback …
The above are just some simple test points , Not specific test cases , If test cases , Need to be more specific , And this is the specific use of the scene method !
2.5. Cause and effect diagram
Cause and effect diagram is a kind of Logic diagram , Identity , And , or , Not , Use cause and effect diagram to design test cases , It's called cause and effect diagram , Its usage scenarios : When we have a lot of input , Different inputs or different combinations of inputs have different outputs , At this point, we can use the cause and effect diagram method to design test cases , Let's take a look at various cause and effect diagrams :
Identity :
And : When multiple different inputs are true , The output is true ( It is similar to having a car and a house -> Marriage is not allowed in other situations , But other situations also need to be considered ):
or : Multiple inputs, one of which is true , The output is true ( It's similar to having a car and a house. If one of them is true, he can get married , But other situations also need to be considered )
Not :
And cause and effect diagram Steps for designing test cases :
- Analyze all inputs and outputs ;
- Find the relationship between input and output ;
- Draw a cause and effect diagram according to the relationship picture ;
- Draw a decision diagram according to the causal picture ;
- Write test cases according to the decision diagram ~
2.6. Orthogonal method
Design test cases according to the orthogonal method , It's from A lot of experimental data ( Test data ) To get the best combination of data according to the orthogonal principle , According to the results of the optimal data combination test , To analyze the results of the whole test , This is not used much , Therefore, there is no more introduction !
That's all about test cases , Test cases are very important for testers , Therefore, we must practice more , Use these methods to construct test cases !!!
边栏推荐
- Pip install whl file Error: Error: … Ce n'est pas une roue supportée sur cette plateforme
- Plastic granule Industry Research Report - market status analysis and development prospect forecast
- Download vagrant box file locally from Atlas and configuring it
- Micro SD Card Industry Research Report - market status analysis and development prospect forecast
- [shutter] statefulwidget component (floatingactionbutton component | refreshindicator component)
- Jar package startup failed -mysql modify the default port number / set password free enter
- 如何防止你的 jar 被反编译?
- Research Report on micro gripper industry - market status analysis and development prospect prediction
- One week dynamics of dragon lizard community | 2.07-2.13
- VIM command-t plugin error: unable to load the C extension - VIM command-t plugin error: could not load the C extension
猜你喜欢
Error in PIP installation WHL file: error: is not a supported wheel on this platform
Redis分布式锁故障,我忍不住想爆粗...
Structure array, pointer and function and application cases
tinymce可视化编辑器增加百度地图插件
The web version of xshell supports FTP connection and SFTP connection [detailed tutorial] continued from the previous article
Browser - clean up the cache of JS in the page
Welfare, let me introduce you to someone
Pip install whl file Error: Error: … Ce n'est pas une roue supportée sur cette plateforme
[shutter] shutter layout component (physicalmodel component)
Capacity expansion mechanism of ArrayList
随机推荐
PIP audit: a powerful security vulnerability scanning tool
Huawei Hongmeng watch achieves fireworks display effect on New Year's Eve
tinymce可视化编辑器增加百度地图插件
MySQL learning record (8)
Error in PIP installation WHL file: error: is not a supported wheel on this platform
[dynamic planning] p1220: interval DP: turn off the street lights
MySQL learning record (7)
Research Report on market supply and demand and strategy of China's atomic spectrometer industry
2019 Nanchang (relive the classic)
Construction and maintenance of business website [2]
China's Micro SD market trend report, technology dynamic innovation and market forecast
Accounting regulations and professional ethics [17]
Research Report on plastic antioxidant industry - market status analysis and development prospect forecast
China plastic bottle market trend report, technological innovation and market forecast
Market trend report, technical dynamic innovation and market forecast of China's low gloss instrument
[shutter] statefulwidget component (pageview component)
Three chess games
[Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology
[shutter] statefulwidget component (bottom navigation bar component | bottomnavigationbar component | bottomnavigationbaritem component | tab switching)
[shutter] shutter layout component (opacity component | clipprect component | padding component)