lomsa-dev / http-mock-adapter

A simple to use mocking package for Dio intended to be used in tests.
https://pub.dev/packages/http_mock_adapter
MIT License
65 stars 43 forks source link

Allow timeout simulations in replies #169

Open kaminoan-dev opened 9 months ago

kaminoan-dev commented 9 months ago

The current implementation of the http_mock_adapter library provides a convenient way to mock server responses with the delay parameter in the MockServer reply. However, it lacks the ability to simulate connection, receive, or send timeouts, limiting its usefulness in testing scenarios that involve timeout-related behaviors.

Feature Request: It would be great to extend the functionality of the MockServer to include the ability to simulate connection, receive, and send timeouts explicitly. This enhancement will enable users to test and verify how their code handles different timeout scenarios, leading to more comprehensive and robust test coverage.

The suggested enhancement should allow users to specify connection, receive or send delay parameters configuration, which could be used to reflect timeouts defined in the Dio instance options.

Expected Outcome: With this enhancement, users can precisely control and simulate various timeout scenarios during testing, ensuring that their code behaves correctly in real-world networking conditions.

LukaGiorgadze commented 9 months ago

Thank you @kaminoan-dev for your feedback! This is interesting and I would be glad to see this feature in the upcoming releases. @cyberail thoughts?

cyberail commented 8 months ago

Agreed sounds really great. I will take a look.