I asked this question a while back:
https://forum.ncrunch.ne...led-multiple-times.aspx
and whilst I understand the answer and the reason for the current behaviour, I'm having a similar issue again but when using playwright and hosting all the app in process. This means that the static variable trick doesn't seem to work, I can't reuse the app/browser across test batches.
This means I have a more significant overhead for setting up the tests vs running the batch of tests.
Is it possible to get a option (or maybe there is one) to have some more control over the batches of tests that are run so that the BeforeTestRun/AfterTestRun issues are ,minimised. If we could opt in to different batch sizes (currently it seems that there are about 8 tests in a batch) then using bigger batch sizes would mean that I would run more tests using a single browser instance and so offset the browser creation overhead. Maybe options for approximate batch size that we could set to some value and NCrunch would attempt to run that many tests in a single batch? Then I could have say 50 tests in a batch rather than 8.
Ideally we would have an option to minimise the number of batches, so create n batches up front, where n is the number of processing threads, and each batch would contain (number of tests)/n tests. I appreciate that this would negate some of the benefits of the pipeline and scheduling to try an optimise the test run, but I think in some cases the set up is such an overhead that it negates any of these benefits anyway.
some rough testing I have done:
we have ~1000 integration tests. Running them all in VSTest and reusing the same browser for each test takes about 15mins
running in ncrunch with 8 threads takes about 30 mins, mainly because the test start up is quite significant, and we only get a few tests run for each startup (the processing queue indicates that most batches only have a small number of tests, often 1/2).
Having some mechanism to influence this in a positive way when we know we have this situation would be useful.