Introduction to common tools for MacApp automated testing

Automated testing in China is mainly based on unit testing, API testing, and WebUI testing, but it is rarely involved in MacApp testing. However, according to statistics in 2021, the MacBook market share is close to 10%, which is a 26% increase compared to the previous year, which shows that the development momentum is very good.

The application MacApp on this MacBook is also developing in an orderly manner, and testers should always do a good job of testing it. This chapter starts from the direction of automated testing and introduces the implementation of MacApp automated testing.

Introduction to MacApp Testing

MacApp refers to the application program running on the MacOS system, and its installation package is mostly based on the dmg program. In terms of program testing, whether it is manual testing or automated testing, it is similar to WinApp testing, starting from the program itself and the exchange with the system. For specific starting points, please refer to 7.1 Introduction to WinApp Testing.

MacApp runs on the Mac OS/Mac OS X system on the MacBook computer as an independent application. It usually has the characteristics of graphical interface, business function, data receiving and display, and fast access speed.

Compared with Windows, Mac OS is a relatively closed circle. The data of applications running on it is relatively safe, and the probability of being attacked by hackers is relatively low. Therefore, MacApp also has a relatively safe operating environment.

As a stand-alone or Client-Server architecture application, MacApp can focus on functional testing, user interface testing, compatibility testing, configuration testing, and interactive testing. Interactive testing focuses on MacOS systems and MacBook hardware devices. on the interaction.

Since the client needs to be installed on the local device, it is necessary to pay attention to the installation/uninstallation and resource occupation. The installation/uninstallation is mainly to understand various problems that may occur during the installation/uninstallation process, and try different methods to verify various possible problems. Various abnormal situations and the ability of the program itself to deal with it, to ensure the correct operation of installation/uninstallation. There are two parts to the resource occupancy test. The first part is the size of the installation program itself and the size of the disk occupied after installation. The second part is the CPU, memory, disk, GPU, network and other overheads of the client when it is running.

The MacApp test is similar to other App tests to ensure its own health and the health of interacting with third-party tools or devices.

MacApp automated testing tool

Since the Mac ecosystem is relatively closed compared to the Windows ecosystem, the MacApp development technology is relatively rare compared to the WinApp development technology, and there are also only a handful of tools related to automated testing. However, with the development of the Mac system, the advancement of software development technology and testing technology, MacApp automated testing tools will become stronger and stronger.

Up to now, MacApp automated testing tools mainly include the following:

 

AppleScript

AppleScript is a scripting language provided by macOS. It is also an object-oriented (Object-Oriented) scripting language. The syntax query is convenient, simple, and close to natural language. Using this language can easily simulate mouse and keyboard operations to complete a series of software operations. Therefore, the development of software automation test scripts can be easily completed using AppleScript.

ATOMac

ATOMac is a Python-based UI automation control library for Mac-side applications implemented through the Apple Accessibility API. Before ATOMac was born, existing tools sent messages through AppleScript, which was very slow. However, ATOMac directly calls the Apple Accessibility API to send messages, so it will be very fast to use and easy to write use cases.

Automation

Automator is a program developed by Apple for the Mac OS X system. A series of actions can be combined into a workflow (Workflow) through simple click, drag and drop operations to complete some repetitive tasks. Software testing engineers can use it to complete automated testing of software.

Automator has a very bright advantage that it can span different programs, such as operating the Safari browser, the program under test, Office, etc. in a workflow. Automator does not need to write codes, and only needs simple mouse operations to complete the creation of simple workflows. It also supports users to write AppleScripts scripts to create workflows.

It is not

Sikuli is a graphical programming technology designed by the MIT (Massachusetts Institute of Technology) research team. Computer users only need to have the most basic programming skills (such as being able to write print "hello world"). They don't need to write a line of code, but use screenshots to combine the cut-out graphic elements into magical programs. The working mode is the same as the human eye, directly recognizing the image instead of the underlying code.

The main advantages of Sikuli are: platform-independent, it can realize any type of UI test, and easily realize cross-platform testing; it is highly readable, and the logical relationship is more vivid and vivid with graphics, easy to understand and easy to maintain; it provides .jar package, It is convenient to build a large-scale test framework and realize the complementarity between various test tools; use case design and program implementation can be separated, use case designers can only focus on graphical logic relationships and test checkpoints, and do not need to understand specific development and programming language foundations; Program implementers can only program without much involvement in design.

Appius

Appium believes that everyone is already familiar with it. In the chapters of APP automation testing and WinApp automation testing, AppiumpPython-Client is used when writing scripts. It is described in the official Appium documentation that Appium provides a beta version that supports automated testing of desktop applications on OS X systems. The driver is developed in appium-mac-driver, but it relies on the local AppiumForMac binary.

The developed driver does not come with AppiumForMac binary files, so you need to manually install the AppiumForMac application and grant permissions when using it.

AutomatorTools

Automator is a native applet that comes with the Mac system. The icon is a small robot, which can be used after opening. Using the Automator tool, we can easily create a series of workflows (workflows can be considered as test cases) to perform some simple or complex tasks.

interface introduction

Click the small robot icon to start the automatic operation Automator program, and enter the document type selection interface after startup. The screenshot is shown in Figure 8-1.

 

We need to choose a document type, choose any one to enter the main interface of Automator, as shown in Figure 8-2. The entire interface can be divided into four parts, namely the execution menu, resource library area, workflow creation area and log area. 

The following is an introduction to each area of ​​the Automator main interface:

There are six buttons in the execution menu area, which are resource library, media, record, step, stop, and run.

  • Resource library: Click the resource library button to display or hide the contents of the resource library on the left.

  • Media: Open the media library to view audio, picture and video files stored in the computer.

  • Recording: After clicking record, the computer enters the recording state, and the user's operation will be recorded as a workflow.

  • Step: One click at a time to run one step in the workflow.

  • Stop: When the workflow is running, click the stop button to stop it.

  • Run: Run the workflow, if it is currently running, the button will be converted to pause.

The resource library area displays various behaviors and variables. Behaviors are operation content, such as accessing web pages; variables are some data we will use, such as computer hostname and IP. The resource library area can be divided into three parts, resource library classification on the left, specific operations on the right, and operation introduction below.

  • Resource library classification on the left: The operations in the resource library are classified into Internet, developer, calendar, etc., so that you can quickly find the required operations.

  • Specific operation on the right: each item represents a specific operation step.

  • The following operation introduction: It is the description of the specific operation selected on the right, which can also be called the summary information.

At the top of the resource library area, there are three contents of operation, variable and search. Operations and variables are used to switch the content displayed in the resource area. If the operation is selected, the resource area will display the operation content. If the variable is selected, the resource area will display various data. Search is used to quickly find a specific action or a variable.

  • Workflow creation area: The workflow creation area is the key area. Drag the operations under the resource library on the left into this area one by one as needed to form a workflow. When running, the operations in the workflow will be executed sequentially from top to bottom.

  • Log area: Displays the operation execution results of the workflow. There are two buttons on the bottom left of the log area, the left is to display the log, and the right is to display variables, and the two can be switched between each other.

When using Automator to create automation use cases, it is almost always done on the main interface.

 

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

These materials should be the most comprehensive and complete preparation warehouse for [ software testing ] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey, and I hope it can help you! Partners can click the small card below to receive 

Guess you like

Origin blog.csdn.net/okcross0/article/details/132562227