Skip to content

Guidance on Unit/Integration testing of an ITransformProvider implementation #2651

Answered by MihaZupan
saberone asked this question in Q&A
Discussion options

You must be logged in to vote

I'd say it depends on what your transforms are doing. E.g. it might be as simple as something along the lines of
https://github.com/microsoft/reverse-proxy/blob/69acefbc5db6a14d2eb04fb959e58c0724d88e9c/test/ReverseProxy.Tests/Transforms/PathStringTransformTests.cs#L12-L25

In most cases it's also simple to create fake request objects (new DefaultHttpContext()) to populate the RequestTransformContext.
What sort of issues did you run into?

If you really need to test the end-to-end behavior, YARP itself uses this TestEnvironment helper for some tests to start the proxy & backend servers and proxy a real HTTP request.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saberone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants