microsoft / testfx

MSTest framework and adapter
MIT License
738 stars 255 forks source link

ClassInitialize should have timeout independant from test methods #496

Closed OFeOFeO closed 9 months ago

OFeOFeO commented 6 years ago

Method that's designed as a ClassInitialize method should be able to have a Timeout attribute that's independant of the first test being run.

I have a class with lots of tests that required a service running. When running locally, the service is typically not already running, so the class initialize set it up. This can lead to timeout. The current behavior is that the first test to run (which I don't have a way to control), will timeout. Instead I'd like to be able to give ClassInitialize extra time, and then have timeout for other test be short since none of the tests take much time once the service is up and running.

jayaranigarg commented 6 years ago

Tagging @pvlakshm @cltshivash to look into the ask.

AbhitejJohn commented 6 years ago

I believe this is not an issue that's limited to MSTest V1 from an offline thread. MSTestV2 does not include Init/Teardown as part of a tests duration. We might want to add this into the delta doc in testfx-docs.

AbhitejJohn commented 6 years ago

Made the change in the docs: https://github.com/Microsoft/testfx-docs/pull/60 While its nice to have this new behavior it looks like we might want to add in a way of constraining timeout on setup/teardown methods. Do we have internal extensions perhaps that already do this that we can share out broadly or maybe we might want to just stick in individual timeout attributes on them?

Evangelink commented 9 months ago

I believe this is fixed by #2085