当前位置:网站首页>How testers write functional test cases
How testers write functional test cases
2022-06-25 21:19:00 【Star snow】
Catalog
Principle one : Heavy logic , Tap
Principle three : Avoid using use cases as base requirements
Principle four : Standing on the user's side does not mean giving up business
Principle 5 : Test point is not equal to test step
Principle six : Where to come from , Remember to come back
Principle seven : The types of tests should not be confused
Principle eight : Use case design is also formatted
If you are a newcomer to the testing industry , The first thing is to learn to write test cases , Test cases include functional use cases 、 Interface use cases, etc , Today, let's focus on functional use cases .
1 Select tool
The tools most companies use to write functional use cases are xmind, It is a mind mapping tool , It's more convenient to use , There are many shortcut keys to use , Than traditional excel More concise , I recommend you to use xmind8, It's free. , Others are charged , Download address :XMind download
2 Design principles
The use case design principle is high coverage ,90% It covers the scenarios that may be involved in the business , The rest 10% It is added during the test , The reason why we can't reach 100%, Because even if we are familiar with and understand the business well enough , It's hard to think of a comprehensive .
Principle one : Heavy logic , Tap
Many testers write use cases , First of all, write everything you can on the page , What effect does this dot achieve , What effect does that little bit achieve , Finally, let's look at UI, Here we need to align , The picture can't be blurred , So the use case is designed , Obviously not possible , Lack of scenario testing , The more scenes are covered , produce bug The less likely it is . We take a module that we often get “ Shopping cart page ” For example , The shopping cart includes : List of goods 、 payment , It is divided into this 2 A module , Let's take a look at the comparison of two use case designs :


I simply listed , Welcome to add ~
From the above two figures , We can see that , The use cases with obvious scenarios are clearer , More comprehensive , Focus on business logic , Think of scenarios that are relevant to the current test point , We all need to think about , It's not just a click operation .
Principle two : Source first
What is the source , We can use data sources as sources , You can also use the entrance as a source , To put it simply , The module you tested has several entries , Where did the data come from , Let's continue to use the above shopping cart to write use cases :

As shown in the figure , Think about where the data comes from , Put it first in use case design , The first thing to think about is how to deal with data , Where does the data of these pages come from .
Principle three : Avoid using use cases as base requirements
Several interns I have taken , When they start writing use cases , When the first edition was sent to me , It looks like a lot of words at a glance ,xmind There are many, many lines on , The layman seems to think this child paper is good , Very serious , The demand is also comprehensive , An expert looks at , This is not a test case , This is writing requirements , Write the product requirements in three sentences into three use cases , Some even copy the text of the requirements document , This is not called a test case , This is called base demand . Test cases write test points one by one , The test points are scenarios , To put it simply, you need to test what points in the business . for instance , Let's compare :
Batch export , This is what the requirements document says : You can export the data within the current search range , Support real-time export excel Formatted data , The exported data fields include : The order number 、 Exchange code ......


Compare the above two use cases , The obvious difference is that in the first edition, the requirements are split , Changed the presentation format , In the second edition, the requirements are split , What points need to be tested , This makes it much clearer .
Principle four : Standing on the user's side does not mean giving up business
The test session has a sentence that is familiar to my heart : The test should be conducted from the perspective of users . There is nothing wrong with this sentence , It also inspired many testers , It also harmed many testers . The intern I brought , Many of them told me that I should think from the perspective of users , In this way, how do I feel about users , Whenever this time I ask : How many users can you stand on ? Most of the time , From the user's point of view , In fact, it is based on personal usage habits , Your usage may represent 1000 Users , even to the extent that 10000 Users , But you don't represent millions of users , We also don't have the energy and ability to really think about the perspective of these users , Therefore, from the perspective of users, it is not equal to considering users , We should start from the business , Consider its rationality and complexity , For example, a jump can pay , Let the user jump to the settlement desk page three times , It's obviously unreasonable , In the use case design process, we will also encounter such inappropriate requirements , There may be a better way to implement it , It can also be provided to the product through experience suggestions , This is the real user perspective .
Principle 5 : Test point is not equal to test step
Especially in xmind When writing on , Don't talk about a test point in many lines , It must be one test point per line , Hold at most 3 Column left and right , Not more than 5 Column . Remember to use xmind The aim is to be portable 、 distinct , Not writing test steps , Is writing a test point , As a test role , What points need to be considered , If you want to write test steps , There is no need to write on it , Maybe “ ZenTao ” More appropriate , And we are not allowed to spend so much time on the steps , It is reflected in the coverage rate . Take the shopping cart as an example , Edit the shopping cart list :


