程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python app automation test practice chapter ②] - gossip about the evolution of APP automation tools

編輯:Python
Wanyeji Faint thunder , Cloudy sky . But I hope the wind and rain will come , I can keep you here .


Preface
Author's brief introduction : Husky who yearns for power , You can call me Siberian Husky , One devoted to TFS Empowered bloggers
CSDN Blog expert certification 、 Nova plan Season 3 full stack track top_1 、 Huawei cloud sharing expert 、 Alibaba cloud expert Blogger
If there is something wrong with the knowledge of the article , Please correct me. ! Learn with you , Progress together
The motto of life : Being superior to some other man , Is not high , The true nobility is to be superior to one's former self .
If you feel the blogger's article is good , Please pay attention. 、 give the thumbs-up 、 Collect three companies to support bloggers


Column series ( Click unlock ) Learning route guidance Knowledge orientation Python Full stack white paper Zero foundation beginner level chapter Easy to get started in an easy to understand way , Let you fall in love with Python The charm of . Advanced Grammar Mainly around multi-threaded programming 、 Regular expression learning 、 Including project exercises close to actual combat . Office automation Realize the automatic operation of daily office software , Save time 、 Improve office efficiency . Automation test practice From the perspective of actual combat , One step ahead , Rapid transformation test development engineer . Database development practice Updating Introduction and practice of reptile Updating Data analysis Updating Introduction to the front +flask Full stack Updating django+vue Full stack Updating expand - Introduction to artificial intelligence Updating The road to network security Stepping on a pit Record the pit encountered during learning and drilling , It is convenient for those who come from behind to catch up Net security literacy Three days fishing , No deep understanding of the principle , It will only make you a script boy . vulhub The loopholes in the shooting range reappear Make it easy to reproduce vulnerabilities , Let security researchers focus more on the vulnerability principle itself . shell Programming Don't involve linux Basics , The final case will be in the direction of safety reinforcement . [ To be finished ] WEB Vulnerability attack and defense 2021 year 9 month 3 Stop updating on , Move to safe communities such as prophet community and small secret circles Collection of penetration tools 2021 year 9 month 3 Stop updating on , Move to safe communities such as prophet community and small secret circles A little Engineer Test artifact - Charles Software test data packet capture analysis artifact Test artifact - Fiddler Learn to fiddle , Learn not to stand upside down and eat , Rarefied ! Test artifact - Jmeter Not just a performance test artifact , It can also be used to build a lightweight interface automation testing framework . RobotFrameWorkPython Automatic test tool realized , This chapter only introduces UI Automation part . Java Realization UI automation Document written in 2016 year ,Java Realized UI automation , It still has reference significance . MonkeyRunner There are not many application scenarios for this tool at present , The document has been deleted , Only for the sake of good typesetting .


List of articles

    • APP Automation tools
    • APPIUM principle

Next to the previous chapter , In today's chapter, let's talk about it in detail APP The evolution of automated testing tools . So in this chapter, we will introduce the commonly used 、 Or I've seen it before APP What are the automated test tools ? And why we use APPIUM , What are its advantages .

APP Automation tools

In about 2010 year Before and after ,APP Automated testing is still in its infancy . The earliest automated testing tool is actually the testing framework of Android itself Instrumentation , Such a testing framework is actually the foundation of many testing frameworks now and in the future .

Instrumentation This framework is actually very simple , The underlying support is not very good , It is not very convenient to use , At the same time, the biggest disadvantage is that it does not support cross application . And the packaging is also very simple , Basically, it is to call directly Android source code package ;( It is very difficult for people to write automation in this way , And then selenium It has been popularized , This simple and highly encapsulated writing method is very suitable for everyone ), therefore Instrumentation It didn't catch on , Just on a small scale , Only when there is no way can I choose to use .


because Instrumentation The packaging is not good enough , Later, there was a phenomenon based on Instrumentation Framework developed Robotium ,“Robotium” Some common operations are encapsulated , Encapsulation has become the automation instructions we habitually use .

In the later use process, it is found that , This Robotium Highly encapsulated part of the underlying Android , And at that time, there were some things like flash Similar components of 、 and IOS There is no way for the system equipment to support .

