Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get exception from test in TestCleanup? #293

Closed
VanKrock opened this issue Oct 18, 2017 · 3 comments · Fixed by #4018
Closed

How to get exception from test in TestCleanup? #293

VanKrock opened this issue Oct 18, 2017 · 3 comments · Fixed by #4018

Comments

@VanKrock
Copy link

We can get UnitTestOutcome.Error from TestContext.CurrentTestOutcome in TestCleanup. How to get additional information about error? May be Exception? It's can be important for cleanup.

@jayaranigarg
Copy link
Member

@VanKrock : Currently there is no way to get additional information about the error. If we have enough asks for this feature, we will surely address this in our future releases.

@ghost
Copy link

ghost commented Feb 26, 2020

I'll pile onto this one. You seem to always have to give something up depending on which workaround you pursue.

There is a stackoverflow about this in which one answer suggests to subscribe to FirstChanceException, but being static, you're risking things getting screwed up when using parallel test execution.

That same stackoverflow has a MSTest V2 suggestion to use a TestMethodAttribute extension, which is better, but then as noted in another issue for V2, you don't have access to TestContext.

Can we not have our cake and eat it too? Please?

@nohwnd nohwnd added this to the 16.7.0 milestone Mar 24, 2020
@pavelhorak pavelhorak modified the milestones: 16.7.0, 16.8.0 Apr 20, 2020
@pavelhorak pavelhorak modified the milestones: 16.8.0, 16.9.0 Jul 3, 2020
@pavelhorak pavelhorak assigned Haplois and unassigned cvpoienaru Oct 1, 2020
@pavelhorak pavelhorak modified the milestones: 16.9.0, Future Mar 1, 2021
@gaurav137
Copy link

gaurav137 commented Sep 29, 2022

+1 on this ask. We want to capture the exception in TestCleanup via the logging infra that is being used to capture the rest of the tracing. Currently our log files miss this last piece of information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants