How to mock API/Backend in Native apps?

We are evaluating App Test Tools and Appium is a candidate for us,
however I could not find a good solution how to Mock the backend when
using Appium?

Consider:

  • I want to have a single UI test which will be executed on iOS and Android apps (Appium supposes to be multiplatform)

The test scenario:

Press on a button in Native App.Native App will call an external API (needs to be mocked).Native App shows some text.Assertion.

Questions:

How to mock the API call?Appium uses the built project (e.g. apk). is there any way to
integrate and configure the application before building from Appium
side? e.g. if Appium triggers the build, then the App should uses the
fake API response (JSONs).

2 Likes

did you found any solution for mocking api response? even i want to… but i din’t get any

Hello, Have you found any solution to this?

No.
Actually Appium is designed foe end-2-end testing and basically you don’t
mock things at this level. However if you really want to mock, either use
other tools which are closer to the code, or use Appium with a proxy.

Thank you for the reply . We are evaluating ways to mock the middle tier webservice api calls . Can anybody elaborate some of the ways we can achieve this through apium?

@Ranjana_V Hi, is there way to mock api response?