当前位置:网站首页>The latest CSDN salary increase technology stack in 2022 overview of APP automated testing

The latest CSDN salary increase technology stack in 2022 overview of APP automated testing

2022-07-01 01:52:00 Test Architect Bei fan

Catalog

One . Application background

Two . Introduction to testing framework

1.Android Automation framework

IOS Automation framework

3、 ... and . Test process and classification

1. Testing process

2. Automated test classification

Four . Mobile operating system and app type

1. Mobile operating system android

2. app Three types and differences

2.1 Native application :(Native App)

2.2 Hybrid application (Hybrid App)

2.3.Web edition APP (Web App)

2.4.Web App、Hybrid App、Native App Technical characteristics

5、 ... and . Android SDK Introduce

Concept

Download and install

Android SDK Manager

Tools Catalog :

Android SDK File directory

Configure detection

6、 ... and . Android SDK   Environment building

  • Application background

   With the increasing popularity of mobile Internet and intelligent devices , Move App It has penetrated into every aspect of our life , For example, travel 、 diet 、 travel 、 social contact 、 Financial etc. .

The user to App The requirements for product quality and user experience are getting higher and higher . Therefore, many Internet enterprises have begun to pay more and more attention to the quality of mobile terminal products . however App The product is constantly iterative and updated , It also increases the testing workload for testers , In particular, a large number of tedious regression tests .

Automated testing is an auxiliary testing method to deal with the continuous iteration and updating of products ( Mainly for regression testing ), The ultimate goal is to ensure product quality .

【 The end of the article leaves a lot of benefits for everyone 】

  • Introduction to testing framework

1.Android Automation framework

If a worker wants to do a good job, he must sharpen his tools first ——《 The analects of Confucius · Wei linggong 》

1. Instrumentation

Instrumentaion yes Android A built-in test framework , It is the foundation of many other testing frameworks , The component under test can be loaded in the same process . It has many rich high-level packages , Users can use based on instrumentation Other frameworks for , Avoid excessive secondary development . but Instrumentation Cross application is not supported , Cause to be based on instrumentation Our frameworks inherit this shortcoming .

2. Robotium

Robotium Is based on Instrumentation A stronger framework for framework development . The common operations are encapsulated for ease of use . For developing functionality 、 System and acceptance test scenarios . It is bound to... At runtime GUI Components . Installed it as a test case Android An application on a device or emulator , And provide a real environment for performing tests .

advantage : It's easy to write test scripts in the shortest time , Easy to use . Automatically follow the current activity. Because the runtime is bound to GUI Components , So compared Appium, Its tests execute faster , More powerful . Don't access code or know app Realization , You can also work . Support Activities、Dialogs、Toasts、Menus、Context Menus And others Android SDK Control .

shortcoming : Can't handle flash and web Components . It gets very slow on old equipment . Because of lack of support iOS equipment , When automated testing simultaneously covers android And iOS situations , The test will be interrupted . There is no built-in recording and playback function ., Using the recording function requires TestDroid and Robotium Recorder Such a charging tool .

3. UIAutomator

UIAutomator Is a testing framework provided by Google , It provides native Android app And the advanced of the game UI test . This is an inclusion of API Of Java library , Used to create functionality UI test , And the execution engine that runs the tests . The library comes with Android SDK.

advantage : It accesses different processes when running , Will give JUnit Test case privileges . The library is supported and maintained by the Google community .

shortcoming : Support only android 4.1(API level 16) And above . Script logging is not supported . The point of support is Java. You can't get current activities or instrumentations . Currently not supported web View . The library only supports Java, So it's hard to and use Ruby Of cucumber blend . If you want to support BDD frame , It is recommended to use Java Their own BDD frame , for example Jbehave.

4. Espresso

Espresso yes Google Open source automated testing framework . be relative to Robotium and UIAutomator, It is characterized by smaller scale 、 More concise ,API More accurate , It's easy to write test code , It's easy to get started quickly . Because it's based on Instrumentation Of , So you can't cross App.