Principle six : Where to come from , Remember to come back
This principle is quite familiar to us , Everyone who enters the test class should understand this truth , Just like monk Tang took scriptures from the West , Explain where you came from and where you went , But unlike Tang Monk , Remember to go back to the origin , Never go too far , Forget the original intention . In professional terms , To form a use case closed loop .
Take the shopping cart as an example , After knowing the source of the use case , You know where you came from , So where to go , Is to enter the payment link , Jump to the settlement desk , Payment to order page, etc , After these operations are verified , To return to the shopping cart page , Then there are test points at this time : Pay for successful items to be emptied from the shopping cart, etc , This forms a closed-loop link , It will not be missed .
Principle seven : The types of tests should not be confused
Functional test cases focus on business , When many people can't say which points to test , Just test the performance 、 Load tests and so on are also added together , Especially during the interview , This is not to say that these are not functional tests , Just different test types . Many companies , Especially big companies , Performance testing is performed as a single testing strategy , It will not be put in the functional test alone , Whether it is the popular link pressure test or the manual execution of the pressure test script , All are executed on the basis of stable function realization , So try not to confuse .
Principle eight : Use case design is also formatted
Write in the following format , Can guarantee 90% No problem , Try to write :

3 Summary
The use case design is written here , Let me summarize :
- Use case design is the main play of testers
- The design principle never changes , Find the one that suits you according to your personal habits
- Tools are not the point , Use case format should be mastered
Next, I will introduce the implementation principles of use case review and use case implementation in detail , Gradually guarantee product quality from different stages .
边栏推荐
- Introduction to the basics of kotlin language: lambda expression
- Is it legal to open an account for flush stock trading software? Is it safe?
- On dynamic programming
- [nailing scenario capability package] company / Park Digital canteen
- What is API
- Sqlmap for interface security testing
- Volatile qualifier
- What is an app circle of friends advertisement
- Cvpr2019 | the latest cvpr2019 papers are the first to read!
- [nailing scenario capability package] manage the on-the-job / off-the-job situation of employees
猜你喜欢
Online yaml to XML tool
![[nailing scenario capability package] company / Park Digital canteen](/img/72/eb3df1945532c4e7813e15f9cf90c5.jpg)
[nailing scenario capability package] company / Park Digital canteen

How to write an infinite loop
[data recovery in North Asia] a data recovery case in which the upper virtual machine data is lost due to the hard disk failure and disconnection of raid6 disk array

Bank digital transformation layout in the beginning of the year, 6 challenges faced by financial level structure and Countermeasures

The correct way to clear the cache of the computer. The computer will not get stuck immediately after changing. practical

Big end and small end
Uncover n core 'black magic' of Presto + alluxio

How to solve the problem of flash write protection in STM32?

C language soul torture: do you know the difference between the two?
随机推荐
Common optimization of e-commerce server system architecture
Analysis and cleaning of kdevtmpfsi virus content
Patrol script
Shell scripts: Variables
Nmap is simple and practical
Leetcode theme [array] -31- next spread
Legal mix of settlements (utf8mb4_0900_ai_ci, implicit) and (utf8mb4_general_ci, implicit) error resolution
Alicloud disk mounted locally
MySQL trigger
The difference between strcpy and memcpy
Volatile qualifier
Talking about the foundation of function test today
Docker Alpine image installation PHP extension redis
银河证券靠谱吗?开证券账户安全吗?
Is it safe to open an account with qiniu securities?
couldn‘t be accessed by user ‘_ apt‘
New generation engineers teach you how to play with alluxio + ml (Part 2)
Inventory - those automated test interview questions you can't help but know
Online yaml to XML tool
Is it legal to open an account for flush stock trading software? Is it safe?