Comments (5)
@esial v1.1.7 has been published. Enjoy!
from httpmocker.
@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.
@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.
@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.
Great! I can't wait :)
from httpmocker.
Related Issues (18)
- Possible race condition in DynamicMockProvider
- Support for Ktor HTTP client
- Support for multiplatform
- Replace mockito in tests
- Update Doc for Ktor
- Query parameters should support doubles
- Set up automatic publish to MavenCentral
- Restore Dokka with multiplatform
- Add support for different JSON parrsing libs HOT 1
- How to Mock different request with different jsons HOT 8
- Record mode issue? HOT 3
- Allow custom RequestDescriptor.match(request: Request) handler HOT 3
- Automatic mocking
- Mock a specific API response HOT 11
- Ability to execute the chain with a new request in Mixed mode. HOT 4
- Add noop artifact for release builds
- Body matcher fails due to regex matching HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpmocker.