Skip to content

Commit 0e8106f

Browse files
authored
Release/9.6.1 (#62)
* Release/9.6.1
1 parent 4d7dea5 commit 0e8106f

12 files changed

Lines changed: 221 additions & 168 deletions

CHANGELOG.md

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

77
## [Unreleased]
88

9+
## [9.6.1] - 2025-05-16
10+
11+
### Fixed:
12+
- We fixed an issue that caused unit test microflows with auto-committed objects to fail with an unhandled exception (#244962, #246277, #246384).
13+
- We fixed reporting issue for ThrowAssetionFailed action. Now a failed unnamed assertion step will be reported.
14+
915
## [9.6.0] - 2025-03-20
1016

1117
### Added:

dist/UnitTesting_9.6.1.mpk

3.39 MB
Binary file not shown.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.mendix.UnitTesting</groupId>
88
<artifactId>UnitTesting</artifactId>
9-
<version>9.6.0</version>
9+
<version>9.6.1</version>
1010

1111
<repositories>
1212
<repository>

src/UnitTesting.mpr

0 Bytes
Binary file not shown.
Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,64 @@
11
package testjavaimplementation;
22

33
import com.mendix.core.Core;
4-
import com.mendix.systemwideinterfaces.core.IContext;
54
import org.junit.After;
65
import org.junit.Before;
76
import org.junit.Test;
87
import unittesting.TestExecutionContext;
8+
import unittesting.activities.AssertActivity;
99

1010
import static org.junit.Assert.*;
1111

1212
public class TestExecutionContextTest {
13-
private final IContext context = Core.createSystemContext();
13+
private static final String FAILURE_MESSAGE = "This is a failure message";
1414
private TestExecutionContext testExecutionContext;
1515

1616
@Before
1717
public void setup() {
18-
this.testExecutionContext = new TestExecutionContext(context, "ExampleMicroflow");
18+
this.testExecutionContext = new TestExecutionContext();
1919
}
2020

2121
@After
2222
public void tearDown() {
23-
this.testExecutionContext.delete();
2423
this.testExecutionContext = null;
2524
}
2625

27-
@Test
28-
public void testExecutionContextShouldInitializeUnitTestContext() {
29-
assertNotNull(this.testExecutionContext.getUnitTestContext());
30-
}
31-
3226
@Test
3327
public void hasFailedAssertionShouldBeFalseByDefault() {
34-
assertFalse(this.testExecutionContext.hasFailedAssertion(context));
28+
assertFalse(this.testExecutionContext.hasFailedAssertion());
3529
}
3630

3731
@Test
3832
public void hasFailedAssertionShouldBeFalseWhenAllAssertionsPassed() {
39-
this.testExecutionContext.collectAssertion(context, "Passed 1", true, null);
40-
this.testExecutionContext.collectAssertion(context, "Passed 2", true, null);
33+
this.testExecutionContext.collectAssertion("Passed 1", true, null);
34+
this.testExecutionContext.collectAssertion("Passed 2", true, null);
4135

42-
assertFalse(this.testExecutionContext.hasFailedAssertion(context));
36+
assertFalse(this.testExecutionContext.hasFailedAssertion());
4337
}
4438

4539
@Test
4640
public void hasFailedAssertionShouldBeTrueWhenCollectingFailedAssertion() {
47-
this.testExecutionContext.collectAssertion(context, "Passed", true, null);
48-
this.testExecutionContext.collectAssertion(context, "Failed", false, null);
41+
this.testExecutionContext.collectAssertion("Passed", true, null);
42+
this.testExecutionContext.collectAssertion("Failed", false, null);
43+
44+
assertTrue(this.testExecutionContext.hasFailedAssertion());
45+
}
46+
47+
@Test
48+
public void assertActivityShouldContainFailureMessageWhenCollectingFailedAssertion() {
49+
AssertActivity assertion = this.testExecutionContext.collectAssertion("Failed", false, FAILURE_MESSAGE);
50+
51+
assertEquals(FAILURE_MESSAGE, assertion.getMessage());
52+
}
4953

50-
assertTrue(this.testExecutionContext.hasFailedAssertion(context));
54+
@Test
55+
public void assertActivityShouldNotContainFailureMessageWhenCollectingPassedAssertion() {
56+
AssertActivity assertion = this.testExecutionContext.collectAssertion("Passed", true, FAILURE_MESSAGE);
57+
58+
assertNull(assertion.getMessage());
5159
}
5260

61+
5362
@Test
5463
public void getLastStepShouldBeNullByDefault() {
5564
assertNull(this.testExecutionContext.getLastStep());
@@ -65,67 +74,67 @@ public void getLastStepShouldReturnLastCollectedStep() {
6574

6675
@Test
6776
public void getFailureReasonsShouldBeNullByDefault() {
68-
assertEquals(0, this.testExecutionContext.getFailureReasons(context).size());
77+
assertEquals(0, this.testExecutionContext.getFailureReasons().size());
6978
}
7079

7180
@Test
7281
public void getFailureReasonsShouldBeNullIfTestPassed() {
7382
this.testExecutionContext.collectStart(true, null);
74-
this.testExecutionContext.collectAssertion(context, "Passed 1", true, null);
75-
this.testExecutionContext.collectAssertion(context, "Passed 2", true, null);
83+
this.testExecutionContext.collectAssertion("Passed 1", true, null);
84+
this.testExecutionContext.collectAssertion("Passed 2", true, null);
7685
this.testExecutionContext.collectEnd(true, null);
7786

78-
assertEquals(0, this.testExecutionContext.getFailureReasons(context).size());
87+
assertEquals(0, this.testExecutionContext.getFailureReasons().size());
7988
}
8089

8190
@Test
8291
public void getFailureReasonsShouldIncludeFailedStart() {
8392
this.testExecutionContext.collectStart(false, "Start failed");
8493

85-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
94+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
8695
}
8796

8897
@Test
8998
public void getFailureReasonsShouldIncludeFailedEnd() {
9099
this.testExecutionContext.collectEnd(false, "End failed");
91100

92-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
101+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
93102
}
94103

95104
@Test
96105
public void getFailureReasonsShouldIncludeFailedAssertion() {
97-
this.testExecutionContext.collectAssertion(context, "Passed", true, null);
98-
this.testExecutionContext.collectAssertion(context, "Failed 1", false, null);
99-
this.testExecutionContext.collectAssertion(context, "Failed 2", false, null);
106+
this.testExecutionContext.collectAssertion("Passed", true, null);
107+
this.testExecutionContext.collectAssertion("Failed 1", false, null);
108+
this.testExecutionContext.collectAssertion("Failed 2", false, null);
100109

101-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
110+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
102111
}
103112

104113
@Test
105114
public void getFailureReasonsShouldIncludeUncaughtException() {
106115
this.testExecutionContext.collectException(new Exception("Example Exception"));
107116

108-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
117+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
109118
}
110119

111120
@Test
112121
public void getFailureReasonsShouldIncludeAllUniqueFailureReasons() {
113122
this.testExecutionContext.collectStart(false, "Start failed");
114-
this.testExecutionContext.collectAssertion(context, "Failed 1", false, null);
115-
this.testExecutionContext.collectAssertion(context, "Failed 2", false, null);
123+
this.testExecutionContext.collectAssertion("Failed 1", false, null);
124+
this.testExecutionContext.collectAssertion("Failed 2", false, null);
116125
this.testExecutionContext.collectException(new Exception("Test Exception"));
117126
this.testExecutionContext.collectEnd(false, "End failed");
118127

119-
assertEquals(4, this.testExecutionContext.getFailureReasons(context).size());
128+
assertEquals(4, this.testExecutionContext.getFailureReasons().size());
120129
}
121130

122131
@Test
123132
public void createTestActivitiesShouldContainAllCollectedTestActivities() {
124133
this.testExecutionContext.collectStart(true, "Started test");
125134

126-
this.testExecutionContext.collectAssertion(context, "Passed", true, null);
127-
this.testExecutionContext.collectAssertion(context, "Failed 1", false, null);
128-
this.testExecutionContext.collectAssertion(context, "Failed 2", false, null);
135+
this.testExecutionContext.collectAssertion("Passed", true, null);
136+
this.testExecutionContext.collectAssertion("Failed 1", false, null);
137+
this.testExecutionContext.collectAssertion("Failed 2", false, null);
129138

130139
this.testExecutionContext.collectStep("Step 1");
131140
this.testExecutionContext.collectStep("Step 2");
@@ -134,6 +143,6 @@ public void createTestActivitiesShouldContainAllCollectedTestActivities() {
134143

135144
this.testExecutionContext.collectEnd(true, "Test ended successfully");
136145

137-
assertEquals(8, this.testExecutionContext.createTestActivities(context, null).size());
146+
assertEquals(8, this.testExecutionContext.createTestActivities(Core.createSystemContext(), null).size());
138147
}
139148
}

0 commit comments

Comments
 (0)