Mobile App Development Publication

Sharing iOS, Android and relevant Mobile App Development Technology and Learning

Learning Android Development

Testing Composable in Jetpack Compose Android - Testing Fundamentals

Saurabh Pant
Mobile App Development Publication
6 min readAug 27, 2022

--

Source: https://blog.testproject.io/

Creating a Composable with inputs and actions

Composable to be tested

Setting up the test environment

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
defaultConfig {
...

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...
}

Writing test cases

Test Case 1: Initial state

Test Case 2: Invalid state

Test Case 3: Valid state

Bonus Read

That is all for now! Stay tuned!

--

--

Mobile App Development Publication
Mobile App Development Publication

Published in Mobile App Development Publication

Sharing iOS, Android and relevant Mobile App Development Technology and Learning

Saurabh Pant
Saurabh Pant

Written by Saurabh Pant

App Architect (Native & Flutter) | TataDigital | Mentor | Instructor @Droidcon | Youtube @_zaqua | Writer @Flutter Community

Responses (1)