当前位置:网站首页>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 !!!
边栏推荐
- 如何防止你的 jar 被反编译?
- Construction and maintenance of business websites [10]
- Jar package startup failed -mysql modify the default port number / set password free enter
- [shutter] shutter page Jump (route | navigator | page close)
- A river of spring water flows eastward
- China Indonesia advanced wound care market trend report, technological innovation and market forecast
- *C language final course design * -- address book management system (complete project + source code + detailed notes)
- Go web programming practice (2) -- process control statement
- MySQL learning record (3)
- Research Report on market supply and demand and strategy of China's plastic pump industry
猜你喜欢
Baidu sued a company called "Ciba screen"
[shutter] statefulwidget component (create statefulwidget component | materialapp component | scaffold component)
*C语言期末课程设计*——通讯录管理系统(完整项目+源代码+详细注释)
PIP audit: a powerful security vulnerability scanning tool
LandingSite eBand B1冒烟测试用例
[zero foundation I] Navicat download link
Off chip ADC commissioning record
Welfare, let me introduce you to someone
基本IO接口技术——微机第七章笔记
D4:非成对图像去雾,基于密度与深度分解的自增强方法(CVPR 2022)
随机推荐
Golang embeds variables in strings
[shutter] shutter layout component (opacity component | clipprect component | padding component)
China's noise meter market trend report, technical dynamic innovation and market forecast
Cardinality sorting (detailed illustration)
如何访问kubernetes API?
MySQL learning record (4)
Accounting regulations and professional ethics [18]
【剑指 Offer 】56 - II. 数组中数字出现的次数 II
Construction and maintenance of business websites [8]
[shutter] statefulwidget component (image component | textfield component)
Gbase 8s database basic syntax
Construction and maintenance of business website [5]
[dynamic planning] p1220: interval DP: turn off the street lights
GEE:(二)对影像进行重采样
Etcd Raft 协议
Research Report on market supply and demand and strategy of China's plastic pump industry
Unexpectedly, there are such sand sculpture code comments! I laughed
Research Report on right-hand front door industry - market status analysis and development prospect forecast
Huawei Hongmeng watch achieves fireworks display effect on New Year's Eve
MySQL learning notes (Advanced)