Code Monkey home page Code Monkey logo

teepee's People

Contributors

oatsoda avatar timmoth avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

timmoth

teepee's Issues

[Bug] Concurrency error in TeePee.Refit

  Error Message:
   System.InvalidOperationException : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
  Stack Trace:
     at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at TeePee.Refit.ServiceCollectionExtensions.GetRefitHttpFactoryName[T]()
   at TeePee.Refit.ServiceCollectionExtensions.AttachToRefitInterface[TRefitInterface](IServiceCollection serviceCollection, TeePee teePee)

Better feedback for non-matches

There could be more help for when Requests don't match - rather than having to check which parts didn't match.

e.g. if you configured URL, Query, Headers and Body for matching, then if it doesn't match, it would be faster for developers to see which part failed to match.

This should be relatively simple for cases where you are using a Tracker - as the exception in the tests can simply expand on the details of what matched. The ShowFullDetailsOnMatchFailure option already configures the Tracker exceptions to list all of the calls that were made, so you can compare against the match rule that failed.

However...

Largely, TeePee is expected to be used without the Tracker, as implicit testing (e.g. configured GET response and validate the the business logic that uses it, works) is the primary case.

So potentially, failure to match isn't using a Tracker, so having the details at the point of attempting to match would make more sense. But, it's quite likely you might not bother to mock all of the HTTP calls for a SUT if you are testing one part - so having TeePee execute some backtracking to determine reasons for the failure to match could be very heavy and cause a lot of log outputs.

So either it needs to be more clever, or there needs to be some setting - but turning a setting on/off could be painful.

Feature: Refit Support

Refit has it's own registrations for DI and could make injecting the Http Handler difficult (reflection to get HttpClient registration instance)

Perhaps need Extensions for this.

May need to look at DI coverage in unit tests also to make this worthwhile.

Feature: Allow overwriting of rules which already exist

If you've setup a match rule, but then want to change its response status/body/headers etc. then currently it doesn't work because it arbitrarily uses the first one it finds.

I'm not sure we can deal with this at build-time, so probably at match-time we should use the most recent, most specific rule that matches.

If there was a timestamp for when the rule was added, we could be explicit about the ordering.

Feature: Improved output logging

Though #7 would deal with Trackers that don't match, it might also be useful to have better logging when matches aren't made without the Tracker.

Perhaps settings required for:

  • Show Full Body of requests
  • Show all Setups (and their Full Body values)

Perhaps also something like "URL matched, but Body didn't" - i.e. more granular reasons why matches weren't made.

If URLs match but not Body, then perhaps it's more helpful to default to log more data - on the assumption it's not just been ignored, but that it's accidental?

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.