当前位置:网站首页>(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 .
边栏推荐
- File management file system based on C #
- Day06 homework -- skill question 2
- 【FreeSwitch开发实践】使用SIP客户端Yate连接FreeSwitch进行VoIP通话
- 《Datawhale熊猫书》出版了!
- Which financial product has the highest yield in 2022?
- 合工大苍穹战队视觉组培训Day6——传统视觉,图像处理
- Database operation skills 7
- Self review ideas of probability theory
- 【加密周报】加密市场有所回温?寒冬仍未解冻 盘点上周加密市场发生的重大事件
- [suggestions collection] summary of MySQL 30000 word essence - locking mechanism and performance tuning (IV) [suggestions collection]
猜你喜欢

Review notes of Microcomputer Principles -- zoufengxing

03异常处理,状态保持,请求钩子---04大型项目结构与蓝图

Day 6 summary & database operation

Sklearn machine learning foundation (linear regression, under fitting, over fitting, ridge regression, model loading and saving)

ES6模块化导入导出)(实现页面嵌套)

Cadence (x) wiring skills and precautions

Day06 operation -- addition, deletion, modification and query

海内外媒体宣发自媒体发稿要严格把握内容关
![[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](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[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

One click deployment of lamp and LNMP scripts is worth having
随机推荐
Day06 operation -- addition, deletion, modification and query
Neo eco technology monthly | help developers play smart contracts
Set of pl/sql -2
Registration of finite element learning knowledge points
Day06 homework - skill question 7
OA项目之我的会议(会议排座&送审)
有限元学习知识点备案
C#入门系列(三十一) -- 运算符重载
[freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls
数据库操作技能7
Super potential public chain dfinity -- the best time for DFI developers to enter
Sklearn machine learning foundation (linear regression, under fitting, over fitting, ridge regression, model loading and saving)
【搜索专题】看完必会的搜索问题之洪水覆盖
pl/sql之动态sql与异常
Day06 homework -- skill question 1
03 exception handling, state keeping, request hook -- 04 large project structure and blueprint
Database operation topic 2
keepalived双机热备
Review notes of Microcomputer Principles -- zoufengxing
Kept dual machine hot standby