Closed guibou closed 1 month ago
Using
sydtest-wai
, how do I use the same application (and keep its current context) between multiplesit
, possibly forcing the ordering of tests usingsequential
?
The intention is that that's not possible.
The intention is that tests are isolated so you can run them in parallel.
If you want that you'll need some variable like an IORef
or more likely a TVar
.
Is there a way to transform an outer resource to inner resource on the fly, so I could get rid of the itWaiShared
Yes you can use beforeWith'
to make the outer resource an inner resource.
But you'll still need a variable wrapper to make them modifiable of course.
Basically what you're asking is not explicitly supported because it's a bad idea.
If you want to run multiple tests or sessions, run them in a single it
.
Yes you can use beforeWith' to make the outer resource an inner resource. But you'll still need a variable wrapper to make them modifiable of course.
Thank you, indeed, this helps.
Basically what you're asking is not explicitly supported because it's a bad idea. If you want to run multiple tests or sessions, run them in a single it.
Yes, after writing everything and realizing that it saves 10s over our 15 minutes unit test suit run, I realized that simpler is better and removed everything.
I'm keeping the idea (and beforeWith'
) in order to do that in limited context where it may really be relevant.
Closing. Thank you.
Using
sydtest-wai
, how do I use the same application (and keep its current context) between multiplesit
, possibly forcing the ordering of tests usingsequential
?I would like some kind of
aroundAll
in order to start once the application and setup theWaiClient
and some kind ofbeforeWith
in order to change / setup the client for a subset of test. My understanding is that I need to pass aWaiClient
as an "outer" resource and use it in my test cases withrunWaiClientM
However, the api does not provide any helpers in order to create a
WaiClient
as an "outer" resource.Should I create them (I can open an MR with that + additionnal documentation) or am I in the wrong direction ?
What I'm currently doing is:
A
SetupFunc
in order to setup my app:Two utilities function:
Note how
withWaiApp
behaves as what is currently available withsydtest-wai
: it sets aWaiClient ()
as inner resource: each "it" will create a newApplication
from the setup func and will run in isolation. However,withSharedWaiApp
setups a sharedWaiClient ()
as "outer" resource. The same client will be shared between the differentit
is the test group.I then have:
Which acts as a special version of
itWithOuter
and runs the innerWaiClientM
.Now my code can look like:
So I have a few questions:
itWaiShared