Code Monkey home page Code Monkey logo

Comments (3)

jasonsandlin avatar jasonsandlin commented on July 29, 2024

IXMLHttpRequest2 is an platform API. The goal of this project isn't to test IXMLHTTPRequest2 of course since that better work since its an old platform API.

We're mocking above our platform abstraction layer (which calls platforms APIs on UWP/Xbox/iOS/Android/etc). The mocks are really for something like a game that wants to serve up fake data when in "editor" mode so they don't have to sign in to Xbox Live, etc to populate the UI.

You can see the mock API here: https://github.com/Microsoft/libHttpClient/blob/master/Include/httpClient/mock.h. It works similar to a Fiddler auto-responders in that it does patter matching and a match is found it'll use return data found in the mock you set.

from libhttpclient.

pps83 avatar pps83 commented on July 29, 2024

IXMLHTTPRequest2 of course since that better work since its an old platform API

If I pass new lines in my url it silently/happily removes new lines and fetches wrong url (e.g. url without newlines isn't the one I was requesting). Whatever I try to test I get issues with it.

In my case instead of mocking responses I actually implemented in c++ an http server with nodejs-style api (that is, in 3-5 lines of code I can handle simple http requests right in my code) and since server and client are in the same process I can easily tell the server what it should serve me. This way I can make it work overall as close as possible to real http requests. This is off course isn't possible with ixml2 as I need to hook dns resolution.

I thought that you tried to do similar type of mocking.

Also, only by mocking and testing I can ensure that all http backends (curl, msxml, etc) yield exactly the same results in my wrapper api. For example, two redirects followed by timeout, or failed dns resolution: all these should produce identical results regardless of backend. Overall I have very similar goals as libHttpClient :) didn't know this project existed.

from libhttpclient.

jasonsandlin avatar jasonsandlin commented on July 29, 2024

Yeah that makes sense. Our primary tests are to ensure that the Xbox Live services respond correctly (via XSAPI) regardless of the http backend we are using.

But if you want to mock on Xbox in the pattern your doing, if you have access to the XDK, you might be able to do https://docs.microsoft.com/en-us/windows/uwp/xbox-live/using-xbox-live/troubleshooting/how-to-set-up-fiddler-for-debugging#for-xbox-one-xdk-based-projects and then instead of using Fiddler, setup a http server. Not sure. Never tried it. Alternatively I know you can use Fiddler auto-responders but its more limited than your own http server code.

from libhttpclient.

Related Issues (20)

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.