当前位置:网站首页>Does your project need automated testing?
Does your project need automated testing?
2022-06-29 10:40:00 【Two black】
What is automated testing ?
By way of code , Realize the automatic running of test cases , Evaluate the operation results , And record the test results and abnormal conditions .
Why automated testing ?
Pure manual testing will have a lot of repetitive operations , A waste of time , And frequent regression tests , It costs time and labor , Not only is it inefficient , And it's easy to make mistakes .
automation 、 Advantages and disadvantages of manual testing
Manual testing
advantage :
1、 Not exactly tested by use cases , Sometimes, you may inadvertently find the missing points before , It can be added in time ;
2 、 Sometimes some misoperation , You may also find hidden Bug;
3、 The actual page can also be found through the human eye UI Small differences on the design drawings .
shortcoming :
1、 There are subjective factors , Maybe because of my own cognitive mistakes , Cause use cases to fail , perhaps Bug Not found ;
2、 Regression test and test of addition, deletion, modification and query modules , Mostly repetitive operations , Long time repetitive work is easy to cause boredom , It is easy to cause inefficient use case execution ;
3、 Waste of time and labor costs .
automated testing
advantage :
1、 There are no subjective factors , Completely follow the set test cases , The test results are objective ;
2、 High execution efficiency , Follow the code exactly , No human intervention is needed , Save labor cost ;
3、 Record test results accurately , Automatically count test results .
shortcoming :
1、 some UI On the tiny Bug Not easy to measure ;
2、 During the execution of the use case , If the page reports an error , But it can still be carried out , such Bug I can't find out .
for instance : In the process of adding new addresses , In the process of entering values in an input box , There is an error prompt , But preservation can be preserved normally , such Bug Using automated scripts is not easy to detect , Because this automated use case verifies whether it can be saved successfully , Saved successfully , The code considers the use case successful , No matter what happens in the process .
Modules suitable for automation
Single operation 、 High repeatability
such as : User registration 、 The user login 、 Add address and other modules for adding, deleting, modifying and querying .
This kind of module operation is relatively simple , The result verification is also relatively simple , Automated code reuse is high .
Illustrate with examples : For example, add a new user module , We just need to determine which data can be added successfully , Which data cannot be added , What is the prompt message , Write it in the automated test case .
First, add a user , Write it through automated code ( Some codes are only for explanation ):
def new_user_action(self,name,password,email,phone,address):
self.find_Element(*self.name_loc).clear()
self.find_Element(*self.name_loc).send_keys(name)
self.find_Element(*self.password_loc).clear()
self.find_Element(*self.password_loc).send_keys(password)
self.find_Element(*self.email_loc).clear()
self.find_Element(*self.email_loc).send_keys(email_loc)
self.find_Element(*self.phone).clear()
self.find_Element(*self.phone).send_keys(phone)
self.find_Element(*self.address).clear()
self.find_Element(*self.address).send_keys(address)
self.find_Element(*self.save_loc).click()
Then implement the test cases into each automated test case ( Some codes are only for explanation ):
class new_user_test(NewUserUnit.StartEnd):
def test_new_user_pass1(self):
""" All information is filled in correctly """
po=NewUserPage(self.driver)
po.new_user_action('test1','test1','[email protected]163.com','151XXXXXXXX','XX province XX City ')
self.assertEqual(po.NewUserPass(),' Saved successfully !')
Function.snap_Shot(self.driver,'addSucess1.jpg')
po.clickConfirm()
sleep(2)
def test_new_user_pass2(self):
""" All information is filled in correctly """
po=NewUserPage(self.driver)
po.new_user_action('test2','test2','[email protected]163.com','152XXXXXXXX','XX province XX City ')
sleep(4)
self.assertEqual(po.NewUserPass(),' Saved successfully !')
Function.snap_Shot(self.driver,'addSuccess2.jpg')
po.clickConfirm()
sleep(2)
def test_new_user_fail1(self):
""" repeat of user name , Can not add """
po = NewUserPage(self.driver)
po.new_user_action('test2','test3','[email protected]163.com','153XXXXXXXX','XX province XX City ')
sleep(4)
self.assertEqual(po.duplicationVerify(), ' User name already exists !')
Function.snap_Shot(self.driver, 'addfail1.jpg')
po.clickConfirm()
sleep(2)
def test_new_user_fail1(self):
""" User name is empty , Can not add """
po = NewUserPage(self.driver)
po.new_user_action('','test3','[email protected]163.com','153XXXXXXXX','XX province XX City ')
sleep(4)
self.assertEqual(po.noneVerify(), ' The username cannot be empty !')
Function.snap_Shot(self.driver, 'addfail1.jpg')
po.clickConfirm()
sleep(2)
Because the repetition of the action is high , Just modify the test case , Add functionality using common code .
regression testing
Regression tests do basically the same thing , Every time before the version is updated , All have to do regression tests .
This type of test , After Automation , Each version update can use automated scripts for regression testing , High code utilization , There is no need for repetition and a lot of modification , Basically, a version of code can be used many times , It is very helpful to improve work efficiency , It doesn't take a lot of time to maintain the code .
The elements on the page change less
UI Automated test code , Locate page button 、 Input the position of the box, etc , All of them use element positioning . If the page elements are rarely or almost unchanged , This eliminates the need to frequently modify page element positioning , The maintenance cost of the code is very small .
If the foreground page elements are frequently modified , The page element will not be found when the code is executed , Cause use cases to fail , If you want to use automated testing , You must modify the page element , At the same time, modify the automated test code , Can be executed normally .
Such a module , The frequency of code changes is too high , Modifying the automation code also takes labor , Code maintenance costs are too high , Automation is not recommended .
Automated modules are not recommended
The business process is quite complicated
Modules with complex business processes are not suitable for automated testing . Because the business process is complex , Generally, it is the core module of a system , The general requirements of core modules change frequently , There are many abnormal conditions during the test , Using automated scripts for testing , If an exception occurs that is not handled in the code , It may affect the execution of subsequent use cases , This is not as convenient as manual testing .
for example : Use the coupon page by order type , How much of the total amount can be used 1 Coupons , How much of the total amount can be used 2 Coupons , What conditions can be met to use the combined offer ?
This demand , Basically, each operation corresponds to a use case , Each use case also has different verification points , That is to say, write a set of codes for using coupons , Can only be used on one use case , It cannot be reused , This makes little sense to write automated scripts .
And core modules like this involving orders and prices , Demand may change more frequently , In the process of modifying the code , Once the page elements change , It may cause the whole script to fail . Code maintenance costs are high , Manual testing is recommended .
And this core module , If manual testing is used , Maybe during the test , Other missing test points will also be found , Make the test more complete . If you use automated testing , Just run the script according to the test case , It doesn't perfect the test cases .
Modules that interact with other systems
If the functional module involves interaction with other systems , Other systems don't want to give you an interface to connect with this thing , Automated code can't go to other systems to verify the results .
Even if it can , It may also cost a lot of manpower and time ( Of course, it does not rule out that some big cattle can solve these problems quickly ), Automated testing is not recommended for this type of .
Learning resource sharing
Finally, thank everyone who reads my article carefully , Watching the rise and attention of fans all the way , Reciprocity is always necessary , Although it's not very valuable , If you can use it, you can take it 
These materials , For those who want to engage in 【 software test 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! The above information can be shared , Just click below to enter the group .
边栏推荐
猜你喜欢

