-
Notifications
You must be signed in to change notification settings - Fork 263
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
Are we not supposed to create subclasses of TestMethodAttribute anymore? ("If using extension of TestMethodAttribute then please contact vendor") #4616
Comments
@marnilss Thank you for reporting this. I think the message should have had more info about an exception. Is it something you can see? Also to be sure, are you hitting breakpoint at the beginning of Execute? Can you wrap the Execute logic in try/catch and see if you hit the catch and maybe there are more info about an exception here? If you have a repro that you could share, that also will be appreciated. |
Yes, my real exception messages was prefixed with this warning. So I have been able to solve my problem causing my tests to fail. It seems that exceptions of type System.TypeInitializationException will be prefixed with this warning. BUT I'm wondering about why you are adding this warning; "Exception thrown while executing test. If using extension of TestMethodAttribute then please contact vendor." Will my subclass of TestMethodAttribute stop working in the near future? |
The message basically tells you that your override of TestMethodAttribute.Execute is throwing an exception, while it shouldn't. Why do you get the impression that subclasses of TestMethodAttribute shouldn't be used anymore? |
I just thought it was very strange for it to appear, so perhaps I got a little paranoid. |
We definitely need to reword the exception message. We will do it for 3.8 |
Ok, so if there are no such plans (to deprecate or seal the TestMethodAttribute class), then I'm satisfied 👍 |
I created a subclass of the TestMethodAttribute, and while investigating an exception thrown by a test, the error message was prefixed with the following text:
My need for this subclass, is to log each execution of a test to Application Insights, so that we can correlate the test result with the tested HTTP APIs (which also logs to Application Insights).
Basically:
I couldn't find any other way to do it, except with a subclass of TestMethodAttribute.
If we shouldn't be subclassing TestMethodAttribute, what are we supposed to do instead? Is there already a better way of doing this, or should we just ignore the ominous text/warning?
I guess this has something to do with the breaking changes you are planning for V4 ?
Best regards,
Marcus Nilsson
The text was updated successfully, but these errors were encountered: