reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
302 stars 33 forks source link

Optimize creation of test-thread context using test framework independent resource pooling #144

Closed obligaron closed 3 weeks ago

obligaron commented 1 month ago

This PR removes ITestRunner.TestWorkerId and related code.

Notes

Types of changes

Checklist:

gasparnagy commented 1 month ago

And one more comment:

obligaron commented 1 month ago

As far as I understood the code (correct me if I'm wrong), we only keep a registry of the available test worker (test-thread) containers, but not the ones that have been given out for execution. That means if a code borrowed a test runner but never returned (some error), than the container will never be disposed. I'm not sure if it is bad, but we should be aware of this. Maybe we should keep a registry for all test workers to know at least that some of them was not properly returned (and show it in a diag message). What do you think?

I think it's a good idea. I was also thinking about asserting/writing a warning in TestRunnerManager.DisposeAsync when we have missing / active TestThreadContainers. This should be easy with the current code, because the number of active/used containers is _usedTestThreadCount. But perhaps it would be better to store them also in a ConcurrentBag so we can log there Ids/Guids (see question above regarding TestWorkerId).

obligaron commented 1 month ago

Regarding the logging of active TestThreadContainers. I have implemented a collection of currently active/used containers that we can change in the TestRunnerManager disposed method. How should the logging be done? Which method would be appropriate (can be seen in all test frameworks)? 🤔

gasparnagy commented 1 month ago

@obligaron Side note: For me it is better if you do not apply rebase or force push after an initial review has been done, because this way I have to make a full review again and I cannot just see the "diff". Merging the main to the PR branch is fine - we will squash it anyway.