Mastering Automation Testing: From Web UI to Mobile Apps and API with Selenium, Appium, and JMeter
This guide explains the fundamentals of automation testing, identifies suitable projects, compares common automation types such as web, mobile, and API testing, introduces essential tools like Selenium, Appium, uiautomator2, and JMeter, and provides step‑by‑step code examples to help beginners quickly implement automated tests in real‑world scenarios.
Background
Automation testing transforms manual, human‑driven test execution into machine‑executed processes, saving labor, time, and hardware resources while improving test efficiency. It involves writing code to test other code, and successful adoption requires understanding both testing principles and business logic.
What Projects Can Be Automated
Projects with stable requirements, reducing maintenance overhead.
Products with frequent releases and long lifecycles where test cases can be reused.
Complex business scenarios that are hard to test manually, such as IM message flows.
Repetitive regression tasks like payment verification in online banking.
Automation should be applied where its benefits outweigh maintenance costs.
Common Automation Types
1. Web Automation
Popular tools include Selenium, QTP, WATIR, UFT, Robot Framework, etc. Selenium WebDriver follows a client‑server model where the client sends HTTP requests to a remote server that controls the browser.
WebDriver starts the target browser and binds it to a port.
Client sends commands via the WebDriver Wire Protocol.
Remote server translates commands to native browser actions.
Basic Selenium example (Python):
from selenium import webdriver
import time
def runSelenium():
chrome_path = r'../driver/chromedriver' # path to chromedriver
driver = webdriver.Chrome(chrome_path)
driver.maximize_window()
driver.get('https://www.ziroom.com/')
time.sleep(2)
driver.quit()
if __name__ == '__main__':
runSelenium()Common element location methods: find_element_by_id(), find_element_by_name(), find_element_by_class_name(), find_element_by_xpath(), etc.
2. App Automation
Tools such as Appium, uiautomator2, and ATX can automate mobile applications. ATX is lightweight and supports USB or network connections.
Installation steps (macOS/Linux example):
# Install adb
adb --version
# Connect device
adb connect 127.0.0.1:5555
# Initialize uiautomator2
python -m uiautomator2 init
# Install ATX agent
pip3 install -U --pre uiautomator2
pip3 install --pre weditor
python3 -m weditorSimple ATX script (Python):
import uiautomator2 as u2
d = u2.connect_usb('127.0.0.1:5555')
# Click element by resourceId
d(resourceId="com.ziroom.ziroomcustomer:id/tv_tab_jfk").click()
# Click element by text
d(text="服务").click()
# Set text in input field
d(text="请输入用户名/手机号/邮箱").set_text("18210992070")3. API Automation
API testing sits between unit and UI testing. It validates server responses to simulated client requests. Tools like cURL, Postman, SoapUI, and JMeter are commonly used.
cURL example:
curl -i -H "Accept: application/json" -X GET "http://localhost:8086/index"JMeter workflow includes creating a Thread Group, adding an HTTP Request sampler, configuring parameters, and using listeners such as View Results Tree to inspect responses. Assertions (Response Assertion) can verify response text, status code, headers, etc.
Common Testing Tools
cURL – command‑line HTTP client.
Postman – GUI for API testing.
JMeter – load testing and functional API testing.
SoapUI – SOAP and REST testing.
Robot Framework – keyword‑driven testing.
Example Project
For a typical company, JMeter can handle API automation, while Selenium covers web UI, and ATX + Pytest + Allure can form a complete test framework. The article emphasizes starting with API automation to cover core logic before expanding to UI tests.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
