Best practices for Android Unit Testing?

前端 未结 3 1979
囚心锁ツ
囚心锁ツ 2021-02-04 03:48

I am developing a mobile android app. What are the most common libraries/frameworks used for Android unit testing? I feel that most of the business logic, database testing, Web

3条回答
  •  执笔经年
    2021-02-04 04:09

    I use JUnit for unit testing and Robolectric for instrumentation tests.

    This article shows you a Hello World example with Robolectric

    In recent times, I have been researching about integration testing in Android using Arquillian Droidium.

    If you want to test some code that consumes a REST API, you can mock it with WireMock. With this library, you can mock REST APIs by code or even deploy a mock HTTP server in your own machine and set up your own mocked mappings.

    For REST API mocks, I also recommend you to use Mockable.io.

提交回复
热议问题