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

new ReducingMethod KEEP_ONLY_LATEST_SCENARIO_RUNS #914

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nddipiazza
Copy link

add a new reducer that can keep only the latest scenario run.
useful for times when you have flaky scenarios and you do retries on
the given scenario, but don't want the flaked attempts to appear in
report.

Nicholas DiPiazza added 3 commits February 5, 2020 11:22
add a new reducer that can keep only the latest scenario run.
useful for times when you have flaky scenarios and you do retries on
the given scenario, but don't want the flaked attempts to appear in
report.
@@ -82,6 +90,42 @@ public ReportParser(Configuration configuration) {

return featureResults;
}

/**
* If the JSON file has the same scenarios run multiple times, keep only the
Copy link
Owner

Choose a reason for hiding this comment

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

AFAIR JSON does not have results for multiple times. For that case you would rather have more than one JSON file. Can you explain this case?

Copy link
Owner

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

@damianszczepanik - I know this is an old PR. This case happens when we use TestNGCucumberRunner and use TestNG's retry analyzer capability to retry tests to disregard flaky tests.

Assuming that we run 1 test with re-run enabled -

What this does is, in case of flaky behavior, where a test would fail first and then would pass when re-tried - it creates 2 entries in JSON for the same test - 1 for the failed test and 2nd for the same test, re-tried. So the final report shows that there were 2 tests.

If the re-tried scenario also fails, it is counted as another failed test. so total 2 failed tests
If the re-tried scenario passed, the report says, 1 failed and 1 passed.

This PR seems to solve that problem.

Copy link
Author

Choose a reason for hiding this comment

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

Exactly. Sorry I didn't respond earlier, got moved on to other priorities and never had a chance to come back and answer the questions/fixes.

}
}

private void addRetryNumberToElmIfNeeded(Optional<Element> lastElement, int numRemoved) {
Copy link
Owner

Choose a reason for hiding this comment

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

this is Java, we don't shorten names to ElmI

@@ -15,7 +15,7 @@

// Start: attributes from JSON file report
private final String id = null;
private final String name = null;
private String name = null;
Copy link
Owner

Choose a reason for hiding this comment

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

name is immutable

Copy link
Author

Choose a reason for hiding this comment

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

i change this to mutable because i use the Name in the report because I append " (${numRetries)" so that it shows up in the report.

alternatively we could create a new element in the html/xslt or whatever.

@ramyasreemaley
Copy link

when will this feature be available in plugin?

@pawarvaibhav
Copy link

This is a super useful update. +1 to get it in as soon as possible.

@damianszczepanik
Copy link
Owner

it has conflicts with master branch

@nddipiazza
Copy link
Author

OK I will get the conflicts fixed and the issues resolved so we can get this merged. ASAP.

@stevegome
Copy link

Hi Team, can anyone please resolve the conflicts for the ^ fix, I am facing a similar issue whereing

  • Using ReTry Analyzer of TestNG which re-reruns the failed testcase
  • However the cucumber.json file shows multiple status for the same scenario
  • My requirement is that it should only update result for the last run

I would really appreciate if someone can point me in the right direction if the issue has already been fixed.

@stevegome
Copy link

stevegome commented Mar 20, 2024

@nddipiazza @damianszczepanik Greetings. Can someone please resolve the merge conflicts and get this PR merged please ?

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.

None yet

5 participants