-
Notifications
You must be signed in to change notification settings - Fork 324
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
Html logger #2103
Html logger #2103
Conversation
2. Added remaining unit tests 3. Removed redundant spaces.
src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs
Outdated
Show resolved
Hide resolved
...osoft.TestPlatform.Extensions.HtmlLogger/Microsoft.TestPlatform.Extensions.HtmlLogger.csproj
Outdated
Show resolved
Hide resolved
src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestResults.cs
Outdated
Show resolved
Hide resolved
Rename the file name of this file, make sure it is formatted correctly. Also, put these files in a folder, name it ObjectModel Refers to: src/Microsoft.TestPlatform.Extensions.HtmlLogger/Testresult.cs:1 in a5fe993. [](commit_id = a5fe993, deletion_comment = False) |
src/Microsoft.TestPlatform.Extensions.HtmlLogger/TestRunSummary.cs
Outdated
Show resolved
Hide resolved
...xtensions.HtmlLogger.UnitTests/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests.csproj
Outdated
Show resolved
Hide resolved
test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs
Show resolved
Hide resolved
}); | ||
} | ||
|
||
/// <summary> |
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.
Add some useful summary for the tests, repeating what's already there in the name of the test is not advisable.
Resources files added updated packeges.json with html logger project Added exception handling and eqt trace logging to files
Fixed the Portable nuspec file
ex.ToString()); | ||
ConsoleOutput.Instance.Error(false, string.Concat(HtmlResource.HtmlLoggerError), ex.Message); | ||
return; | ||
} |
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.
Add tests for these
{ | ||
DisplayName = "def", | ||
ErrorMessage = "error message", | ||
ErrorStackTrace = "Error stack trace", |
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.
Incomplete test
test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests/HtmlLoggerTests.cs
Outdated
Show resolved
Hide resolved
@@ -132,5 +132,11 @@ public string[] GetFiles(string path, string searchPattern, SearchOption searchO | |||
{ | |||
return Directory.GetFiles(path, searchPattern, searchOption); | |||
} | |||
|
|||
/// <inheritdoc/> | |||
public void Delete(string path) |
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.
Can you change this to TryDelete with bool return, In case file does not exists this API will throw.
/// </summary> | ||
/// <param name="duration"></param> | ||
/// <returns></returns> | ||
internal string GetFormattedDurationString(TimeSpan duration) |
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.
GetFormattedDurationString [](start = 24, length = 26)
make it private
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 want to test the GetFormattedDurationString function.
|
||
TestResultsDirPath = testResultsDirPath; | ||
TestRunDetails = new TestRunDetails(); | ||
Results = new ConcurrentDictionary<Guid, ObjectModel.TestResult>(); |
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.
Results [](start = 12, length = 7)
do we need concurrent dictionaries, I'm not sure if multiple threads are trying to add to results.
@dotnet-bot test |
How do we make use of the new HTML logger? The docs need updating: https://github.com/Microsoft/vstest-docs/blob/master/docs/report.md#syntax-of-default-loggers |
@RehanSaeed Thanks. the docs have been updated. |
Is there a way to use it with dotnet test --logger 'html;LogFileName=foo.html' |
@RehanSaeed This will be part of the dotnet sdk, and the 3.1.xx release will have it, it is still not out yet. |
Cool! Is the syntax to support multiple loggers like this? dotnet test --logger trx;LogFileName=foo.trx --logger html;LogFileName=foo.html |
How to use this html logger with runsettings file? I tried via cli and it works, but no luck through the config file.
|
@nohwnd can you please check if it's possible to enable the html logger via the .runsettings file? Thanks |
@RehanSaeed yes that works, but you should put those options in quotes if you run them from bash / powershell because ; terminates the command and you would end up evaluating only half of the command. Or in powershell you can use the parsing terminator # cmd / bash / powershell
dotnet test --logger "trx;LogFileName=foo.trx" --logger "html;LogFileName=foo.html"
# or another way in powershell
dotnet test --% --logger trx;LogFileName=foo.trx --logger html;LogFileName=foo.html This is what you'd do from settings, I actually just copied it from the log and removed unneeded lines: dotnet test --% --logger trx;LogFileName=foo.trx --logger html;LogFileName=foo.html --diag c:\temp\log.txt <RunSettings>
<RunConfiguration>
</RunConfiguration>
<LoggerRunSettings>
<Loggers>
<Logger friendlyName="trx" enabled="True">
<Configuration>
<LogFileName>foo.trx</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="html" enabled="True">
<Configuration>
<LogFileName>foo.html</LogFileName>
</Configuration>
</Logger>
</Loggers>
</LoggerRunSettings>
</RunSettings>
|
Description
Adding the html logger, which would output the test results in the html format.
Related issue
#2065
Here is the draft html