当前位置:网站首页>Appium fundamentals of automated testing - basic principles of appium

Appium fundamentals of automated testing - basic principles of appium

2022-07-01 03:38:00 Test - Eight Precepts

1、APPium Automated test architecture

APPium It's a C/S Automated test framework for architecture ,APPium The core of is actually an exposed series REST API Of server.( That is to say Appium The core of is one that provides a set of REST API Of Web The server .)
This server It's very simple : Listening on a port , Then receive from client( client ) Sent to command( command ). Translate these command, Put these command Transfer to a form that mobile devices can understand and send to mobile devices , Then the mobile device performs these command after , Return the execution result to appium server,appium server Then return the execution result to client.
ad locum client In fact, it is to initiate command The equipment , Generally speaking, it is our code execution machine , perform appium The machine that tests the code . In a narrow sense , You can put client Understood as code , The code can be java/ruby/python/js Et al. , As long as it does webdriver A standard agreement will do .
This design idea brings some benefits :

  1. Can bring multilingual support ;
  2. You can put server Put it on any machine , Even ECS can ;
    ( Yes ,appium and webdriver Naturally suitable for cloud testing )

2、APPium Architecture diagram :

3、Session

  • session It's just a conversation , stay webdriver/appium, All your work is always session start It can be done after .
  • Generally speaking , adopt POST /session This URL, Then incoming Desired Capabilities( One JSON object ) I can turn it on session 了 .
  • Turn on session after , Will return a globally unique session id, In the future, almost all requests must bring this session id, Because of this seesion id Represents the browser you open or the simulator of your mobile device .
  • Think further , because session id It's the only one , Then start multiple... On the same machine session It becomes possible , This is the same. selenium gird The specific theoretical basis .

4、Desired Capabilities

Desired capabilities Yes, send to Appium A set of keys and values on the server side ( That is, mapping or hashing ), It carries some configuration information .
essentially , What is this thing key-value The object of form . You can understand it as java Inside map,python Dictionary in ,ruby Inside hash as well as js Inside json object . actually Desired Capabilities In transmission, it is json object .
Desired Capabilities The most important role is to tell Appium server The context of this test .

  • Is this a browser test or a mobile test ?
  • If it is a mobile terminal test, it is a test android still ios?
  • If you test android So which one are we going to test app?

Appium server These questions Desired Capabilities Must be answered , otherwise Appium server Don't buy it , Naturally, you can't complete the movement app Or the start of the browser .
The details are as follows :
For example, we might set the platformName capability to iOS to tell Appium that we want an iOS session, rather than an Android one. Or we might set the safariAllowPopupscapability to true in order to ensure that, during a Safari automation session, we’re allowed to use JavaScript to open up new windows. See the capabilities doc for the complete list of capabilities available for Appium
Translate the following :
for example , We can platformName The function is set to iOS, Informing Appium We want one iOS conversation , instead of Android conversation . perhaps , We can safariAllowPopupscapability Set to true, To ensure that Safari During an automation session , Allow us to use JavaScript Open a new window . Refer to the feature documentation for information that can be used to Appium A complete list of functions .

5、Appium Server

This is every time we use... On the command line appium Something ordered to open .
Appium server Yes, it is Node.js Written . We can compile with source code or from NPM Direct installation .
Installation mode
$ npm install -g appium $ appium
explain :

  • Appium There are many language libraries on the server side Java, Ruby, Python, PHP, JavaScript and C#, These libraries all implement Appium Yes WebDriver Protocol extension .
  • When using Appium When , You just need to use these libraries instead of regular WebDriver Library will do .
    Tips : We do not recommend using this method for installation Appium, The following is recommended Appium Desktop Installation by .

6、Appium Clients

Because of native webdriver api Is for web End design , Therefore, it will be a little nondescript to use on the mobile end .appium The government provided a set of appium client, Covering multiple languages ruby/java/python, in my opinion ruby client To achieve the best .
During the test , Generally use these client Library to replace native webdriver library .
This is not actually a replacement , Count as client Primordial webdriver Some mobile terminal extensions are carried out , Added some convenient methods ,appium client Let's make it easier to write test cases with better readability .
Appium Download address of client library :http://appium.io/downloads.html

7、Appium Desktop

Appium Desktop Is in Appium Server It is encapsulated into a server with a graphical interface , You can download and install... On any platform .
It's related to running Appium Server Everything you need is bundled together , So don't worry Node Environmental Science .
It also comes with a checker , Used to view the hierarchy of applications, etc . When writing tests , This will come in handy .

a key : Supporting learning materials and video teaching

So here I have carefully prepared the detailed information of the above outline in The link below is as follows

原网站

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