当前位置:网站首页>Common interview questions in automated testing
Common interview questions in automated testing
2022-06-23 04:36:00 【fish_ study_ csdn】
1、 What projects are suitable for automated testing ?
keyword : constant 、 Repetitive 、 canonical
The first point , Demand should not change too frequently ;
Second point , The project cycle should be long enough , If the automation code is not finished , The company went out of business , There's no need for Automation
The third point , Scripts can be reused : In some typical scenes , for instance “ Smoke testing 、 regression testing ” What's important is that automated testing is often used ;
Fourth, , Is the software being tested standard : For example, whether there are requirements documents 、 Standard interface documentation 、 Is there a prototype 、 Is your interface design standard ;
The first five , Manual testing is impossible ; For example, a performance test , You can't have... At the same time A thousand hands keep doing a little bit , The cost of automated testing is not particularly high
2、 What is? PO Pattern ?
PO Pattern : Full name :Page Object Model ( translate : Match only . AOBO pick can t. edamame ) abbreviation POM, It's called a page object , For the page 、UI Interface ;
PO Thought mainly comes from Martin Fowler (marktin Flowwer) stay 2004 At the beginning of an article published in, he didn't call PO , It is called window driver , later selenium Followed this idea , So it's changed to PO;
Main uses : Is to convert a specific page into an object in the programming language , Page properties are converted into object properties , Convert page operations into object methods ;
In automated testing , It is mainly used to separate page operation and test logic ;
3、PO What are the encapsulation principles of patterns ?
selenium In official wiki The above provides us with six principles , It can be understood in the actual test process :
The first principle is , The public method represents a service provided by the page , For example, we can put The login is encapsulated into a logo Methods , Encapsulate the search method into a facility method , Encapsulate the registration operation into a register Methods ;
The second principle is , Try not to expose the inside of the page ; Like a HTML There is also a top-down structure of the page ;
The third principle is , stay PO Generally, no assertion is made , Can achieve the separation of page logic and test logic
The fourth principle is ,PO Generally, the method inside returns self Or something else Page Object It can also be an element attribute
The fifth principle is , Whole PO You don't need to encapsulate the behavior of the entire page , Encapsulate whatever logic is used
The sixth principle is , For unified operation , If there are different results , Can be expressed in different ways , For example, a successful login has a jump , There is an error when the login fails ,
If you log in, you will be authorized , Then it can be encapsulated into three separate methods :login success、login error、login invalid
4、 Python in *args and **kwargs The role of ?
It's all variable length , It can solve the problem that the parameters in the function are not fixed ,*args The position parameters can be transformed into Yuanzu ;**kwargs You can put Convert keyword parameters into dictionaries ;
5、Python What is the garbage collection mechanism in ?
That we use a lot Python Interpreter CPython Three garbage collection mechanisms are mainly used to recover the invalid data and release the memory , Namely : Reference count 、 Mark clear also Generational recycling
6、Web Automated element positioning
Selenium in hidden Or is it display = none Whether the element of can be positioned to ?
You can't , Can write JavaScript Put... In the label hidden First change to 0, Repositioning elements
7、 Close the browser quit and close The difference between
Simply speaking , Both can be implemented to exit the browser session function ,close Is to close your current focus tab page , and quit Close all browsers tab page , And exit the browser session. You know the two differences , We knew quit Usually used before the end of the test operation ,close Used to close a page during the execution of a use case .
8、 Give an example of the exceptions you've encountered
stay selenium Automated testing process
Through this question , I know how many scripts you've written . The most common exception to the scripting process is this , This element cannot be found .
common selenium There are these :
ElementNotSelectableException : The element cannot select an exception
ElementNotVisibleException : The element does not see an exception
NoSuchAttributeException : There is no such attribute exception
NoSuchElementException: There is no exception for this element
NoSuchFrameException : There is no the frame abnormal
TimeoutException : Timeout exception
Element not visible at this point : The element is not visible at the current point
9 、 Close the browser quit and close The difference between
Simply speaking , Both can be implemented to exit the browser session function ,close Is to close your current focus tab page , and quit Close all browsers tab page , And exit the browser session. You know the two differences , We knew quit Usually used before the end of the test operation ,close Used to close a page during the execution of a use case .
10 、 How to deal with it alert Popup , stay selenium How to handle multiple Windows ?
webdriver Is able to deal with alert The popup window ,Selenium Provides Alert This interface . The relevant operation code is as follows :
// Switch to Alert
Alert alert = driver.switchTo().alert();
You click on a link , This link will be in a new one tab open , And then you're going to look for the element in the new tab Open page , So we need to use it here swithTo Method .
You need to get the current browser multi-window handle , Then jump to the new or old handle based on the determination
边栏推荐
猜你喜欢

在word里,如何让页码从指定页开始编号

QMainWindow

城链科技董事长肖金伟:践行数据经济系国家战略,引领数字时代新消费发展!

The spring recruitment in 2022 begins, and a collection of interview questions will help you

How to make the page number start from the specified page in word

How MySQL deletes a row of data in a table

Halcon glue line detection - template matching, pose transformation, glue width, glue continuity detection

Flutter series: wrap in flutter

【一起上水硕系列】Day Three - preview4

摆烂LuoGu刷题记
随机推荐
靜態查找錶和靜態查找錶
Introduction and use of MySQL view
JD cloud distributed database stardb won the "stability practice pioneer" of China Academy of information technology
自动化测试常见的面试题
PTA:7-87 集合的模拟实现(类模板)
How to ensure application security
photoshop PS 查看像素坐标、像素颜色、像素HSB颜色
[advanced binary tree] AVLTree - balanced binary search tree
Does the network disk also roll inside?
How to use MySQL index well
【二叉树进阶】AVLTree - 平衡二叉搜索树
Compilation, installation and global configuration section description of haproxy
PTA:7-58 图书音像出租管理
Redis启动有问题
虫子 日期类 上 太子语言
背景彩带动画插件ribbon.js
在线文本过滤小于指定长度工具
Form development mode
PTA:7-86 集合的模拟实现(函数模板)
[learn FPGA programming from scratch -40]: Advanced - Design - competition and risk