본문

170731(월) - Building Effective Unit Tesets

Building Effective Unit Tests


Unit tests

- unit tests는 app test의 기초!

- unit test를 진행함으로써 logic of individual units가 제대로 동작하는지 확인 가능

- functionality of the smallest possible unit of code(method, class, component) 를 반복적으로 동작시킴.

- logic of specific code in your app를 확인하고 싶을때 unit test를 작성해야 한다.

- 일반적으로 unit test code는 isolation 하다. mocking framework를 사용해서 dependencies와 isolate 시킬 수 있다.


Note : unit tests는 complex UI interation events test에 적합하지 않다. (UI test에는 Automating UI tests 사용)



Local tests

- unit test run only local machine.

- JVM 상에서 local로 compiled 되도록 하여 execution time을 최소화한다.

- Android framework에 dependencies하지 않거나, mock object를 사용하여 filled 할 수 있는 dependencies한 unit test를 진행.



Instrumented tests

- run on an Android device or emulator.

- access to instrumentation information such as Context for the app under test.

- mock object로는 쉽게 filled 할 수 없는 Android dependencies가 있는 test를 실행

공유

댓글