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

Logger extensibility #557

Merged
merged 16 commits into from
Mar 3, 2017
Merged

Logger extensibility #557

merged 16 commits into from
Mar 3, 2017

Conversation

Faizan2304
Copy link
Contributor

This PR address following work

  1. Loggers with name *.TestLogger.dll" will be discover from source directory
  2. Loggers with name *.TestLogger.dll" will be discover from/TestAdapterPath
  3. Loggers from source directory will be discovered only when DesignMode is false

@Faizan2304 Faizan2304 requested review from codito and AbhitejJohn March 1, 2017 19:58
@msftclas
Copy link

msftclas commented Mar 1, 2017

@Faizan2304,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

/// <summary>
/// Update the test adapter paths provided through run settings to be used by the test service
/// </summary>
private void UpdateAndInitializeLoggers(TestRunCriteria testRunCriteria)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in next commit

@@ -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
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.")) {
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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

Copy link
Contributor Author

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();
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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(
Copy link
Contributor

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();
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

@codito codito Mar 3, 2017

Choose a reason for hiding this comment

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

typo: argument

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in next commit

@Faizan2304 Faizan2304 merged commit 9a639af into microsoft:master Mar 3, 2017
@Faizan2304 Faizan2304 deleted the loggerExtensibility branch March 3, 2017 12:57
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.

3 participants