当前位置:网站首页>Sikuli automatic testing technology based on pattern recognition
Sikuli automatic testing technology based on pattern recognition
2022-06-26 15:10:00 【Hogwarts test development society】
As a tester , During the test process, if the application interface structure is huge , Page design changes frequently , It is difficult to locate page elements , It also requires a lot of repeated tests , What quick solutions do we have ? Maybe Sikuli Can be one of your choices , It allows you to get rid of the controls API Dependence , By retrieving the image of the current screen in real time , Get actionable object , Simulate user behavior , Verify the real screen display results .
What is? Sikuli?
Sikuli automated testing , Is the content displayed on the screen , Through image recognition , Used to locate the element , And operate GUI Components , Finally, you can judge whether the operation is successful by identifying the content in the picture . This allows testers to use screenshots instead of writing code , So as to reduce the test cost , Simplify the process of writing test scripts .
Sikuli It's in the Mexican vicho Indian language ” The eye of God ” It means , The goal is to make computers look at the real world like people , And interact with it .
Sikuli The developer of the
Sikuli Is an open source research project of the original user interface design organization at the Massachusetts Institute of technology , It is now time to maintain and further coordinate development with the open source community Sikuli The laboratory is located at the University of Boulder, Colorado . This is supportive , Part of it is awarded by the National Science Foundation IIS-0447800, Part of quanta computer TParty project .Sikuli Of MIT Issued under license .
Download and install
edition 1.1.3 The following official download page is
https://launchpad.net/sikuli/sikulix
The new version of the 1.1.4 Above in
https://raiman.github.io/SikuliX1/downloads.html
If you use 1.1.3 Under version , Double click directly in the download file to open sikulix.jar The document is sikuli Provide IDE, It can be written in a drag and drop mode .
As shown below :
This way of running depends on IDE, It is not convenient to use script startup to execute tests , So there are two other ways , Direct writing python Script to execute .
01
pure python Environmental Science -Lackey library
Lackey yes Python An automation library for , Designed for ease of use and Sikuli Cross compatibility of automated scripts . It provides a simple but powerful API, Used to find pictures on the screen , And basic user input using the mouse and keyboard .
√
Lackey Dependency Library
①
numpy
②
pillow
③
opencv
④
keyboard
Installation command :pip install Lackey
Import method in script :from lackey import *
The library supports screenshots of .bmp, .pbm, .ras, .jpg, .tiff, and .png
find("***.png"): Look for the element , There is no throw exception
exists("***.png"): Look for the element , return true or false
wait("***.png",5): Wait for the specified number of seconds , Look for the element
click("***.png"): Click on the element
dubleClick("***.png"): Double click on the element
input_(“text”): Input text
……
Implemented a similar monkey An example script for the tool is as follows ( Put all the screenshots in the project btn_pictrues Under the directory ):
02
Write python Script call sikulixapi.jar Medium API
** ** Prepare the environment
1
install jython: pip install JPype1
2
install VCForPython27
3
install JDK, And configuration %JAVA_HOME%
Possible pit
call getDefaultJVMPath, Can't find JAVA_HOME; Or start java Virtual opportunity crash . It may be due to java and python The number of digits in the installation version is different , Both are 32 Bits or 64 Bit software can run normally .
notes : Use java -d32 perhaps -d64 see 32 still 64 position ; Input... In the terminal python, As shown in the following figure 32 still 64 position .
summary
Sikuli The advantage of is simple and easy to use , Support for multiple programming languages (python/java), But the disadvantages are obvious . The resolution, color and size of the picture have a great impact on the results of the program , A successful script executed on one device may not succeed on the other device , Need to re screenshot . And can only detect the content displayed on the current desktop , The background process cannot operate ,pc All user operations on the end are not fully supported ,sikuli Itself is not perfect , It is still in the development and upgrading stage . So use sikuli Complete complex large-scale automated tests , Not the best choice yet , However, its small and beautiful features can be applied to many test scenarios
Get more related information stamps :https://qrcode.ceba.ceshiren.com/link?name=article&project_id=qrcode&from=jianshu×tamp=1656224665&author=wuyue
边栏推荐
- Talk about the RPA direction planning: stick to simple and valuable things for a long time
- Unity C # e-learning (IX) -- wwwfrom
- Minister of investment of Indonesia: Hon Hai is considering establishing electric bus system and urban Internet of things in its new capital
- Get the intersection union difference set of two dataframes
- R language dplyr package bind_ The rows function merges the rows of the two dataframes vertically. The final number of rows is the sum of the rows of the original two dataframes (combine data frames)
- TCP拥塞控制详解 | 1. 概述
- Redis-集群
- [solo π] ADB connects multiple mobile phones
- 使用卷积对数据进行平滑处理
- 【雲原生】 ”人人皆可“ 編程的無代碼 iVX 編輯器
猜你喜欢

Mark一下 Unity3d在Inspector中选中不了资源即Project锁定问题

程序分析与优化 - 8 寄存器分配

The heavyweight white paper was released. Huawei continues to lead the new model of smart park construction in the future

Unity 利用Skybox Panoramic着色器制作全景图预览有条缝隙问题解决办法

Unity uses skybox panoramic shader to make panorama preview. There is a gap. Solution

使用 Abp.Zero 搭建第三方登录模块(二):服务端开发

Redis-集群

Keil4打开单片机工程一片空白,cpu100%程序卡死的问题解决

15 bs对象.节点名称.节点名称.string 获取嵌套节点内容

Lexin AWS IOT expresslink module achieves universal availability
随机推荐
Declaration and assignment of go variables
RestCloud ETL与Kettle对比分析
Get the intersection union difference set of two dataframes
Principle of TCP reset attack
Unity uses skybox panoramic shader to make panorama preview. There is a gap. Solution
nvidia-smi 报错
R language GLM function logistic regression model, using epidisplay package logistic The display function obtains the summary statistical information of the model (initial and adjusted odds ratio and
数据库-视图
Restcloud ETL extraction de données de table de base de données dynamique
Informatics Olympiad all in one 1400: count the number of words (string matching)
Use abp Zero builds a third-party login module (I): Principles
Redis cluster messages
Redis-集群
Execution of commands in the cluster
R language uses the aggregate function of epidisplay package to split numerical variables into different subsets based on factor variables, calculate the summary statistics of each subset, and use agg
Lexin AWS IOT expresslink module achieves universal availability
【雲原生】 ”人人皆可“ 編程的無代碼 iVX 編輯器
R language dplyr package bind_ The rows function merges the rows of the two dataframes vertically. The final number of rows is the sum of the rows of the original two dataframes (combine data frames)
Talk about the RPA direction planning: stick to simple and valuable things for a long time
Deployment of kubernetes' controller