Skip to content

Commit 8db4fb5

Browse files
authored
[UIA-1194] Release module v10.0.4 (#67)
1 parent 2c9b0e3 commit 8db4fb5

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
## [10.0.4] - 2025-08-14
10+
11+
### Added:
12+
- We fixed an issue where renaming or deleting a module resulted in the test suite overview showing incorrect data.
13+
914
## [10.0.3] - 2025-08-07
1015

1116
### Added:

dist/UnitTesting_10.0.4.mpk

3.42 MB
Binary file not shown.

src/UnitTesting.mpr

0 Bytes
Binary file not shown.

src/javasource/unittesting/TestManager.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public void updateTestSuiteCountersAndResult(IContext context, TestSuite testSui
462462
long pendingCount = getTestSuiteCount(context, testSuite, "[Result = '_1_Running' or Result = empty]");
463463

464464
testSuite.setTestCount(testCount);
465-
LOG.trace("Updated test count to " + succeededCount);
465+
LOG.trace("Updated test count to " + testCount);
466466

467467
testSuite.setTestPassedCount(succeededCount);
468468
LOG.trace("Updated test suite succeeded count to " + succeededCount);
@@ -549,6 +549,11 @@ public synchronized void findAllTests(IContext context) throws CoreException {
549549
updateUnitTestList(context, testSuite);
550550
}
551551

552+
/*
553+
* Remove unit tests from orphaned modules
554+
*/
555+
deleteUnitTestsFromOrphanedModules(context, modules);
556+
552557
/*
553558
* Remove all modules without tests
554559
*/
@@ -585,7 +590,7 @@ private synchronized TestSuite findOrCreateTestSuite(IContext context, String mo
585590
}
586591
}
587592

588-
private synchronized void deleteTestSuitesWithoutTest(IContext context) throws CoreException {
593+
private synchronized void deleteTestSuitesWithoutTest(IContext context) {
589594
StringBuilder query = new StringBuilder();
590595
query.append(String.format("//%s", TestSuite.entityName));
591596
query.append("[not(" + UnitTest.MemberNames.UnitTest_TestSuite + "/" + UnitTest.entityName + ")]");
@@ -594,6 +599,27 @@ private synchronized void deleteTestSuitesWithoutTest(IContext context) throws C
594599
Core.delete(context, testSuites);
595600
}
596601

602+
private synchronized void deleteUnitTestsFromOrphanedModules(IContext context, Set<String> currentModules) {
603+
List<IMendixObject> allTestSuites = Core.createXPathQuery("//" + TestSuite.entityName).execute(context);
604+
605+
for (IMendixObject mxObject : allTestSuites) {
606+
TestSuite testSuite = TestSuite.initialize(context, mxObject);
607+
608+
if (!currentModules.contains(testSuite.getModule())) {
609+
StringBuilder query = new StringBuilder();
610+
query.append(String.format("//%s", UnitTest.entityName));
611+
query.append(String.format("[%s=$TestSuite]", UnitTest.MemberNames.UnitTest_TestSuite));
612+
613+
List<IMendixObject> orphanedUnitTests = Core.createXPathQuery(query.toString())
614+
.setVariable("TestSuite", testSuite.getMendixObject().getId().toLong()).execute(context);
615+
616+
if (!orphanedUnitTests.isEmpty()) {
617+
Core.delete(context, orphanedUnitTests);
618+
}
619+
}
620+
}
621+
}
622+
597623
public synchronized void updateUnitTestList(IContext context, TestSuite testSuite) {
598624
try {
599625
/*

0 commit comments

Comments
 (0)