5. Calabash

Calabash Is a suitable for iOS and Android Developers' cross platform app The test framework , Can be used to test screen shots 、 Gestures and actual function codes .Calabash Open source, free and support Cucumber Language ,Cucumber It allows you to express in natural English app act , Realization BDD(Behavior Driven Development, Behavior driven development ). Cucumber All statements in use Ruby Definition .

advantage : There's big community support . List item Simple , Test sentences similar to those expressed in English Support all actions on the screen , Like sliding , The zoom , rotate , Knock, etc . Cross platform development support ( The same code is in Android and iOS Applicable to all equipment ).

shortcoming : After the test step fails , All subsequent steps will be skipped , This can lead to missing out on more serious product problems . Testing takes time , Because it's always installed first by default app. need Calabash The frame is installed in ios Of ipa In file , So testers have to have iOS Of app Source code . except Ruby, Not friendly to other languages .

6. Appium

Appium It's an open source 、 Cross platform automated testing tools , Support IOS、Android and FirefoxOS platform . adopt Appium, Developers don't have to recompile app Or make any adjustments , You can test mobile applications , You can make the test code access the back end API And the database . It's driven by Apple UIAutomation and Android Of UiAutomator Framework to achieve dual platform support , At the same time, it binds Selenium WebDriver For old Android Platform testing . Developers can use WebDriver Write test scripts in any compatible language , Such as Java, OC, JS, PHP,Python, Ruby, C#,Clojure and Perl Language .

7. Selendroid

Selendroid It's based on Instrumentation A framework for . Fully compatible with Webdriver agreement . Selendroid It can be used in simulators and practical devices , You can also integrate mesh nodes as scaling and parallel tests .

8. Robolectric

Robolectric Is a Android Unit test framework , But it doesn't depend on Android Test functions provided , It implements a set of JVM Operational Android Code , And then in unit test To intercept when running android Related code calls , Then go to Robolectric Implemented code (shadow objects) To execute the process of this call . So it doesn't need to be... Like simulators or devices dexing(Android dex The compiler compiles the class file into Android On the device Dalvik VM Format used )、 pack 、 The process of deploying and running , Greatly reduces test execution time .Pivotal The laboratory claims to use Robolectric Can be in 28 Run in seconds 1047 One test .

In addition to the implementation Android The existing interface of the class inside ,Robolectric Give it back to everyone Shadow Class adds many additional interfaces , You can read the corresponding Android Some states of the class . For example, it is ImageView Provides getImageResourceId() Method , The tester can pass getImageResourceId() Interface to determine if the expected Image.

9. RoboSpock

RoboSpock It's an open source Android The test framework , It provides a simple way to write BDD A behavior driven approach to developing specifications , Use Groovy Language , Support Google Guice library .RoboSpock Amalgamated Robolectic and Spock The function of .

10. Cafe

Cafe It is a product of Baidu based on Robotium Test framework for , It provides a cross process testing solution .

11. other

Other automation frameworks also have applications for stability testing Monkey series (Monkey, Monkeyrunner, MonkeyTalk), among MonkeyTalk Support iOS and Android, It can be used for real application , Functional interaction test .MonkeyTalk Provide simple "smoke tests", Complex data-driven test suite .MonkeyTalk Support native , Mobile and hybrid applications , Real device or Simulator .MonkeyTalk Makes scene capture very easy , Can record high-level , Readable test script . There are also for browser automatic testing Selenium WebDriver, You can actually test user behavior , User interaction such as touch 、 Fingers rolling 、 Long press, etc , And support HTML5 Some characteristics of , Like local storage 、session Storage 、 Application cache, etc . and CTS Is an automated tool for compatibility testing , CTS Mostly based on Junit And dashboard technology . It also extends the automated testing process , Use cases can be executed automatically , Automatically collect and summarize test results .CTS use XML These test cases are divided into multiple test plans in the form of configuration files (plan), Third parties can also create their own plan.

summary (Android)

