测试第三方服务
国内
- https://bugly.qq.com/v2/ 腾讯的bugly 免费, 而且相当好用
- 腾讯优测云 提供真机测试和漏洞分析
- Testin
- MTC
- 易测云
国外
- TestCloud
- Testdroid
- Nimbledroid Automated performance analysis website
- Test bird APP和手游测试
第三方性能采集SDK
自动化测试
- CircleCI 一个基于Github的自动化测试,单元测试工具,提供一个免费的私有仓库。
Google官方学习资料
- Best Practices for Testing 【最新/重点】
-
Android Testing Support library (ATSL) 【重点】
相关视频: Android Testing (Android Dev Summit 2015) youtube 2015年视频 - Developer API Testing Concepts
优秀博客
-
Leveraging product flavors in Android Studio for hermetic testing 与之对应的 codelab学习地址
笔记:
- two JUnit Rules @rule will be launched before @Before. The ActivityTestRule is a rule that provides functional testing of a single Activity.
-
Test coverage report for Android application 使用jacoco-android plugin in a build.gradle
进行测试覆盖率报告
sample - Android单元测试在蘑菇街支付金融部门的实践 很详细介绍了单元测试在实践操作中的使用
RxJava Test**
- Unit Testing RxJava Observables and Subscriptions
- Unit Testing RxJava Observables
- Unit Testing with RxJava
测试框架
Unit Testing
-
Junit4 Github A programmer-oriented testing framework for Java.
http://junit.org/junit4/ - Mockito Tasty mocking framework for unit tests in Java
-
JMockit An automated testing toolkit for Java
对比: mockito不能mock static method和final class、final method,JMockit可以;
对比Mockito和JMockit的文章 - PowerMock 一个可以Mock静态类的开源库
Tools for UI Testing: Robotium, Appium, Calabash, Robolectric.
UI Testing
- Espresso Android 官方推荐使用的UI测试库
- UIAutomator 可以夸应用进行测试
- Robolectric is a unit test framework that de-fangs the Android SDK jar so you can test-drive the development of your Android app. Tests run inside the JVM on your workstation in seconds
More
- RoboSpock Github A testing framework which brings powers of Spock and Groovy to Android app testing http://robospock.org
-
Hamcrest matchers
What is Hamcrest?
Hamcrest is a library of matchers, which can be combined in to create flexible expressions of intent in tests. They've also been used for other purposes.
开源库
Collection
- awesome-android-testing collection of android test info 【重点】
Sample
- android-gradle-java-template Gradle + Android Studio + Robolectric + Espresso + Mockito + EasyMock/PowerMock + JaCoCo Demo
- Android-Clean-Testing Android Testing Sample Project
- robotium-showcase This example shows how to use Robotium with ActvitityTestRule and @Test annotation, it means in Google's Espresso way.
Google Sample
- android-testing-templates
- android-testing A collection of samples demonstrating different frameworks and techniques for automated testing
Tools 测试工具
square/spoon
在adb devices 检测到的设备跑测试程序,并提供截屏,文件,数据库操作:
Files
最最重要的是生成简单明了的测试报告:
displaying the results in a meaningful way
Android Studio 2.2 Preview new feature:
-
Espresso Test Recorder 菜单/run/Recorder Expresso Test 选项可以记录你的操作并转化为Espresso 的测试代码
-
APK Analyzer 菜单/build/Analyzer APK 提供APK大小分析工具,清楚的知道代码体积变换的趋势。
.png
screengrab 当UI Tests 时自动化截屏
STF 远程控制,一台电脑控制测试多个测试设
openstf.github.io Control and manage Android devices from your browser
开发时的调试工具
stetho
Facebook开源,很强大的Android网络和数据库调试工具,能像调试WebApp一样调试Android原生应用。借助Stetho在Chrome上调试Android网络&数据库
常用配置:
- 初始化
public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
Stetho.initializeWithDefaults(this);
}
}
- Chrome浏览器打开
chrome://inspect/#devices
augmented-traffic-control
Fackbook开源项目模拟移动网络,对App的调试及网络优化有很大的帮助,主要参数有:
网络带宽(bandwidth)
延迟(latency)
丢包率(packet loss)
错包率(corrupted packets)
乱序率(packets ordering)
GT(随身调) 腾讯开源的测试套件
能Android设备上安装,进行移动
调试,确保测试数据的真实有效性
开源地址: https://github.com/TencentOpen/GT
官网地址
使用GT APP进行快速的性能测试(CPU、内存、流量、电量、帧率/流畅度等等)、开发日志的查看、Crash日志查看、网络数据包的抓取、APP内部参数的调试、真机代码耗时统计等。
一. 基本功能测试
1. CPU占有率;
2 jiffes(CPU时间片);
3. 内存PSS值稳定在36M;
4. 网络上行流量和下行流量;
5. "数据存档"
二. 电量测试
再启动电流监控观察,1分钟后平均电流是220mA
三. crash
- 保存了抓包文件后;
- Logcat查看界面,立即把手机缓存的Logcat日志保存下来;
四. Net
- 系统提供的流量查看也包括局域网socket的流量,而且不能分时段统计;
- tcpdump抓包(需要手机root) + Wiresharek 抓包分析;
疑问点:
1. 激活FPS(帧率)的监测;
网友评论