Skip to content

Commit

Permalink
Fix for #3189 - fixed ignored testcases count (#3190)
Browse files Browse the repository at this point in the history
* Fix for #3189 - fixed ignored testcases count

---------

Co-authored-by: Kanaduchi <[email protected]>
  • Loading branch information
Kanaduchi and AnTopch authored Nov 22, 2024
1 parent 7c80f4c commit 3b79840
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Fixed: GITHUB-3028: Execution stalls when using "use-global-thread-pool" (Krishn
Fixed: GITHUB-3122: Update JCommander to 1.83 (Antoine Dessaigne)
Fixed: GITHUB-3135: assertEquals on arrays - Failure message is missing information about the array index when an array element is unexpectedly null or non-null (Albert Choi)
Fixed: GITHUB-3140: assertEqualsDeep on Sets - Deep comparison was using the wrong expected value
Fixed: GITHUB-3189: Incorrect number of ignored tests displayed in the XML results

7.10.2
Fixed: GITHUB-3117: ListenerComparator doesn't work (Krishnan Mahadevan)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public void add(Count count) {
this.failed += count.failed;
this.skipped += count.skipped;
this.retried += count.retried;
this.ignored += count.retried;
this.ignored += count.ignored;
}

private Count(Builder builder) {
Expand Down
11 changes: 11 additions & 0 deletions testng-core/src/test/java/test/reports/SimpleIgnoredSample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package test.reports;

import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

public class SimpleIgnoredSample {

@Test
@Ignore
public void ignored() {}
}
11 changes: 8 additions & 3 deletions testng-core/src/test/java/test/reports/XmlReporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ public void ensureReportGenerationWhenTestMethodIsWrappedWithWrappedTestNGMethod
@Test(description = "GITHUB-2886")
public void ensureConfigurationMethodsAreNotCountedAsSkippedInXmlReports() throws Exception {
File file =
runTest(RuntimeBehavior.FILE_NAME, null, JekyllTestSample.class, HydeTestSample.class);
runTest(
RuntimeBehavior.FILE_NAME,
null,
JekyllTestSample.class,
HydeTestSample.class,
SimpleIgnoredSample.class);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(file);
Expand All @@ -103,8 +108,8 @@ public void ensureConfigurationMethodsAreNotCountedAsSkippedInXmlReports() throw
int total = Integer.parseInt(node.getAttributes().getNamedItem("total").getNodeValue());
int passed = Integer.parseInt(node.getAttributes().getNamedItem("passed").getNodeValue());
int failed = Integer.parseInt(node.getAttributes().getNamedItem("failed").getNodeValue());
assertThat(ignored).isZero();
assertThat(total).isEqualTo(2);
assertThat(ignored).isEqualTo(1);
assertThat(total).isEqualTo(3);
assertThat(passed).isEqualTo(2);
assertThat(failed).isZero();
}
Expand Down

0 comments on commit 3b79840

Please sign in to comment.