当前位置:网站首页>Summary of interface automation interview questions for software testing
Summary of interface automation interview questions for software testing
2022-04-23 02:58:00 【Xiaowu knock code】
One How do you do interface testing ?
In general , Go through the following process : Interface requirements survey 、 Interface test tool selection 、 Interface test case writing 、 Interface test execution 、 Interface test regression 、 Continuous integration of interface test automation . say concretely , The interface test process is divided into the following nine steps :
First step : Analyze the test requirements , And please provide the interface description document ;
The second step : Sort out the interface test cases from the interface description document , It should include detailed input parameters ( Normal condition , Exceptions include the number of input parameters , type , Optional / Mandatory , Consider the case where the parameters are mutually exclusive or associated ) And out parameter data ( Meet the requirements of interface documents ) And clear formats and checkpoints ;
The third step : Review interface test cases with development ;
Step four : Combined development library , Prepare the input parameter data and output parameter data in the interface test case , And organize them into Excel File format ;
Step five : Combine interface test case documents and Excel Data document in format , Write the business logic code of interface automation test ;
Step six : Start executing interface automation test cases ;
Step seven : Execution, if any bug, Submit to defect management platform ;
Step eight : After development and modification , Return to bug, Tracking status ;
Step nine : Automatic continuous integration after completion ;
Two How to design test cases for interface testing ?
The interface use cases are designed from four aspects : function , Business logic , abnormal , Security .
function : Does it meet the requirements
1) From the user's point of view, whether the interface can meet the business requirements , Whether the function is normal ;
2) Whether the function is implemented according to the interface document ;
give an example : For example, add essays to the blog Garden , Login is required to add . That is, the business requirements do not support tourists to add essay function , If you design a user who doesn't log in , Then test and add the essay interface , The result interface can be added to the essay , It indicates that the function is abnormal , Non conformance with requirements and interface document description .
Business logic : Whether it depends on the business
1) Interface implementation logic ;
2) Business logic coverage ( sentence / Conditions / Branch / determine /…);
give an example : Before the interface call , The login interface needs to be called , If you don't log in, you can request data , Not in line with business logic .
abnormal : Parameter exception and data exception
1) Parameter exception : Key parameters , The parameter is empty. , many , Less parameters , bad parameter ;
2) Data exception : Keyword data , Data is empty , The length is not the same , Wrong data ;
give an example : Whether data exception or parameter exception , The test points are similar , One parameter is key and value,key Said parameters ,value According to the data . First of all , See if the parameters and data can support keywords , for example Java Reserved keywords in ; The second is that the parameters and data are empty , See if you have made a judgment ; Third , More and less parameters , For example, an interface with two parameters , You need to design a use case with three parameters , A use case with only one parameter . Inconsistent data length , For example, whether designing long strings supports , Because the length of each field is set in the database table creation process . Enter wrong parameters and data , Such as deliberately typing wrong words, etc .
Security test case design :
1)cookie: Yes cookie To get the data , If not cookie And then there's the message back , Explain that there is a problem ;
2)header: Normal interface belt header Information , Delete header See if you can return data ;
3) Unique identification number :app Cell phone identification number , The only thing is that ;
4) Text input box sql Injection and xss attack .
3、 ... and Do you need to compare databases during interface test execution ?
The returned key fields and field values of the interface need to be verified , Otherwise, interface testing is meaningless .
There are generally two ways :
1) Database preset data , Interface verification returns ;
2) Interface call , Compare database query results .
Four What is the quality evaluation standard of interface test ?
Generally speaking , Evaluate from the following eight aspects :
- Whether the business function coverage is complete ;
- Whether the business rule coverage is complete ;
- Parameter verification whether the requirements are met ( The border 、 Business rules );
- Whether the interface exception scenario coverage is complete ;
- Whether the interface coverage meets the requirements ;
- Whether the code coverage meets the requirements ;
- Whether the performance index meets the requirements ;
- Whether the safety indicators meet the requirements ;
5、 ... and How to clean up the garbage data generated by the interface
Creating data and data cleaning , need Python It's connected to the database , Do the operation of adding, deleting, modifying and checking, test case pre operation .
setUp Do data preparation and post operation ;
tearDown Do data cleaning ;
6、 ... and For other interfaces, the interface information shall be obtained first , How to make the logged in interface call only once in other interfaces ?
The solution is as follows :
Use singleton mode ;
Use a custom caching mechanism ;
Use... In the test framework setup Mechanism ;
pytest in fixture Mechanism ;
7、 ... and How to design interface test assertion ?
Interface test assertions can be designed from the following five aspects :
1) Response code : Check whether the response code is as expected , Used to judge whether the test case is executed successfully ( in the light of http Interface );
2) keyword : Verify that the keyword meets expectations , Used to judge whether the test case is executed successfully ;
3) Regular matching : When an interface returns more content , And there are certain rules , Regular expressions can be used to verify the information returned by the interface to determine whether the test case is successfully executed ;
4) Database matching check : For example, when verifying the data returned by querying an interface , By writing sql Statement query results , And then sql After the statement is executed, the result returned by the database is checked with the result returned by the interface , To determine whether the test case is successfully executed ;
5) Auxiliary verification through relevant interfaces : such as , When testing a delete interface , After deleting a record , Want to verify that this record was really deleted , The query interface can be called , If the deleted record is not found , It indicates that the record is deleted successfully .
8、 ... and How to test interfaces that rely on third-party data ?
You can use some Mock Tools ( Such as :JSON Server、Easy Mock) To simulate the data return of a third party , Minimize dependence on third-party data interfaces .Mock Service refers to some complex services during testing ( Or not very well constructed ) The object of , Replace it with a virtual object . If so now A and B Two interfaces , A Need to call interface B To meet the business requirements . This is the time B The interface has the following three situations :
1)B The interface has not been developed yet : You need to wait for the data of the interface to develop , At this time, the perfect interface Mock The service can greatly shorten the waiting time for development and joint commissioning .
2)B Some of the scenes are difficult to simulate : For example, timeout. 、 Unknown error or unstable third-party interface .
3) Isolation during performance testing B Interface ( Third party interface ): There will be problems during the pressure measurement .
Nine API What are the advantages of testing ?
API yes (Application Programming Interface), That is, the application programming interface .API Is a set of disciplines for building software applications , Protocols and tools .API Act as an interface between software applications , And allows two software applications to communicate with each other .API Is a set of software functions , Can be executed by other software .API The test has the following advantages :
Faster and higher test coverage .
API Testing helps us reduce testing costs . adopt API test , We can do it in GUI Small errors found before testing . stay GUI Testing period , These small mistakes will become bigger . therefore , stay API It will be cost-effective for the company to find these errors in the test .
API Testing has nothing to do with language .
API Testing is very useful in testing core functions . We can test without a user interface API. stay GUI In the test , We need to wait until the application is available to test core functionality .
API Testing helps us reduce risk .
Ten The interface cannot be adjusted , How to investigate ?
The reason why the interface cannot be adjusted :
1) The interface did not respond
Many times when doing interface testing , You will find that the interface does not return any , For example, the browser has been circling , Or return to a blank page . When using the interface test tool , Tool error , Tips “no response”.
Investigation thought :
1. Check the interface first ip Whether it is right , This can be done on this machine ping Interface ip, Check if the network is open ;
- Check whether the port number of the interface is correct , This can be done on this machine telnet Interface ip And port number , Check whether the port can be connected ;
3. Check whether the project is started or deployed successfully , You can find R & D to confirm , Or log in to the server by yourself , adopt ps Command to check whether the process of the project exists , And then use tail Command to view the deployment log ;
4. Check that the server firewall is turned off , If it cannot be closed due to security or permission problems , You need to find the O & M for policy configuration , Open the corresponding ip And port number ;
5. Check your client ( browser / Testing tools ), Whether the network proxy is set , The network proxy may cause the request to fail ;
6. Check the... Of the operating system host file , Whether an incorrect... Is bound ip mapping ;
2) The interface responded but returned an error status code
Sometimes the interface will return some errors HTTP Status code , The specific cause needs to be determined according to different status codes .
Investigation thought :
400: Client request error , For example, the request parameter format is incorrect ( Such as json Illegal string );
401: unauthorized , Like asking for header in , Lack of necessary headers ( Such as token、auth Etc );
403: prohibit , The common reason is that the user's account does not have a corresponding url jurisdiction , There is also the middleware used in the project , Remote access is not allowed ( such as Apache);
404: Resource not found , There are many reasons for this , such as :
url Spelling mistakes ;
url After space ;
The project did not start successfully ;
The request agreement is wrong , Such as http/https;
405: Method does not allow , The common reason is that the request method is incorrect , such as GET Type interface , Use POST The way to ask ;
415: Unsupported media types , The common reason is that the type of requested data does not match the type supported by the server , such as json Interface , You need to add a header Content-type:application/json;
500: Server internal error , This happens , It indicates that the server reported an error , You need to log in to the server , Check the error log , Check according to the specific prompt information ;
502/503/504(Bad Gateway/ Wrong gateway 、Service Unavailable/ Service is not available 、Gateway Timeout/ gateway timeout ). From the following two situations :
This error will be reported if the interface is called for a single time , This indicates that there is a problem with the back-end server configuration , Or the service is not available , Hang up ;
If this error occurs during concurrent pressure measurement , It means that the rear end pressure is too high , Something unusual happened , This problem is usually caused by long response time or no response at the back end .
Pay attention and get one for free 216 Page Software Test Engineer video documentation .
版权声明
本文为[Xiaowu knock code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220644037690.html
边栏推荐
- Q-Learning & Sarsa
- HLS / chisel practice CORDIC high performance computing complex square root
- The way to conquer C language
- Winsock programming interface experiment: implementation of ipconfig
- Leangoo brain map - shared multi person collaborative mind mapping tool
- Chapter VI project information management system summary
- Airtrack cracking wireless network password (Dictionary running method)
- VirtualBox virtual machine (Oracle VM)
- ele之Table表格的封装
- ROP Emporium x86_ 64 7 ~ 8 questions
猜你喜欢
Kubernetes study notes
Traversal of l2-006 tree (middle and later order determination binary tree & sequence traversal)
The input of El input input box is invalid, and error in data(): "referenceerror: El is not defined“
Windows MySQL 8 zip installation
ROP Emporium x86_64 7~8题
It turns out that PID was born in the struggle between Lao wangtou and Lao sky
tf. keras. layers. Embedding function
windows MySQL8 zip安装
Flink learning (XI) watermark
Practical combat of industrial defect detection project (II) -- steel surface defect detection based on deep learning framework yolov5
随机推荐
接口请求时间太长,jstack观察锁持有情况
LeetCode 1450 - 1453
Plug in for vscode
Essential qualities of advanced programmers
《信息系统项目管理师总结》第五章 项目质量管理
Error installing Mongo service 'mongodb server' on win10 failed to start
Decision tree principle of machine learning
Difference between relative path and absolute path (often asked in interview)
Cloud computing learning 1 - openstack cloud computing installation and deployment steps with pictures and texts (Xiandian 2.2)
Redis data server / database / cache (2022)
How can enterprises with major hazard installations ensure the completion of the digital construction task of double prevention mechanism by the end of the year
Solve the problem that PowerShell mining occupies 100% of cpu7 in win7
进阶上将程序员必备素质
When using art template inheritance, compileerror: invalid or unexpected token generated
The express project changes the jade template to art template
Introduction to ACM [inclusion exclusion theorem]
Classification and regression tree of machine learning
Numpy stack function
tf. keras. layers. Embedding function
基于ele封装下拉菜单等组件