当前位置:网站首页>(1) CTS tradefed test framework environment construction
(1) CTS tradefed test framework environment construction
2022-07-26 08:55:00 【apprentice.】
Before you know it , It has been almost two years since graduation . One of them is engaged in CTS Test automation has been working for more than a year . In the meantime, it's good for Google Have a certain understanding of the implementation principle of certification test . And more interested in the framework that performs these certification tests , This series of blogs is mainly to review what I have learned Tradefed The test framework .
List of articles
1.Tradfed The framework is introduced
Tradefed By Google Developed a set of automated testing framework , Mainly used in relation to Android Automatic testing of mobile phones . It's powerful , Support multiple test types , Such as AndroidJunit test , Host side Jar Package testing , be based on C++ Of Gtest Testing, etc , It also supports a variety of pre test operations , Such as Fastboot Brush machine , modify Settings database , install APK, Modify test environment . When there are too many test cases , You can also use the idea of space-time transformation , Increase the number of test equipment , Divide the test cases equally to multiple devices for testing . Google certification series test (CTS/VTS/GTS/GSI) Are based on this framework .
2. Build a local test environment
I've always believed in a word :“ Teaching a man to fish is better than giving him a fish ”, Although this series of blogs is mainly about Tradefed Framework implementation principle , But I think it is more important to teach how to learn this framework . With learning methods , Even if you change the framework , Can also grasp its principle more quickly .
For a testing framework , To understand the implementation principle , The first is to learn how to use this framework . It's like trying to figure out how a car works , First of all, you should be able to drive ( Be careful : It doesn't mean driving ), On this basis, it will be easier to understand how the car starts . therefore , We can learn how to call this framework to run tests through a simple example .
First of all, We should first build the execution environment of this framework , Only this framework environment has been built , In order to carry out the corresponding test . This series of blogs will choose Native CTS Test package To explain Tradefed frame , because CTS in the light of Tradefed Second encapsulation is carried out , Enrich more functions , And there are actual test cases , It's easier to do debug, Explain .
2.1 Test package download
This article selects the latest version available at present CTS Test package (11-r3 edition ), The browser accesses the following address to download :
https://dl.google.com/dl/android/cts/android-cts-11_r3-linux_x86-arm.zip?hl=zh_cn
After downloading, unzip the test package .
2.2 WSL build
CTS Testing Google requirements is required in Linux Proceed under , But because of the passage of VMware Build virtual machine Linux The environment is cumbersome . Use it directly here Win10 Self contained Linux The subsystem is used to execute CTS test ( verified WSL perform CTS Test and pure Linux There is no difference in execution under the environment ). about WSL Build , There are many online teaching blogs , How to build is not specifically explained here WSL.
2.3 WSL Environment configuration
in the light of WSL Environment configuration of , The main thing is to run CTS Environmental requirements during testing , The following environments are mainly needed :
- JDK 11 And above
- ADB Tools (Windows Edition and Linux Both versions are required , And the version number must be the same )
- AAPT Tools
It needs to be emphasized again ADB Version of , Make sure Windows Under the ADB And Linux Under the ADB Same version , Only in this way can the test be carried out normally , Here we share the two platforms ADB Download address :
https://dl.google.com/android/repository/platform-tools_r31.0.2-linux.zip?hl=zh_cn # linux platform
https://dl.google.com/android/repository/platform-tools_r31.0.2-windows.zip?hl=zh_cn # Windows platform
Put these two SDK After downloading and installing the tool ,Windows The version is in Windows Configure the environment variables ,Linux The environment variables of the version in the subsystem are also configured , Plug in your phone and turn on developer mode -usb Debugging options , Execute on the command line adb devices, If there is a device output , Then represent adb The environment is set up .
Pictured above , stay Windows and Linux Both can pass adb To find the device .
Install it later java and aapt that will do , Be careful , Because of this ubuntu The default image source download tool is slow , We can change it to Alibaba's image source , Need to use root User rights to edit sources.list file . First, in the cmd Window run wsl Instructions , Get into Linux Subsystem , Then execute the following instructions to edit
vim /etc/apt/sources.list
List here ubuntu 18.04 Version of Alibaba image source , If other versions are installed ubuntu, Please Baidu's corresponding version of the image source
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
Then execute the following instructions , Can install java The environment and aapt Environmental Science
sudo apt install openjdk-11-jre-headless
sudo apt install aapt
3. Execute the test package
3.1 Test package introduction
Next let's look at 2.1 The test package downloaded in step , Unzip it , After entering the unzipped file, there will be the following contents :
- testcases: It mainly stores the relevant contents of test cases
- tools: It mainly stores the test framework, tools and other related contents
This time we mainly focus on the research framework , So enter tools Catalog :
There are a lot of documents here , Pick the more important one here :
- tradfefed.jar : tradfed Compiled by the framework jar package
- cts-tradfed.jar: cts The test suite is for tradfed The content of the secondary development of the framework
- cts-tradfed: Start the test script of the test (shell)
3.2 Start the test package
Because to start cts test suite , So we need to get to Linux Interface cts-tradfed that will do :
such ,CTS The test framework starts .
You can manually execute a test instruction , Look at the effect
run cts -m CtsJniTestCases
If it can be successfully executed , It means that the environment is built , If it is not successfully executed , Consider whether it is the following problem :
- Subsystem ADB Is the version consistent with Windows End consistent
- Whether the inserted mobile phone is Android 11 edition
To the next section , Will explain the meaning of this instruction .
If there are other questions , Welcome to leave a message on the blog .
边栏推荐
- [recommended collection] MySQL 30000 word essence summary + 100 interview questions (I)
- Study notes of automatic control principle --- stability analysis of control system
- idea快捷键 alt实现整列操作
- day06 作业--技能题6
- [encryption weekly] has the encryption market recovered? The cold winter still hasn't thawed out. Take stock of the major events that occurred in the encryption market last week
- IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
- Neo eco technology monthly | help developers play smart contracts
- 2022年收益率最高的理财产品是哪个?
- CSDN TOP1“一个处女座的程序猿“如何通过写作成为百万粉丝博主?
- 机器学习中的概率模型
猜你喜欢
随机推荐
Database operation topic 1
数据库操作技能7
ES6 modular import and export) (realize page nesting)
Replication of SQL injection vulnerability in the foreground of Pan micro e-cology8
sklearn 机器学习基础(线性回归、欠拟合、过拟合、岭回归、模型加载保存)
pl/sql之集合
Introduction to AWD attack and defense competition
合工大苍穹战队视觉组培训Day6——传统视觉,图像处理
[freeswitch development practice] user defined module creation and use
03 exception handling, state keeping, request hook -- 04 large project structure and blueprint
Day06 homework - skill question 6
keepalived双机热备
Overview of motion recognition evaluation
P3743 Kotori's equipment
Implementation of Prometheus web authentication and alarm
Oracle 19C OCP 1z0-082 certification examination question bank (7-12)
Learning notes of automatic control principle --- linear discrete system
day06 作业---技能题7
Uni app simple mall production
Deploy prometheus+grafana monitoring platform








![[untitled]](/img/89/c3ab79eb325f0136114a568745924b.png)
