testfx icon indicating copy to clipboard operation
testfx copied to clipboard

Option to launch debugger on test failure

Open Evangelink opened this issue 8 months ago • 3 comments

Summary

It would be useful to be able to automatically trigger a debugger launch call on failed test/assertion. This is especially interesting when the issue is quite randomic and we are not having enough info to try to replicate the issue.

This should not be the default configuration but more an option that can be enabled. We could consider having some specific filter flag too to avoid launching the debugger on any failed test but rather on a list of tests.

cc @MarcoRossignoli @nohwnd

Evangelink avatar Jan 02 '24 16:01 Evangelink

It would be useful to be able to automatically trigger a debugger launch call on failed test/assertion.

So only for local development? something like "run till fail and attach"? For VS or console?

MarcoRossignoli avatar Jan 02 '24 17:01 MarcoRossignoli

So only for local development

I think it should be a setting that can always be set but makes sense mainly (only) in local yes.

something like "run till fail and attach"?

I think it could be combined to the run until failure option but it's an option on its own.

For VS or console?

Both

Evangelink avatar Jan 03 '24 08:01 Evangelink

I was looking into this in the past as a part of a feature request on vstest imho. But can't find the thread. The scenario was the same as what you describe: tests that are randomly failing, because of a race condition.

I think it is perfectly viable to do. The only problem (and a reason why I did not implement) was that you need to attach inside of the assertion = every testing framework needs to support it (or more precisely the assertion library being used). If you don't then you lose all the interesting state that is on the stack.

I also agree that re-trying till failure is a useful, but a different feature that can be complimentary to this one.

nohwnd avatar Jan 03 '24 08:01 nohwnd