WinForm uses zxing to generate QR code

Automatic 3D Detection and Segmentation of Head and Neck Cancer from MRI Data.

《CLR via C#》读书笔记-单实例应用程序

Print leap years between 1000 and 2000 (C language)

Buuctf-- connotative software

C#MDI打开子窗体去掉自动生成的菜单栏

Offensive and defensive world re insfsay

打印100~200之间的素数(C语言)

Web vulnerability manual detection and analysis

Linux下Redis安装及集群搭建
随机推荐
Call another interface button through win32API
Voir le classement des blogs pour csdn
由ASP.NET Core根据路径下载文件异常引发的探究
Learn spark computing framework in practice (00)
BUUCTF--reverse2
Common usage of LINQ in C #
【C语言进阶】文件操作(一)
Implementation of iequalitycomparer interface in C #
Design of intelligent test paper generation system
Analysis of BlockingQueue source code of AQS
攻防世界-Re-insfsay
如何快速完成磁盘分区
【评论送书】适合初学者的 6 个有趣的 R 语言项目
Installing and configuring wmware esxi 6.5.0 in VMware Workstation
CLR via C reading notes - single instance application
Contents of advanced mathematics
Analysis of reentrantlock source code of AQS
September 23, 2020 left and right values reference std:: move()
全面理解MESI缓存一致性协议
IO流总结