Skip to content

Fix EntityXmlAssertTest test-count inflation and its masked servicetests dependency - #1627

Merged
ashishvijaywargiya merged 1 commit into
apache:trunkfrom
ashishvijaywargiya:fix-entityxmlassert-testcount-inflation
Aug 11, 2026
Merged

Fix EntityXmlAssertTest test-count inflation and its masked servicetests dependency#1627
ashishvijaywargiya merged 1 commit into
apache:trunkfrom
ashishvijaywargiya:fix-entityxmlassert-testcount-inflation

Conversation

@ashishvijaywargiya

Copy link
Copy Markdown
Contributor

Problem

EntityXmlAssertTest.countTestCases() returned the number of <entity> records in the referenced XML file instead of 1. JUnit 3's TestResult.startTest() adds this into the suite's run count on every test start, so the tests total reported in the JUnit XML/HTML report ends up inflated by the size of the referenced data file rather than reflecting the number of test cases actually run - e.g. scrumtests reported tests="478" while only 41 <testcase> elements were ever written.

Fix

countTestCases() now returns 1, matching ServiceTest and SimpleMethodTest.

That method's old implementation called EntitySaxReader.parse(), which performs real inserts via delegator.storeAll() - it wasn't just counting. Since TestResult.startTest() calls countTestCases() right before every test runs, this had become a load side effect that was masking a missing action="load" on servicetests.xml's load-data-service-permission-tests case: that case had no action attribute, so it silently defaulted to action="assert", and only ever passed because countTestCases() had accidentally already loaded its own fixture data first. Added the explicit action="load" so the load no longer depends on that side effect.

Checked the rest of the codebase for other <entity-xml> elements missing action=; this was the only one.

Verification

Fresh cleanAll loadAll + test + testIntegration run: 650 integration tests / 0 failures / 0 errors, 599 unit tests / 0 failures.

…sts dependency

EntityXmlAssertTest.countTestCases() returned the number of entity
records in the referenced XML file instead of 1, inflating the
'tests' total in JUnit XML/HTML reports (e.g. scrumtests reported
478 tests but only ever ran 41). Now returns 1, matching
ServiceTest and SimpleMethodTest.

That method's implementation called EntitySaxReader.parse(), which
performs real inserts via delegator.storeAll() - not just a count.
Since JUnit 3's TestResult.startTest() calls countTestCases() right
before every test runs, this was a load side effect masking a
missing action="load" on servicetests.xml's
load-data-service-permission-tests case (it defaulted to
action="assert" and only ever passed because countTestCases()
accidentally loaded its own fixture data first). Added the missing
action="load" so the load is explicit.

Verified with a fresh cleanAll loadAll + test + testIntegration run:
650 tests, 0 failures, 0 errors.
@ashishvijaywargiya
ashishvijaywargiya merged commit c762bc8 into apache:trunk Aug 11, 2026
7 checks passed
@ashishvijaywargiya
ashishvijaywargiya deleted the fix-entityxmlassert-testcount-inflation branch August 11, 2026 11:27
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.

1 participant