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

Remove duplicate counting of test results in Consolelogger #2267

Merged
merged 4 commits into from
Jan 2, 2020

Conversation

hvinett
Copy link
Contributor

@hvinett hvinett commented Dec 5, 2019

Description

Current behavior:
Recognizing parent result as passed ,failed or skipped and adding to respective counts.By this we are showing duplicate count.
ex:
Scenario:
if we have a parent test result(passed) and two child test results in which one is passed and the other is failed.
current behavior:
total test =3
passed tests =1
Failed =2

expected behavior:
total tests =2
passed tests =1
failed tests =1

Approach :
Storing every result and it's outcome in dictionary. if it is recognized as parent then removing it from dictionary. By this way we end up with the dictionary that has non parent results and it's outcome. Finally counting the passed,failed, skipped and total in the resulting dictionary will give the expected behavior mentioned above

Assumed parent test result comes first and then the child test result comes.

Related issue

Kindly link any related issues. E.g. Fixes #xyz.

var executionId = GetExecutionId(e.Result);
var parentExecutionId = GetParentExecutionId(e.Result);

if (parentExecutionId != null && leafExecutionIdAndTestOutcomePairDictionary.ContainsKey(parentExecutionId))
Copy link
Member

Choose a reason for hiding this comment

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

@hvinett GetParentExecutionId returns non-nullable guid, removing the nullability check, as well as replacing it with != Guid.Empty check passes all the tests in ConsoleLoggerTests what is the intent here?

Copy link
Contributor Author

@hvinett hvinett Jan 2, 2020

Choose a reason for hiding this comment

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

I kept parentExecutionId != null, because .containskey() throws error if key is null. As it is not null we can check parentExecutionId != Guid.Empty to avoid check in dictionary. Is that fine?

Copy link
Member

Choose a reason for hiding this comment

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

Yup. Let me quickly patch that, because I have the code open, and merge if that passes (it should, I tried it before).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@nohwnd nohwnd merged commit 5ef1f3b into microsoft:master Jan 2, 2020
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