Kotlin series has been developed keeping in mind, you are already familiar at least at beginner’s level.
This is the Fifth milestone towards our Kotlin series. Go to the fourth milestone if you haven’t done so.
In this series, we will simply follow the coding challenges developed for the Android Developer Fundamentals Course, Unit 1 — Lesson3.
Here we will create a simple calculator app
Here we will be creating initial functional UX as per the UI shown.
Steps to add unit test?
- Create test class CalculatorTest.kt
- The test class is pretty much the same as Java Unit test.
@Test
fun addTwoNumbers() {
.........
}
- Try to use AssertThat over Assert
assertThat(resultAdd, `is`(equalTo(3.0)))
The sixth milestone in this series.
References:
- Using Kotlin for Android development ~ Kotlin.org
- Resources to Learn Kotlin ~ developer.android
- Video of Lectures ~ youtube.com
- Best Practices for Testing ~ developer.android
- Junit4 Testing ~ junit4.org
- Mockito ~ Mockito.org
- Android Testing Codelab ~ codelab.developers
- Benefits of using assertThat over Assert ~ blog