Background
As we all know, there are many automation testing tools available in the market. For web automation, we have Selenium, Robot Framework, Playwright, etc. For API automation testing, tools like HttpRunner, Postman, and JMeter are popular. Performance testing can be done using JMeter, LoadRunner, Locust, nGrinder, etc., while mobile testing can be handled by Appium, Airtest, and others. But is there a tool that supports multi-platform testing? Certainly, Airtest supports mobile and web testing, but it does not support API testing (although scripts can be written to achieve this). Robot Framework supports web, mobile, and API testing but does not support performance testing. Additionally, similar testing tools each have their own characteristics. For example, Airtest supports image recognition for controls, Robot Framework can be seen as a high-level wrapper for Selenium and Appium, reducing the cost of code writing. HttpRunner allows API test cases to be completed through configuration, lowering the barrier for script writing, and can directly convert API test cases into performance test cases using Locust. Is it possible to integrate all these tools into a single framework? Based on this idea, Airobots was born.
Introduction
The name Airobots comes from the combination of Airtest and Robot Framework. Naturally, the framework is an integration of Airtest and Robot Framework, and it can also be understood as an extension of the web testing plugin Airtest-Selenium. To also support API testing and performance testing, HttpRunner is a good choice, so this tool has also been integrated. Thus, Airobots has the following capabilities:
1. Supports mobile testing
2. Supports web testing
3. Supports desktop application testing
4. Supports API testing
5. Supports performance testing
6. Control recognition supports XPath (and other traditional methods) and image recognition
7. Test case execution is based on pytest, allowing customization of test case execution order and data-driven generation of test cases
8. Test reports based on Allure, high-end and elegant
Installation
1. Install Python Runtime Environment
The installation process is brief; it is recommended to install Python 3.8 or higher.
2. Install Airobots
GitHub address: https://github.com/BSTester/Airobots
One-click installation:
pip install airobots -i https://mirrors.aliyun.com/pypi/simple
If the installation fails on Windows, it may be necessary to install the C++ build tools: visualcppbuildtools_full.exe. Please pay attention to the console error messages for specific errors.
To run WEB tests, you need to install ChromeDriver and GeckoDriver. You can download them from https://npm.taobao.org/mirrors/ or install Node.js and execute the following command:
npm install -g chromedriver geckodriver
3. Install Allure
Running Allure requires a Java runtime environment. The installation process for Java is brief; please install it yourself and configure the environment variables.
-
Linux
sudo apt-add-repository ppa:qameta/allure
sudo apt-get update
sudo apt-get install allure
-
Mac OS X
For Mac OS, you can install it automatically via Homebrew.
brew install allure
-
Windows
For Windows, you can obtain Allure from the Scoop command line installation program.
To install Allure, please download and install Scoop (you may need to use a VPN), then execute the following in PowerShell:
scoop install allure
Executing Tests
-
Functional and API Testing
Allure Report (Recommended)
airobots -t api ./API/Case/Path/ --alluredir=Results --clean-alluredir # API Testing
a robots -t web ./Web/Case/Path/ --alluredir=Results --clean-alluredir # Web Testing
a robots -t android ./Android/Case/Path/ --alluredir=Results --clean-alluredir # Android Testing
a robots -t ios ./IOS/Case/Path/ --alluredir=Results --clean-alluredir # iOS Testing
HTML Report
airobots -t api ./API/Case/Path/ --html=Results/report.html # API Testing
a robots -t web ./Web/Case/Path/ --html=Results/report.html # Web Testing
a robots -t android ./Android/Case/Path/ --html=Results/report.html # Android Testing
a robots -t ios ./IOS/Case/Path/ --html=Results/report.html # iOS Testing
-
Performance Testing
locusts ./API/Case/Path/ # Performance Testing
View Allure Report
allure serve ./Results
Demo Project
GitHub address: https://github.com/BSTester/AirobotsDemo
In the next issue, we will introduce how to write web test cases using Airobots.