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

Testing story #693

Open
wallymathieu opened this issue Apr 2, 2018 · 2 comments
Open

Testing story #693

wallymathieu opened this issue Apr 2, 2018 · 2 comments

Comments

@wallymathieu
Copy link
Contributor

wallymathieu commented Apr 2, 2018

Suave.Testing

I've noticed that using the testing library on NuGet assumes something about how you are testing.

The method:

let runWith config webParts =...

creates a http handler on a port and then when you use it together with

let reqResp ...

it disposes the SuaveTestContext. That implies that you need to a new instance using runWith for each test, i.e. it's singe use. If the test runner decides to run the tests in parallel then you need to set a port for each test.

It would perhaps be nice to have more of those assumptions specified more clearly. Perhaps as an example of how to test your Suave app in the examples folder?

Suave Testing light

On the other hand you have An Introduction To Testing Suave WebParts by @MattJOlson.

That blog post implies that you don't need to go through the trouble of having the full stack up and running. So perhaps it would make sense to have a namespace or module in the testing lib intended for use when you don't want a full http handler up and running.

Thoughts?

@MattJOlson
Copy link

I make no claims that my approach is the best way to do it; it worked for me, once, in a fairly limited-scope environment. (But it did work!)

Anyway, depending on what part of the service you're testing, spinning up the full stack might be overkill.

@wallymathieu
Copy link
Contributor Author

I agree @MattJOlson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants