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

AssemblyRunner's "OnTestFailed" does not give enough information for AggregateExceptions. #1548

Open
danrozenberg opened this issue Nov 3, 2017 · 3 comments

Comments

@danrozenberg
Copy link

Hello, we have some tests running through the AssemblyRunner class, and it works fine, in general.

However, when a test run fails with an AggregateException, it becomes hard to gather more information about the failure... Consider the example:

            runner.OnTestFailed = info =>
            {
               _logger.LogInformation($"The following test has failed: {info.TestDisplayName} after {info.ExecutionTime} seconds, with error: {info.ExceptionMessage} and stack trace {info.ExceptionStackTrace}. The exception type is: {info.ExceptionType}.");
            };

When a test fails, here is what would be output:

The following test has failed: MyTest after 30 seconds, with error: One or more errors occurred. and stack trace . The exception type is: System.AggregateException.

Sadly, I couldn't find anything in TestFailedInfo that could display the inner exceptions. Is there any way to see all inner exceptions? If not, could something like this be added in the future?

Thank you!

@danrozenberg
Copy link
Author

Can we have this for target 3.0? :)

@bradwilson
Copy link
Member

I have not yet decided what to do with all the existing open issues w/rt 3.0. I don't even know if AssemblyRunner is something that's going to exist in 3.0. I'm leaving them all as-is for now, to be re-evaluated once 3.0 starts to take shape.

So merely being open is good enough to be a candidate for 3.0. :)

@ohadschn
Copy link

ohadschn commented May 10, 2021

It should be noted that AggregateException is only one such case our of many. For example, HttpRequestException can say something like The SSL connection could not be established, see inner exception. And it's not necessarily the inner exception(s) that's missing, for example in some type load exceptions it's some other property if I recall correctly. And of course inner exception could also have inner exceptions, and other properties, and so on. The point it, only Exception.ToString will work correctly.

Fortunately, the solution is very simple, add something like TestFailedInfo.FullExceptionInfo and populate it with exception.TosSring().

I don't even know if AssemblyRunner is something that's going to exist in 3.0

@bradwilson I hope there would be an equivalent though? We heavily rely on the ability to execute tests from a loaded assembly without launching an additional process.

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

No branches or pull requests

3 participants