Testing methods that make http requests

前端 未结 7 1325
悲哀的现实
悲哀的现实 2021-02-09 01:31

I have some methods in my app that make http requests. Is there a good way to simulate network failures and bad responses for the unit tests?

7条回答
  •  我在风中等你
    2021-02-09 02:14

    Suitable Mock Objects should let you perform such simulations easily; if you're unfamiliar with the concept, there's a good tutorial here.

提交回复
热议问题