The inheritance relationship of each test framework is as follows , Inheritance determines the inherent advantages or disadvantages of some frameworks . In practical application, multiple frameworks can be integrated .

be based on Instrumentation Test framework for , such as Espresso,Robotium,Selendroid etc. , Can't support cross APP Use . For example, there is cross in automated testing APP operation , It can be redeveloped or combined UiAutomator Realization . Support BDD There are few automation frameworks , Can be in calabash and RoboSpock And Jbehave Choose between . If you want to support Android and IOS, The optional frames are Appium and Calabash, or AthRun. If you choose a framework for unit testing , Optional Instrumentation or Robolectric.Robolectric Realized shadow object class , Short time .

IOS Automation framework

1. XCTest

XCTest It's apple. iOS 7 and Xcode5 The introduction of a simple and powerful testing framework , Its tests are very simple to write , And follow xUnit style .XCTest The advantage of is that it is similar to Xcode Deep integration , Specialized Test The navigation bar , But because of official testing API, Therefore, the functions are not very rich .

2. UIAutomation

UIAutomation It's from apple UI Automated testing framework , Use Javascript To write . be based on UIAutomation There are extended tool framework and driven framework . Extended framework to JavaScript The extended library method provides a lot of useful js Tools , Injectable frameworks usually provide some Lib Or is it Framework, The tester is required to import these contents into the code project of the application to be tested , Frameworks can be done through them app The driver . Driven UI Automation At the bottom of automated testing, we use UI Automation library , adopt TCP The way of communication drives UI Automation To complete automated testing , In this way , The language of editing scripts is no longer limited to JavaScript.

3. Frank

Frank yes iOS The platform is a very popular app The test framework , It USES Cucumber Language to write test cases , Frank Contains a powerful “app inspector”--Symbiote, You can use it to get running app Details of , It is convenient for developers to conduct test review in the future . It allows the use of Cucumber Write test scenarios for structured English sentences . Frank It is required to compile within the application when testing , This means that changes to the source code are mandatory . The operation mode is to use Cucumber and JSON Combination order , Send the command to the server running inside the local application , And make use of UISpec Run the command .

advantage : The test scenario is Cucumber With the help of the , Written in understandable English sentences . Powerful Symbiote Real time inspection tool . Active community support . Expanding library .

shortcoming : Support for gestures is limited . Running tests on the device is a little difficult . To modify the configuration file, you need to run on the actual device . The recording function is not available .

4. KIF

KIF yes Keep It Functional Project abbreviation , Is a iOS app Functional testing framework , Use Objective-C Language writing , It's very easy for Apple developers to get started , It is also a testing tool widely recommended by developers .KIF tester Use private API To get to know App View level in . But the disadvantage is that it runs slowly .

5. Subliminal

Subliminal It's another one with XCTest Integrated framework . And KIF The difference is , It's based on UIAutomation To write , Designed to hide from developers UIAutomation There are some complicated details in this .

6. Kiwi

Kiwi It's right XCTest A complete alternative to , Use xSpec Style writing tests . Kiwi With its own set of tools , Include expectations、mocks、stubs, It even supports asynchronous testing . It is one that applies to iOS Developed Behavior Driven Development(BDD) library , The advantage lies in its simple interface and availability , Easy to set up and use , Perfect for novice developers .Kiwi Use Objective-C Language writing , Easy to IOS Developers get started .

7.Appecker

Appecker It's a iOS Automated test framework for series systems , It is an open source project of Tencent .Appecker use Objective C Development language for test cases , Full support iOS Upper UI A functional test 、 Unit tests can well support automated running .

summary (IOS)

IOS The inheritance relationship of automation test framework is as follows . XCTest And Xcode Of IDE Direct integration , Easy to use , But it does not support stub and mock, So just use XCTest Fewer frames . Kiwi It's a iOS The platform is very easy to use, behavior driven development BDD Test framework for , It has a very beautiful grammar , Can write a strong structure , Very easy to read test . UI Automation yes Apple Official UI Solutions to automated testing , But the interface is not rich enough .

