-
Notifications
You must be signed in to change notification settings - Fork 323
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
Logger extensibility #557
Logger extensibility #557
Conversation
1) support to load and enable from /TestAdapterPath and bin\debug folder 2) Move the logic to initialize logger from vstest.console to TestPlatform.client
@Faizan2304, |
/// <summary> | ||
/// Update the test adapter paths provided through run settings to be used by the test service | ||
/// </summary> | ||
private void UpdateAndInitializeLoggers(TestRunCriteria testRunCriteria) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think TP.Common
is the right place for this logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in next commit
2) Fixed failed test
@@ -164,6 +164,13 @@ function Invoke-Test | |||
# Fill in the framework in test containers | |||
$testContainerSet = $testContainers | % { [System.String]::Format($_, $fx) } | |||
$trxLogFileName = [System.String]::Format("Parallel_{0}_{1}", $fx, $Script:TPT_DefaultTrxFileName) | |||
|
|||
# Remove already existed trx file name as due to which warning will get generated and since we are expecting result in a particular format, that will break | |||
$fullTrxFilePath = Join-Path $Script:TPT_TestResultsDir $trxLogFileName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't trx file be overwritten automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is it a warning that requires this step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it the warning due to which we required this step
@@ -177,10 +184,10 @@ function Invoke-Test | |||
|
|||
Reset-TestEnvironment | |||
|
|||
if ($output[-2].Contains("Test Run Successful.")) { | |||
Write-Log ".. . $($output[-3])" | |||
if ($output[-3].Contains("Test Run Successful.")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite sure how it is working today in clean machines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have added trx in our test, after summary it will add trx file info which is increasing the result by one line. Since every time we are deleting the trx file before running test, its equal to clean machine run
List<string> adapterFiles = new List<string>( | ||
Directory.EnumerateFiles(adapterPath,TestPlatformConstants.TestAdapterPattern , SearchOption.AllDirectories) | ||
this.fileHelper.EnumerateFiles(adapterPath, TestPlatformConstants.TestAdapterResxPattern, SearchOption.AllDirectories) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo RegexPattern instead of ResxPattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in next commit
/// <summary> | ||
/// Initializes a new instance of the <see cref="TestPlatform"/> class. | ||
/// </summary> | ||
public TestPlatform() : this(new TestEngine()) | ||
{ | ||
fileHelper = new FileHelper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it better is inject IFileHelper via ctor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, its a valid point. Fixed in next commit.
#endregion | ||
|
||
#region Public Methods | ||
|
||
public void UpdateLoggerList(string arument, string loggerIdentifier, Dictionary<string, string> parameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Require docs for public methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated in next commit
} | ||
else | ||
{ | ||
throw new InvalidLoggerException( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indent
internal virtual IEnumerable<string> GetTestAdaptersFromDirectory(string directory) | ||
{ | ||
return Directory.EnumerateFiles(directory, TestPlatformConstants.TestAdapterPattern, SearchOption.AllDirectories); | ||
FileHelper fileHelper = new FileHelper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if there are tests for this. FileHelper
should be injected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we have test for it.
#endregion | ||
|
||
#region Public Methods | ||
|
||
public void UpdateLoggerList(string arument, string loggerIdentifier, Dictionary<string, string> parameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in next commit
This PR address following work