Giter VIP home page Giter VIP logo

Comments (5)

speekha avatar speekha commented on June 16, 2024 1

@esial v1.1.7 has been published. Enjoy!

from httpmocker.

speekha avatar speekha commented on June 16, 2024

@esial
The rationale for catching those exceptions is that HttpMocker should not modify the behavior of your app. So any exception due to HttpMocker should not make its way back up the stack to your app. In the next release, the 404 response has been completed with the exception message and stacktrace for debugging purposes.
On the other hand, the idea of simulating exceptions is interesting. Could you elaborate on your need? Would it be ok if I added a way to trigger exceptions based on an element defined in the scenario? For instance adding an error field to the scenario which would allow to throw the exception of your choice. At least, it would be explicit in the scenario and not an unwanted side-effect.

from httpmocker.

esial avatar esial commented on June 16, 2024

@speekha
Purpose of avoiding app behavior change sounds rightly, but as long as interceptor is using for test mock responses it would be nice to simulate any behavior of communication layer.
In my case interceptor is used only in espresso test. App has different handle of each communication exception. Throwing exception during creationg instance of ResponseDescriptor allowed me to simulate any of communication exceptions in test.
Idea of explicit declaration of exception seems to perfectly fit my expectations.

from httpmocker.

speekha avatar speekha commented on June 16, 2024

@esial
I've prepared a PR with the new feature:

  • dynamic mocks can trigger whatever exception they want, it won't be caught anymore
  • static mocks can specify an error instead of a response for a certain request. An exception with the corresponding type and message will be thrown.
  • when recording scenarios, if an exception occurs, it will be recorded in the scenario as well.
    I might do a bit more clean up to my code before I merge it in develop (and probably publish a new 1.1.7). So in the meantime, let me know what you think about it. Does it answer all your concerns? Do you have any suggestion to improve it or fit your needs better?

from httpmocker.

esial avatar esial commented on June 16, 2024

Great! I can't wait :)

from httpmocker.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.