2020, 6 ways to play with Appium automated testing

What the hell is Appium

Appium is a mobile automation framework that can be used to test native applications, mobile web applications and hybrid applications, and is cross-platform. It can be used for IOS, Android and firefox operating systems. Native applications refer to applications written in android or ios SDK, and mobile web applications refer to web applications, similar to safari applications or Chrome applications or browser-like applications in ios. Hybrid application refers to an application that wraps webview and is originally used for interactive web content applications.
The important thing is that Appium is cross-platform. What is cross-platform means that a set of APIs can be used to write test cases for different platforms.

Appium environment construction

First install the environment as a backup.
Open the Appium application and click 3 to monitor the environment. The

red box represents what is needed for iOS testing, and the green represents successful installation.

Start the actual project development

Automated test project construction

  • .zip is a compressed file of .app, of course you can also directly use XXX.app (xcode compiles the project, there is XXX.app in the Products directory)
  • common contains common .rb files for testing
  • gem package required by gemfile
  • The spec file contains test rb files for all modules

Simulator run project

Configure appium

  • APP path should be right
  • The device simulator and version must match
  • Required in the red box (boudleID can also be omitted)

After configuration, click => question mark (inspector) to pop up the inspector view element inspection page





After clicking Record

, there are two ways to write test code, one is that you can directly operate the page in the page area, and at the same time generate test code in the code area (this code uses xpath to traverse positioning elements, which is not efficient). The other is Write the test code using the positioning element method provided by appium.

If you can't pop up this page, you can try

  • Replace server address: 127.0.0.1
  • Check whether the packaged .app file is compiled for the development certificate
  • Check whether the current xcode simulator is consistent with the currently selected device
  • If it still doesn't work, please try to replace the .app

How to write .rb?

Maybe some novices still don't know how to start after reading this. Here I have completed the basic framework for everyone to try.
appium demo

Start appium test

  • To open the service
  • Execute command to rspec
  • Then the simulator will automatically start and execute all the .rb files in your rspec

to sum up

There are many more pits in this. Go to testhome to see more, appium provides many methods, this is an experience that takes a lot of time to try. Important element positioning methods, test case writing, understanding of ruby ​​language, If all of the above are completed, then you can learn how to use Jenkins deployment project to automate testing~ The
above content is all the content of this article. The above content hopes to be helpful to you. Friends who have been helped are welcome to like and comment.

Guess you like

Origin blog.csdn.net/Chaqian/article/details/106714400