-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter out "unplayed" Interactions? #91
Comments
@SilverMaiden , I've just pushed a new commit, which exposes the internal Let me know how it goes. Thanks! |
Thank you for getting back to me so quickly, really appreciate it! This is great - however, I realize now that for my use-case, I need to have access to the loaded Cassette in the Recorder to make use of the method (which we can't get right now). That, or if there was a version of the "BeforeSaveHook" that could be used on "Stop", then I could check the Interactions using WasReplayed (unless I'm missing something, in which case advice here would be great, thank you!) |
Hey @SilverMaiden , Can you please provide a sample code illustrating what you want to achieve? That would help me a lot to understand your use case. Thanks! |
Sure! Here's an something along the lines of what I'd like to do once a Recorder has finished playing back Interactions (if we went the "exposing Cassette" route:
Basically, after using Recorder to play a Cassette and mock requests for a test, I want to be able to check the Cassette at the end of the test and see if there are any Interactions that weren't played. Similar to the "BeforeSaveHook" that loops through all the Interactions when we use recorder.Stop(), we could have an "AfterStopHook" (pardon the naming, can't think of something better off the top of my head) for when we call recorder.Stop() in a Mode other than "record". I think having a hook might be cleaner than exposing the Cassette itself. So ideally we'd be able to do something like this:
And again - I so appreciate you getting back to me so quickly, this is a fantastic package and I'm excited to be using it! |
Hey @SilverMaiden , Any chance you can test the code in this PR? Make sure to check the error returned by |
The OnRecorderStopHook + WasReplayed is exactly what I needed, working wonderfully. Thank you!! <3 |
Hi! When replaying interactions for tests, I want to be able to throw some sort of error if there are any Interactions left unplayed (aka the flow of the test has changed, and therefore the Interactions need to be rerecorded) - my initial thought was to filter based on the replayed value, except it's private. With the package as it is now, what would be the recommended way to check the Interactions in a Cassette for
replayed=false
, or do the equivalent of that?I appreciate the help, and thank you for your awesome work on this package!
The text was updated successfully, but these errors were encountered: