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

Test client #27

Closed
davidbrochart opened this issue Mar 17, 2023 · 9 comments
Closed

Test client #27

davidbrochart opened this issue Mar 17, 2023 · 9 comments

Comments

@davidbrochart
Copy link

It seems that a real server is used for testing. I was wondering if there could be a test client, similar to what Starlette has, and for instance a TestFastAPIComponent that would not start a server?

@agronholm
Copy link
Member

What would this accomplish?

@davidbrochart
Copy link
Author

It would not require to launch a server, so I guess it's faster? And there would be no need to specify a base URL or port in the client.
Also, if we can use Starlette's test client, it's easier to test WebSocket sessions.

@agronholm
Copy link
Member

Unless I'm mistaken, the test client would have to be specific to each type of framework, yes?

@agronholm
Copy link
Member

What kind of difficulties are there with websocket that would be solved with a test client?

@davidbrochart
Copy link
Author

Unless I'm mistaken, the test client would have to be specific to each type of framework, yes?

I think so, yes.

What kind of difficulties are there with websocket that would be solved with a test client?

Currently, for instance using an httpx client, one needs to find a WebSocket client that works well with it, such as httpx-ws, because httpx doesn't have WebSocket support. But httpx's test client has.

@agronholm
Copy link
Member

But httpx's test client has.

You mean Starlette's...?

@davidbrochart
Copy link
Author

Yes, sorry.

@agronholm
Copy link
Member

My point is that I don't want to shoulder the additional burden of maintaining several test clients if the benefits are only marginal.

@davidbrochart
Copy link
Author

That's perfectly understandable, thanks for the feedback.

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

No branches or pull requests

2 participants