Posts

Showing posts with the label unit test

Android Unit Test

Image
Espresso Espresso is the newest testing framework for Android, also it is not so fresh anymore, I guess it appears in Lollipop time. According to the  official document , it can write concise, beautiful, and reliable Android UI tests. @Test public void greeterSaysHello() { onView ( withId ( R . id . name_field ) ) . perform ( typeText ( "Steve" ) ) ; onView ( withId ( R . id . greet_button ) ) . perform ( click ( ) ) ; onView ( withText ( "Hello Steve!" ) ) . check ( matches ( isDisplayed ( ) ) ) ; } Apparently, it’s concise and beautiful syntax comes from the functional coding styles, whether it is reliable, I can not get the conclusion from the above syntax. I think it is the replacement of the deprecated  Instrumentation TestCase , so it should be much advanced than the older one. And according to the  Chui-Ki Chen’s presentation , it does automatic synchronization of test action with app UI, which is the big breakthrough ...

Android UnitTest

Android UnitTest Table of Contents kinds of Unit Tests in Android Android Instrument Test Junit Test the Demo Unit Test was always the most import part of a project, especially for Object-oriented programming like Java codes, and also was the necessary part of Test-Driven Development technology. But how to process test-driven technology in Android app developement, we all know that android app is based on Java code, and the thought of TDD was in the blood of Java. There are must be some ways to do TDD in Android, and this article will guide you to the Unit test in Android Development. 1 kinds of Unit Tests in Android There are two levels of Unit Test in Android, Android Instrument Test, which running in the Android Devices; and Junit Test, which running without any Android environment. The key difference between two of them are the dependency on the android.jar, in other word, the Android API. We develop android app by import the dependency of android.jar, whi...