KIF、Frank、Calabash They all simulate event triggering in the form of code , Make the code under test as if triggered by user behavior . But the cost is the complexity of inserting an outer frontal layer . IOS The test framework supports BDD There are calabash and Kiwi. Alternative unit test frameworks are Kiwi,Specta,Quick etc. , and KIF,Subliminal and calabash More applicable to UI Acceptance test level .

  • Testing process And classification

1. Testing process

Demand analysis :

When you are given a requirement or a system to do automation, you don't know anything. Can you do automation ? You do not analyze which modules of the system are suitable for automation and which are not ?

If you do it blindly , When you do it later, your framework may not be ready, or the requirements or system may change again , Have you done useless work ? So our first step must be to determine the requirements or which modules of the system are suitable for automation , And we must understand the benefits of this requirement or system automation , It's not about doing automation for Automation .

Options :

Some people may be unfamiliar with the options , I don't know what this is for ? So a simple question for you , Now the common automated test frameworks are robotium、appium、monkeyrunnner、UIAutomator wait , Which of these frameworks do you choose ? In fact, this is the choice of a scheme , Sometimes you will choose a more suitable framework according to the needs of your project , Let us maximize the benefits of this demand .

Environmental preparation

This is best understood , After the scheme is selected, the environment should be prepared . This environment will not be configured as you think jdk、appium、ide That's it , What you need to consider is appium Version of 、 Continuous integration 、 Code management and so on .

The system design

The system design is mainly about the reasonable design of the whole test framework system , For example, the encapsulation of various common modules , File management of different modules , Separation of configuration data and code 、 Log management, etc . For example, the project construction and implementation are subject to strict scheme design , Then carry out construction according to the design scheme .

code

Coding means writing code , Here we write code according to the designed use cases .

2. Automated test classification

Layered testing

The test pyramid is generally divided into three layers : Underlying unit test 、 The middle layer is interface testing 、 The top floor is UI layer . The tester is usually in UI Layer to test .

Move APP Of UI Automated testing has long been a difficult problem , The difficulty lies in UI Of ” change ”, Changes lead to extensive maintenance of automated use cases . From the perspective of layered testing , Automated testing should be done layer by layer . The largest number of automated tests should be unit tests , The easiest to implement and the easiest to find problems early ; The second is interface level testing , Automation for the purpose of validating logic , Because the interface is relatively stable , The cost of automated testing is relatively acceptable ; The biggest cost of automation is UI Level automated testing , However UI The interface is the effect display directly fed back to the user , Moderate, especially BVT Level automated testing is also very necessary .

  • Mobile operating system and app type

1. Mobile operating system android

Android It's based on Linux Free and open source operating system , Mainly used in mobile devices , Like smartphones and tablets , from Google Leaders of the company and the Open Mobile Alliance (2007 year 11 month ,Google And 84 A hardware manufacturer 、 Software developers and telecom operators form an open mobile phone alliance ) And development .

Android The operating system was originally built by Andy Rubin Development , It mainly supports mobile phones .2005 year 8 Month by month Google Acquisition and capital injection .

First part Android Smart phones are released in 2008 year 10 month .Android Gradually expand to tablet computers and other fields , Like TV 、 Digital camera 、 Game consoles, etc .2011 First quarter ,Android For the first time, its market share in the world exceeds that of Symbian system , Ranking first in the world .

2013 year 09 month 24 The operating system developed by Google in Japan Android Here we are 5 birthday , The number of devices using this system in the world has reached 10 One hundred million units .

And then 2014 China has also ushered in the climax of mobile Internet , especially O2O“ Thousand regiment war ”, Taxi travel software subsidy war, etc .

  1. app Three types and differences

2.1 Native application :(Native App)

Native APP What is it? ? Native APP Is the use Android、iOS The official development language of the platform 、 Develop class libraries 、 Tools for development . Like Android java Language ,iOS Of object-c Language . It should be the best in application performance and interaction experience .

