microsoft / testfx

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

No way to set timeout for whole test run #656

Closed arnath closed 4 years ago

arnath commented 4 years ago

MSTest v2 appears to have a way to set a per test timeout value using this setting in a .runsettings file:

<Runsettings> 
  <MSTestV2> 
    <TestTimeout>5000</TestTimeout>   
  </MSTestV2> 
</Runsettings> 

However, there does not appear to be a way to set a timeout for the entire test run. Does this feature exist? If not, can it be added?

hvinett commented 4 years ago

Hey @arnath, you can set the timeout for the entire test run using test session timeout in run settings file

<RunSettings>
<RunConfiguration>   
    <TestSessionTimeout>100</TestSessionTimeout>
  </RunConfiguration>  
</RunSettings>

Refer this for further information.

arnath commented 4 years ago

Do cleanup methods get called when the tests are aborted like this (AssemblyCleanup, ClassCleanup, etc)? If not, is there a way to have the test session timeout but still try to clean up?

ShreyasRmsft commented 4 years ago

Clean up methods do not get called when this happens. The timeout for all you know could happen in the clean up code. This is a hard abort.

What you are requesting for would be an enhancement. You can open another issue requesting for the feature and provide the link here. We will track it along with the other enhancement asks.