Skip to content

Commit

Permalink
Task/remove vs from execution (#98)
Browse files Browse the repository at this point in the history
* Add InitializeLifetimeService()

* Improve logging

* Remove stopwatch

* Add logging and make exeption logging consitent

* ignore if we can't report the error

* Add IFrameworkLogger instead

* Add IFrameworkLogger

* Remove Microsoft.VisualStudio.TestPlatform.ObjectModel
  • Loading branch information
mikeblakeuk authored Apr 20, 2020
1 parent 9781660 commit fbb6fdc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using System;

namespace Machine.VSTestAdapter.Execution
{
public interface IFrameworkLogger
{
void SendMessage(TestMessageLevel level, string message);
void SendErrorMessage(string message, Exception exception);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using System.Reflection;
using Machine.Specifications;
using Machine.VSTestAdapter.Helpers;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;

namespace Machine.VSTestAdapter.Execution
{
Expand Down Expand Up @@ -71,7 +69,7 @@ public void RunTestsInAssembly(string pathToAssembly, IEnumerable<VisualStudioTe
try
{
var frameworkLogger = specificationRunListener as IFrameworkLogger;
frameworkLogger?.SendMessage(TestMessageLevel.Error, "Machine Specifications Visual Studio Test Adapter - Error Ending Test Run." + Environment.NewLine + exception);
frameworkLogger?.SendErrorMessage("Machine Specifications Visual Studio Test Adapter - Error Ending Test Run.", exception);
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ public void OnRunStart()

#endregion

public void SendMessage(TestMessageLevel level, string message)
public void SendErrorMessage(string message, Exception exception)
{
frameworkHandle?.SendMessage(level, message);
frameworkHandle?.SendMessage(TestMessageLevel.Error, message + Environment.NewLine + exception);
}
}
}

0 comments on commit fbb6fdc

Please sign in to comment.