advantage :

1、 All functions of the phone can be accessed 、 The most complete functions can be realized ;

2、 Fast running speed 、 High performance , Great user experience ;

3、 Support a lot of graphics and animation . No card , quick .

4、 Use the interface provided by the device side quickly , There is an advantage in processing speed .

shortcoming :

1. In the past, the cost was mainly high 、 Cycle is long ,Android and iOS All need to be developed separately .

2. To update the version, you need to download the installation package again .

2.2 Hybrid application (Hybrid App)

That is, the use of native APP The development technology also applies HTML5 Development technology , It's original and HTML5 Mixed application of Technology . The mixing ratio is unlimited .

advantage :

1、 Short development cycle ;

2、 Feature updates are released quickly ;

shortcoming :

1、 User experience is not as good as local application ;

2、 Performance is a little slow ( Need to connect to the network );

2.3.Web edition APP (Web App)

The essence is the superposition of browser functions , Use common Web Development language development , Run through a browser .

advantage :

1、 Support a wide range of ;

2、 Low development cost 、 Cycle is short .

shortcoming :

1、 High requirements for networking , You can't do anything offline ;

2、 Limited function ;

3、 Slow running speed , Pages can't carry too many things ;

4、 Low support for pictures and animations ;

5、 If users use more new browsers , Then there will be operational problems .

2.4.Web App、Hybrid App、Native App Technical characteristics

Mobile Games app And mobile phones App

Mobile games generally use engine development , Now the famous ones are cocos2d and unity3d. Both are developed using the engine's own language , The mainstream difference is c++ and c#, Although there are also the concepts of buttons and other controls in the development process , But when the runtime is rendered by the engine, it becomes a simple picture :

mobile phone App In general use Android SDK Development , Use Java To write . adopt Android Services provided , We can get App View information of the current window , And then find and operate controls such as buttons , To complete automated testing , Such as Uiautomator. This process is standardized , Technically speaking, there is no difficulty , So each company has its own App The methods of automated testing are similar .

  • Android SDK Introduce

Concept

SDK:(software development kit) Software development kit . Used by software development engineers for specific packages 、 software framework 、 Hardware platform 、 Set up the development tools of application software such as operating system .

therefore ,Android SDK refer to Android Exclusive software development kit . source : Baidu Encyclopedia

Download and install

First of all, it needs to be installed and configured jdk Environmental Science .

C:\Users\Shuqing>java -version

java version "1.8.0_05"

Java(TM) SE Runtime Environment (build 1.8.0_05-b13)

Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

Android SDK Package download

Android SDK Manager

Start after installation  SDK Manager.exe  The program will see Android SDK Mannerger Main interface .

Tools Catalog :

Android SDK Tools( must , Just download one version , Generally choose the latest version ): Basic Kit , Version number with rc It's a preview version .

Android SDK Platform-tools( must , Just download one version , Generally choose the latest version ): from android2.3 Start to draw out this list , Store utility development tools , such as adb、sqlite3 etc. , It's classified here .

Android SDK Build-tools( must , Multiple versions can be installed ):Android Project building tools .

Android xxx(API xx)  Catalog ( Optional platform development tools ):

  • Documentation for AndroidSdk( Optional ): Some offline documents on the Android Developer website , But it's slow to download and open , Another offline version will be available later .
  • SDK Platform( must ): Development tools corresponding to the platform , Download whatever version of the platform you need to develop .
  • Samples for SDK( Optional , This item is in a later version tools No more , Need to be in IDE Pass through Import Sample introduce , Of course, you can download the offline version ): Built in Android sample program , Recommended installation .
  • Sources for Android SDK( Optional ): Android API Source code , Recommended installation .
  • ARM /Intel xxxx Image( Optional ): Each with Image At the end of the article is the simulator supporting the corresponding platform , Let's think of it as a brush bag .( No need to install if you use real machine debugging or other simulators )

