2023! 6 tips to master 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. Available for operating systems IOS and Android as well as firefox. Native applications refer to applications written with 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. A hybrid application refers to an application that wraps a webview and is natively applied to the interactivity of web content. The important thing is that Appium is cross-platform. What is cross-platform means that you can use a set of APIs to write test cases for different platforms.

Appium environment setup

First, install the environment for later use. Open the Appium application and click 3 to monitor the environment.

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

Carry out actual project development

Automated test project construction

  • .zip is a compressed file of .app. Of course, you can also use XXX.app directly (xcode compiles the project, and there is XXX.app in the Products directory)
  • common contains common .rb files for testing
  • gemfile required gem package
  • spec file contains test rb files for all modules
现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:110685036

Simulator running project

Configure appium

  • The APP path must be correct
  • The device simulator and version must match
  • Required in the red box (boudleID does not need to be written)

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

Click on Record


As for how to write test code, there are two ways. One way is to operate the page directly in the page area and generate the test code in the code area (this code uses xpath to traverse and locate elements, which is not efficient). The other is to use appium to provide Write test code using the positioning element method.

If this page does not pop up, you can try

  • Change server address: 127.0.0.1
  • Check if the packaged .app file is compiled with a development certificate
  • Check whether the current Xcode simulator is consistent with the currently selected device
  • If that doesn't work, try changing the .app

How to write .rb?

There may be some newbies who 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 enable service
  • To rspec execute the command
  • Then the simulator will automatically start executing all the .rb files in your rspec.

Summarize

There are still many pitfalls here. Go to testhome and have a look. Appium provides many methods. This is an experience that takes a lot of time to try. Important element positioning methods, writing test cases, and understanding of the ruby ​​language, If the above is completed, then you can learn how to use Jenkins to deploy project automation tests~ The above content is the entire content of this article. I hope it will be helpful to you. Friends who have been helped are welcome to like and comment.

Finally, I would like to thank everyone who has read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.
 

Insert image description here

Guess you like

Origin blog.csdn.net/myh919/article/details/132901345