設定android 測試環境

15
設定Android 單元測試環境

Upload: -

Post on 14-Feb-2017

424 views

Category:

Software


0 download

TRANSCRIPT

設定Android 單元測試環境彥彬

Libraries

Roboletic

1. 快速測試,無須實機

2. JUnit43. gradle : testCompile 'org.robolectric:robolectric:3.0'

Mockito

1. 目前主流的Mock framework2. 可大幅簡化測試碼

3. gradle : testCompile 'org.mockito:mockito-core:1.10.19'

Android Studio Configuration

Test Artifacts

Before Android Studio 1.4

切換Test Artifacts 後必須手動新增 test 資料夾,不像1.4會自動幫你生成

注意後面要加上"app"

Run

Run tests

Run with coverage

Run test

Export test result

Run with coverage

Q & A