Extras Catalog ( Optional extensions ):

  • Android Support Repository( Optional ): It's mainly convenient in gradle Use in Android Support Libraries, because Google These libraries are not published to maven center perhaps jcenter Go to , It USES Google Their own maven Warehouse .
  • Intel x86 Emulator Accelerator(HAXM installer)( Optional ):windows Platform Intel x86 Simulator acceleration tool , coordination Intel x86 atom/atom_64 System Image Use to speed up the simulator .

Android SDK File directory

add-ons

There's an add-on library , The third party company is android Platform development of additional function system . such as GoogleMaps, Of course, if you install OphoneSDK, There will also be some class libraries in it .

docs

Inside is Android SDKAPI Reference documents , be-all API You can find it here .

extras

This folder contains Android support v4,v7,v13,v17 package ; also google Provision USB drive 、Intel Provide hardware acceleration and other additional kits , and market_licensing As AndroidMarket Copyright protection components , Generally, when publishing payment is applied to the electronic market, it can be used to fight against piracy .

platforms

It's for every platform SDK Real documents , Different versions of android System . It will be based on APILevel The division of SDK edition .

samples

yes Android SDK The default sample project comes with , Inside apidemos It's highly recommended for beginners xi , about SQLite Database operations can be viewed NotePad This example , For game development Snake、LunarLander All good examples , about Android Lord Question development Home It is androidm5 The theme design principle of the times .

Environment variable Settings

  • Add the variable name to the system variable ANDROID_HOME The path is the actual storage SDk The path of

Uploading … Re upload cancel

  • Several other paths are configured to the system environment Path As shown in the figure below :

Uploading … Re upload cancel

Configure detection

stay cmd Interface input “adb” and "aapt" To determine whether the installation was successful .

adb command

C:\Users\Shuqing>adb

Android Debug Bridge version 1.0.39

Revision 3db08f2c6889-android

Installed as E:\Andriod_sdk\platform-tools\adb.exe

global options:

 -a         listen on all network interfaces, not just localhost

 -d         use USB device (error if multiple devices connected)

 -e         use TCP/IP device (error if multiple TCP/IP devices available)

 -s SERIAL

     use device with given serial number (overrides $ANDROID_SERIAL)

 -p PRODUCT

     name or path ('angler'/'out/target/product/angler');

     default $ANDROID_PRODUCT_OUT

 -H         name of adb server host [default=localhost]

 -P         port of adb server [default=5037]

 -L SOCKET  listen on given socket for adb server [default=tcp:localhost:5037]

aapt command

C:\Users\Shuqing>aapt

Android Asset Packaging Tool

Usage:

 aapt l[ist] [-v] [-a] file.{zip,jar,apk}

   List contents of Zip-compatible archive.

 aapt d[ump] [--values] [--include-meta-data] WHAT file.{apk} [asset [asset ...]]

   strings          Print the contents of the resource table string pool in the APK.

   badging          Print the label and icon for the app declared in APK.

   permissions      Print the permissions from the APK.

   resources        Print the resource table from the APK.

   configurations   Print the configurations in the APK.

   xmltree          Print the compiled xmls in the given assets.

   xmlstrings       Print the strings of the given compiled xml assets.

  • Android SDK   install

  Android sdk Refer to the document for installation 《Android sdk install 》

  a key : Learning materials of course, learning is inseparable from materials , Of course, here is also prepared for you 600G Learning materials

Required first Focus on Then private my keyword 【000】 Get it for free Note that the keywords are :000

doubt : Why pay attention first ?    return : Because if you don't pay attention, you can't see the private letter

Project practice

app project , Bank Project , Medical Project , Online retailers , Finance

Large scale e-commerce projects

Full set of software test automation test teaching video

300G Download tutorial materials 【 Video tutorial +PPT+ Project source code 】

A complete set of software testing automation testing factory has been

python automated testing ++ A complete set of templates + Performance testing

It's said that the iron juice who has paid attention to me for three consecutive years has been promoted, raised and made a fortune !!!!

原网站

版权声明
本文为[Test Architect Bei fan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207010112214785.html