5 ms·
I prefer per process over the alternatives. When you write code you have the choice to do per process, per thread, or sequential. The problem is that doing mu
by OptionOfT 2y ago
I prefer per process over the alternatives.
When you write code you have the choice to do per process, per thread, or sequential.
The problem is that doing multiple tests in a shared space doesn't necessarily match the world in which this code is run.
Per process testing allows you to design a test that matches the usage of your codebase. Per thread already constrains you.
For example: we might elect to write a job as a process that runs on demand, and the library we use has a memory leak, but it can't be fixed in reasonable time. Since we write it as a process that gets restarted we manage to constrain the behavior.
Doing multiple tests in multiple threads might not work here as there is a shared space that is retained and isn't representative of real world usage.
Concurrency is a feature of your software that you need to code for. So if you have multiple things happening, then that should be part of your test harness.
The test harness forcing you to think of it isn't always a desirable trait.
That said, I have worked on a codebase where we discovered bugs because the tests were run in parallel, in a shared space.
- sunshowers 2y agoThere is definitely some value in shaking out bugs by running code in parallel in the same process space — someone on Lobsters brought this up too. I've been wondering if there's some kind of optional feature that can be enabled here.
- NewJazz 2y agoCan you do it deliberately in the test?
- sunshowers 2y agoYes, you can write your own meta-test that runs all of the actual tests in separate threads. But it's a bit inconvenient and you won't necessarily get separate reporting.
- rad_gruchalski 2y ago> The problem is that doing multiple tests in a shared space doesn't necessarily match the world in which this code is run. For me that's a positive bonus. If it runs multiple times in parallel and works, it will work as a single instance deployed in a pod somewhere.
- OptionOfT 2y agoI get that, but if it doesn't work, do you spend the time on a use-case that doesn't exist?
- sunshowers 2y agoTotally depends on if it's a use case you care about. Things like libraries vs leaf-node applications also play a factor.