There are a lot of tools for automated Testing on Android, but there are only a few that are in mainstream use right now. I’ll elaborate on each of them, and you can decide which one you want to use.
Test package
Appium
Appium is the most mainstream mobile test automation framework available today, supporting not only Android applications, but also iOS, hybrid, and Web applications.
The underlying API for Selenium and WebDriver is fully used, so if you’ve used Selenium before, you can use Appium at almost no additional learning cost.
Appium supports Android through UIautomator (API level 16 or higher) and Seledroid (API level 16 or lower), but you don’t need to know how to use either framework. Appium encapsulates the same rules for you to use.
One of the great advantages of Appium is that you can write Appium scripts in almost any programming language, such as Java, Objective-C, JavaScript, PHP, Ruby, Python, or C#.
That means it’s up to you to use whatever programming language you’re best at. If you’re familiar with Selenium, you should be able to use it in a day.
In addition, WebDriver is a unified standard that has been submitted to the W3C organization, and you can make further extensions based on its protocol. Look at the simple code:
textFields = driver.find_elements_by_tag_name('textField')
assertEqual(textFields[0].get_attribute("value"), "Hello")
Copy the code
Airtest
Second, I would recommend the domestic light Airtest. Airtest project is an automated test framework launched by netease Games. The project has several components:
-
Airtest: Airtest is a cross-platform, image recognition based UI automation testing framework for games and apps on Windows, Android and iOS
-
Poco: Poco is an automated testing framework based on UI control recognition. Currently, it supports Android native app/iOS native app/ wechat small program, as well as mainstream game engines. It can also be used by accessing POCO-SDK in other engines
-
Airtest and Poco plug-ins are built in. You can use it to write Airtest and Poco code quickly and easily, even without writing any code.
-
AirLab: Real machine automation cloud testing platform, provides a lot of mobile phone model and compatibility testing, overseas cloud machine compatibility testing and other services
-
Privatization of mobile phone cluster technology solutions: from hardware to software, to provide enterprise internal privatization of mobile phone cluster solutions
The advantage of using Airtest is that the Chinese document is sound, and the students who are not good at English support optimization. The website is also thoughtful to prepare video teaching and demonstration, help you quickly get started.
Detox
This framework is very low-key, but you’ll love it once you use it.
Detox is a very strong JavaScript mobile testing framework. Its test execution is very fast and robust because no external additional tools are required for choreography and synchronization during test execution.
You can go straight to Detox if you want:
-
Use the JavaScript programming language
-
Easier to debug than other test automation frameworks
-
The app was developed in React Native and can be quickly integrated with Detox
-
Faster than Appium in terms of test execution
-
Documentation is relatively easy to grasp
Here is the concrete code, a more typical way to write code:
describe('HelloDetoxTest', () => { beforeEach(async () => { await device.reloadReactNative(); }); It (' there should be welcome screens ', async () => {await expect(element(by.id ('welcome'))).tobevisible (); }); it('should show hello Rect after tap', async () => { await element(by.id('hello_react')).tap() ; await expect(element(by.text('React!!! '))).toBeVisible(); }); Async () => {await element(by.id ('detox_button')).tap(); await expect(element(by.text('Detox!!! '))).toBeVisible(); }); });Copy the code
Espresso
Espresso is a new Android test automation framework, open source by Google. Espresso’s API is small, predictable, and easy to learn.
You can use it to quickly write clean and reliable Android UI tests.
It’s very reliable, synchronizes with the UI thread, and is fast because it doesn’t require any sleep (tests run in the same millisecond when the application is idle). Test package
And with simple configuration, it can be integrated directly into appium.