So although it was hot for a while , But it is still gradually APP Automation has abandoned .


Next , Google has opened various open source components . The first one is UIAutomator ,“UIAutomator” It is now a core foundation of automation . The open source framework it provides includes API Of JAVA library , Used to create functional UI test . And have their own APP Test engine , Can combine Junit 、TestNG To write some test cases .

But Google maintains such a system UIAutomator It's very difficult , So its community resources have been dominated by Google itself , Not perfect . And the degree of use is not particularly high , At the same time, it was limited by the Android version at that time , Only right Java Very good support , Support for other languages is very poor , therefore UIAutomator There was no fire . But it laid the foundation An underlying layer of the core of automated testing , Including the current "APPIUM" In fact, the bottom layer of "UIAutomator" Most of it .


With UIAutomator Not very successful , Google has launched another streamlined 、 Fast automated test framework Espressp . Such a framework is also open source , Very small 、 Also very lightweight . Writing code is very simple , At first it was just based on Instrumentation The height of the package , No breakthrough Instrumentation The problems in it , For example, cross application problems have not been solved .


As Google's use of these two tools decreases , Some people in the industry began to make their own tools . Google didn't do well , Maybe many people feel that it may be difficult to do it , But in fact, there are a group of such people who are regarded as leaders in the field of test development , They have made their own set of automated testing tools . The bottom layer of the tool is highly borrowed from Android UIAutomator ; about IOS Support for , In fact, it uses IOS Own internal framework UIAutomation ; A combination of these two sets of frameworks is used , Realize the dual platform support APPIUM Such a tool . The emergence of this tool , It really makes everyone feel that there is finally a way to support us with a set of code at the same time IOS And android .

At the same time, the tool abandons the original UIAutomatorUIAutomation My writing habits , Start binding selenium2.0 After that webdriver The grammar of , This syntax is used in the test of our Android mobile terminal , Developers can use webdriver To be compatible with any language .( such as Java、Python、Ruby…) These can be automated scripts , This is it. APPIUM The advantages of .

that APPIUM Are there any shortcomings ? There is , For example, its encapsulation is very strong , But when we want to do some secondary development on the bottom layer , Its secondary development is not so friendly . So although APPIUM It's open source. , But many people have made secondary development based on it, but it is not very successful , So we still haven't jumped out in the use APPIUM Set good rules for everyone . However, this does not mean that the tool has great shortcomings , It can only be said APPIUM Its support is very comprehensive .

Until now, , although APPIUM It has been born for many years , People still rely on 、 Get used to it .


Yes, of course , Not to say APPIUM As a result, there are no other tools . After that, a new product called Calabash Tools for , It is also a cross platform APP The test framework . What it tests is not like APPIUM This covers everything , It is mainly used to test screen shots 、 Gestures and other functions .

The most important thing is that this tool is bound to another design pattern , It supports a system called Cucumber Of Behavior driven patterns .“ Behavior driven patterns ” In fact, it is another keyword driven mode , It's just that we replaced keywords with its behavior . In essence , In the field of automated testing , Its promotion is not too high .

meanwhile Calabash Also has many own shortcomings , For example, it runs very slowly , Like in the early days APP Automated testing tools , By default, you must install APP . Even if it is already installed , It will also be reinstalled ; In language , except ruby outside , Support for other languages is not very friendly . This is it. Calsbash The biggest problem at the moment .


at present , In the industry . mention APP automated testing , The default method is to use APPIUM . So the following chapters , It's based entirely on APPIUM To explain to you .

APPIUM principle

See the picture below :



In fact, we will use it later APPIUM You will find that the calling speed will be very slow , The reason for this is actually the diagram in the above figure .

The script we wrote passed HTTP At the bottom TCP link to APPIUM Of Server , Re pass Server To confirm whether the linked device is Android or IOS Etc., etc. , At the same time, load the corresponding adb And many other device management tools , We have completed a set of such a framework to achieve the expected results of the script .


OK, about APP automated testing 、 about APPIUM Here are some brief introductions to , Start with the next chapter , Together really use APPIUM This tool , See if it is really so easy to use .

I made a obeisance …




  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved