You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In versions prior to 3.9.x , the TestOutcome.addTag(TestTag tag) method exhibited a specific behavior where it invoked the getTags() method when the tags field was uninitialized.
public void addTag(TestTag tag) {
Set<TestTag> updatedTags = new HashSet<>(getTags());
updatedTags.add(tag);
this.tags = updatedTags;
this.allTags = addFeatureTagTo(this.tags);
}
This behavior was crucial as getTags() was used to enrich the TestOutcome object with tags annotated by @WithTags. This enrichment process was essential for ensuring that tests tagged through the -Dtags parameter during the test execution were correctly included in the final test report.
However, starting from version 3.9.x addTag() internal logic's been changed. The addTag(TestTag tag) method no longer triggers getTags() internally.
public void addTag(TestTag tag) {
Set<TestTag> updatedTags = (tags == null) ? new HashSet<>() : new HashSet<>(tags);
updatedTags.add(tag);
this.tags = updatedTags;
//this.allTags = addFeatureTagTo(this.tags);
}
Consequently, this change leads to the omission of tests in the report generation process as captured in the FreemarkerContext.getBuildContext() method, where "scenarios" and "allTestOutcomes" keys may not correctly reflect the intended tagged outcomes.
Run that UI test by including -Dtags=NAME_OF_TAG ( ./gradlew clean test aggregate -Dtags=TEST_TAG --no-daemon)
Check Serenity report
Observe the generated report missing the executions of tests with specific tags.
How can we make it happen?
Work on this myself and propose a PR (with Serenity BDD team guidance)
The text was updated successfully, but these errors were encountered:
EgorIu
changed the title
Regression in TestOutcome.addTag(TestTag tag) Method: Test Are Not Included in Final Report
Regression in TestOutcome.addTag(TestTag tag) method: test are not included in final report when running them using jUnit4 and -Dtags parameter
Sep 12, 2024
What happened?
In versions prior to 3.9.x , the TestOutcome.addTag(TestTag tag) method exhibited a specific behavior where it invoked the getTags() method when the tags field was uninitialized.
This behavior was crucial as getTags() was used to enrich the TestOutcome object with tags annotated by @WithTags. This enrichment process was essential for ensuring that tests tagged through the -Dtags parameter during the test execution were correctly included in the final test report.
However, starting from version 3.9.x addTag() internal logic's been changed. The addTag(TestTag tag) method no longer triggers getTags() internally.
Consequently, this change leads to the omission of tests in the report generation process as captured in the FreemarkerContext.getBuildContext() method, where "scenarios" and "allTestOutcomes" keys may not correctly reflect the intended tagged outcomes.
This seems to be a regression from the prior behavior, potentially affecting any test executions relying on dynamically passed tags for reports.
What did you expect to happen?
The addTag(TestTag tag) should trigger getTags() when the tags field is null, ensuring all tagged tests are included in the report.
Serenity BDD version
All versions above 3.8.1
JDK version
17
Execution environment
Operation system: Windows
Browsers: Edge, Chrome
How to reproduce the bug.
How can we make it happen?
Work on this myself and propose a PR (with Serenity BDD team guidance)
The text was updated successfully, but these errors were encountered: