Android Kaki

Build beautiful, usable products using required Components for Android.

Write unit exams and UI exams in your Kotlin Cross-Platform software! | by Anmol Verma | June 2023

Anmol Verma


I have been writing loads of Kotlin code currently, and with this code comes the duty of offering a high-quality and maintainable codebase. Ever since Kotlin Multiplatform aka KMP was launched to builders, I have been testing between expectations and actuality.

So go on to the sort of app I constructed lately?

So this can be a Proof of Idea that I constructed for potential shoppers and I wish to automate one thing like amazon go! You’ll be able to learn extra about it within the hyperlink right here

So the excessive degree options of this app embrace

  1. accuracy
  2. Consumer data
  3. Scan the shop by way of QR code : To realize entry to the shop
  4. Scan barcodes: So as to add gadgets to your cart
  5. Keep gadgets in cart by SqlDelight
  6. Test/Cost

What sort of check did I write right here?

  1. Check ViewModel working on JVM (As a result of then they will run on CI/CD pipeline)
  2. UI testing for fundamental software flows like login, registration, QR code scanning, and many others.
  3. Check API: How nicely our API integrates with Ktor and gives acceptable success/error messages.
  4. Integration Check: To test how nicely we combine our code with the SDK. Instance: Integration of Repository and SqlDelight.

Sneak Peak into automation exams for Compose UI

Now transfer on to the setup for the ViewModel Check

I created a delegate Kotlin to supply dummy as wanted as a result of my software will depend on excessive degree interface and never direct implementation. It is vitally simple for me to provide fakes/fashions

after which the implementation gives dummy or dummy variants for these dependencies.

For instance: LoginViewModelCheck

Within the above instance, you possibly can see that Generators come in useful throughout our testing StateFlows.

Equally, if we take a look at shared #JetpackCompose UI check setup, On this setup I’ve UI Assessments with robotic automation for every display screen.

On this setup you possibly can see how we created variations of those Robots for the display screen and use Kotlin ContextReceivers to name automation strategies.

A super robotic class would have automation strategies that can help you work together with UI components, and because the information is mock the exams will run quicker!

Nice! That is all for now In case you like this content material and wish to be taught extra you possibly can observe me on Twitter And Github DM is at all times open!

Thanks for studying ! 🏻‍♂️

#JetpackCompose #kotlin #Koin #Espresso #KMM #KMP

John Wick: Chapter 4 (FREE) FULLMOVIE The Super Mario Bros Movie avatar 2 Where To Watch Creed 3 Free At Home Knock at the Cabin (2023) FullMovie Where To Watch Ant-Man 3 and the Wasp: Quantumania Cocaine Bear 2023 (FullMovie) Scream 6 Full Movie

Updated: June 12, 2023 — 3:43 pm

Leave a Reply

Your email address will not be published. Required fields are marked * © 2023 Android kaki