machine / machine.specifications

Machine.Specifications is a Context/Specification framework for .NET that removes language noise and simplifies tests.
MIT License
885 stars 178 forks source link

Add ITestContext hook #407

Open mikeblakeuk opened 4 years ago

mikeblakeuk commented 4 years ago

Add hook in the same style as AssemblyContext

(PR Used to run unit tests!)

mikeblakeuk commented 4 years ago

Hi @robertcoltheart, Hope you are handling the current quarantine ok. Not sure what your thoughts are on adding a ITestContext to allow users to add hooks when tests start and stop? It's super hard to time the tests. Only the It is measured when using the VSAdapter. We are going use AppInsights to track the test times.

robertcoltheart commented 4 years ago

Sorry for the delay. I get where you're going with this, but I think it needs a bit of thought. For instance, your implementation only looks in the current assembly for a test context. What if you are timing tests for multiple test projects or multiple repos? It implies a lot of copy+paste code.

The approach Xunit takes is to have assembly attributes that load the extensions into the xunit engine. That's obviously quite a bit of work.

Will noodle a bit more on this topic and see if I can think of something that will help you.