2

我们的 Android 应用程序非常大,我们需要通过自动化测试覆盖大部分代码,为此我们使用 Appium。我们的大多数 Appium 测试都会执行调用端点的代码部分,因此非常耗时。对于用户询问如何模拟端点的问题,Appium 论坛(https://discuss.appium.io/t/how-to-mock-api-backend-in-native-apps/4183)中的回复似乎建议仅使用 Appium 进行端到端测试?

我的问题是如何编写工业 Appium 测试?根据测试金字塔的定义,我们应该编写很少的端到端测试。那么使用 Appium 的行业应用很少有这样的测试吗?使用 Appium 时尝试模拟端点是否不常见?如果没有,如何使用 appium 模拟端点,例如使用 WireMock?

问候,

稻田

4

1 回答 1

1

Appium is perfect framework for UI automation of mobile apps, but it is definitely not intended to give 100% test coverage of the product (that includes not only mobile/web clients, but back-end services, databases, etc.)

The good practise with Appium (same to WebDriver on web) is too write short quick tests as much as its possible, meaning generate/prepare/remove test data or application state via api calls/database interactions. Appium does not force you to implement fully e2e tests: you can easily start appropriate Activity via Appium and continue test from that step, skipping bunch of previous steps covered in other test.

The common problem is when engineers are trying to build mobile automation testing on UI actions only relying on Appium, so that tests become time consuming, flaky and slow.

There is no much sense to start your UI tests suite if auth service is down, right? And the quick way to get those errors is to have good API/integration test coverage - here we are back to test pyramid ;)

于 2017-11-19T19:55:36.687 回答