locked
Testing bad connections in Xamarin UI Test RRS feed

  • Question

  • User372654 posted

    Does anyone have experience and advice for writing and running UI tests that run in app center that tests poor or no internet connection?

    Friday, October 19, 2018 12:40 PM

Answers

  • User89714 posted

    @rlasker - Because an unreliable network connection could result in errors/exceptions from multiple different API calls, I would be tempted to do most of the testing of error handling using unit and/or integration tests using mocking (e.g. Rhino Mocks) rather than using UITest. That way you can be sure of testing each of the error scenarios from different APIs that might report an issue.

    Even if using UITest, you'd probably need to mock the networking code in order to do a thorough test. You'd still have to run the same functionality a number of times, with different errors being reported via the mocking. Without doing that, you would need to do many tests and have a lot of luck in order to catch all possible error scenarios.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, October 19, 2018 1:21 PM

All replies

  • User89714 posted

    @rlasker - Because an unreliable network connection could result in errors/exceptions from multiple different API calls, I would be tempted to do most of the testing of error handling using unit and/or integration tests using mocking (e.g. Rhino Mocks) rather than using UITest. That way you can be sure of testing each of the error scenarios from different APIs that might report an issue.

    Even if using UITest, you'd probably need to mock the networking code in order to do a thorough test. You'd still have to run the same functionality a number of times, with different errors being reported via the mocking. Without doing that, you would need to do many tests and have a lot of luck in order to catch all possible error scenarios.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, October 19, 2018 1:21 PM
  • User372654 posted

    @JohnHardman said: ...I would be tempted to do most of the testing of error handling using unit and/or integration tests using mocking

    Thanks, as you say that I suppose it makes sense to focus on mocked unit tests. Unfortunately we use UI tests to simulate QA Test Plans which include bad connection tests. It's a real bummer especially given the fact that the entire purpose of the app is to provide business functionality in the fields where no connection is available. QA should be able to run the UI tests on a physical device and manually turn off connection but it doesn't help us when we are trying to run them in AppCenter against sets of devices.

    Friday, October 19, 2018 1:31 PM