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

Exceptions flow to Translation layer #1434

Merged
merged 5 commits into from
Feb 19, 2018

Conversation

abhishkk
Copy link
Contributor

Description

Known exceptions like TestPlatformException, SettingsException, InvalidOperationException curerntly don't flow to Tralsation layer. Exceptions are eaten up in TestRequestManager.

Changes are to allow exceptions to flow to Translation layer.

Related issue

#1430

@abhishkk abhishkk changed the title [Do not review] Exceptions flow to Translation layer Exceptions flow to Translation layer Feb 16, 2018
// In test run failure scenario, send failure message and completion event to transaltion layer.
if (!success)
{
var testMessagePayload = new TestMessagePayload { MessageLevel = TestMessageLevel.Error, Message = exception?.ToString() ?? "Exception in StartTestRun." };
Copy link
Contributor Author

@abhishkk abhishkk Feb 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for better error message in case success false comes from TestRequestManager (which today is not possible) #Closed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speak to pratapl, put it in resx


In reply to: 168675339 [](ancestors = 168675339)

{
EqtTrace.Error("ExecuteArgumentProcessor: failed to execute argument process: {0}", ex);
this.Output.Error(false, ex.Message);
result = ArgumentProcessorResult.Fail;

// Send inner exception only when its message is different to avoid duplicate.
if (ex is TestPlatformException &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this we can do ex.ToString() in line 335 which will print inner exception. But in that case duplicacy will be there if inner exception and outer exception message are same. This happens for many scenarios in TestPlatformException

@@ -190,28 +187,14 @@ public bool DiscoverTests(DiscoveryRequestPayload discoveryPayload, ITestDiscove
}
}
}
catch (Exception ex)
finally
Copy link
Contributor Author

@abhishkk abhishkk Feb 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally code me null check

{
throw;
}
testRunResultAggregator.MarkTestRunFailed();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As testRunResultAggregator required only for console scenarios. I think we can remove this?

[TestMethod]
public void DesignModeClientConnectShouldSendTestMessageAndDiscoverCompleteOnTestPlatformExceptionInDiscovery()
{
var payload = new DiscoveryRequestPayload();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: DRY.

@@ -147,6 +147,81 @@ public void ExecuteShouldExitWithErrorOnResponseFileException()
Assert.AreEqual(1, exitCode, "Response File Exception execution should exit with error.");
}

[TestMethod]
public void ExecuteShouldNotThrowSettingsExceptionButLogOutput()
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY.

Copy link
Contributor

@singhsarab singhsarab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@@ -1,28 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.ComponentModel;
using System.Xml;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move these as well below?

@@ -111,7 +111,6 @@ internal UriDataAttachment Clone(string baseDirectory, bool useAbsoluteUri)
{
Debug.Assert(!string.IsNullOrEmpty(baseDirectory), "'baseDirectory' is null or empty");
Debug.Assert(baseDirectory == baseDirectory.Trim(), "'baseDirectory' contains whitespace at the ends");
Debug.Assert(Path.IsPathRooted(baseDirectory), "'baseDirectory' is not a rooted path");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assertion if to test assumption, here it says that this method expects basedirectory to be rooted, if that is not the case, then may be change to to that it should not be null or empty.
Removal should only happen when we are not at all needing baseDirectory

UriDataAttachment uriDataAttachment = attachment as UriDataAttachment;
if (uriDataAttachment != null)
{
Debug.Assert(uriDataAttachment.Uri.IsAbsoluteUri, "'collectorDataEntry' contains a URI data attachment with a relative URI");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes here, if can pick attachments, from relative URI, the change it that this path should not be null/empty

@abhishkk abhishkk merged commit 5a87ef9 into microsoft:master Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants