Skip to content
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

Add WebApplicationFactory for in-memory tests #1153

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Dreamescaper
Copy link
Contributor

@Dreamescaper Dreamescaper commented Apr 21, 2022

Issue #, if available:
#1151

Description of changes:
I've created a type WebApplicationFactory, which parses serverless.template file, and creates HttpClient, which is able to invoke Http endpoints, defined in template file. It invokes handler functions directly, avoiding any network communications.

Inspired by WebApplicationFactory from AspNetCore.

You can take a look at ComplexCalculator.cs for the example of usage.

This PR is essentially a POC, to describe the idea, and discuss whether it makes sense to expand it further (e.g. add ability to replace services in the DI container).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Dreamescaper
Copy link
Contributor Author

Dreamescaper commented Apr 21, 2022

@normj @ashishdhingra @ganeshnj
Guys, what do you think? Is that something which would be appropriate for this repo? Does it make sense to work further on this thing?

@ganeshnj
Copy link
Contributor

@Dreamescaper thanks for PR

I understand what the code does, but failing to understand the intent here. Is having a testable in-memory server intention here?

@Dreamescaper
Copy link
Contributor Author

@ganeshnj
Basically yes. I want to be able to write tests in a similar way I would do with WebApplicationFactory for AspNetCore.
https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0

@Dreamescaper Dreamescaper changed the title Add WebAplicationFactory for in-memory tests Add WebApplicationFactory for in-memory tests Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants