Releases: sbabcoc/JUnit-Foundation
Upgrade Settings to version 2.3.10
In this release, I upgraded Settings to the latest release (version 2.3.10)
Upgrade Java-Utils to version 2.1.0
In this release, I upgraded Java-Utils to the latest release (version 2.1.0)
Tweak dependencies to suppress aggressive Guava warning
Guava 30.1.1-android adds an obtrusive warning regarding the intent to remove support for Java 7 in an unspecified future release. I figured out a way to suppress the warning, but this requires pulling in guava
transitively through guava-agent
. Adding to the opacity, guava-agent
is pulled in transitively through java-utils
:
com.nordstrom.tools:java-utils:2.0.3
└── com.nordstrom.tools:guava-agent:30.1.1a
└── com.google.guava:guava:30.1.1-android
Upgrade dependencies and plugins, update README
This release contains no functional changes but is instead focused on project housekeeping.
In addition to project file changes, I also updated the README file:
- Add information about new functions and features.
- Revise code examples to match changes in the underlying API.
- Add notes to clarify the usage of
getCallableOf(Description)
andencloseCallable(Method, Object, Object...)
methods. - Add note regarding "atomic test" objects supplied with suite-level failures.
- Document new method used to identify retried tests, which handles both @Test and @Theory methods.
Add verification that framework object references have been released
This release is a follow-up to previous work that added management of stored references to JUnit framework objects. The unit test collection now verifies that these references are released within the scope where they should be. To maintain the encapsulation of the underlying collections, the test implementation accesses these collections via Java reflection. This necessarily results in tight coupling between the API implementation and the corresponding tests, which is perhaps a good thing in this context.
- I revised the behavior of
AtomicTest.isTest()
to check the attached annotations, instead of relying on theisTest()
method of the wrapped Description object. The documentation for the latter states that this method indicates whether the represented method is an "atomic test", but in actuality only indicates that the described framework object has no children. - I dug deeper into the weird world of JUnitParams, implementing a more comprehensive augmentation of the incomplete Description objects it creates.
- I added code to recover from the
NullPointerException
thrown from within the guts of JUnitParams if you ask it to describe a configuration method (@BeforeClass, @Before, @After, or @AfterClass). - I expanded the scope that will be searched for attached run listeners, enabling clients to access listeners that are attached directly to the run notifier.
- I also resolved the warnings that were reported by the Sonatype Lift static analysis tool.
Expand unit test suite to guard against regression
This release is primarily devoted to beefing up the unit test suite - expanding coverage of existing tests and adding a new test. The expanded tests now check the sequence of lifecycle event notifications published for each corresponding test method.
In the process, I noticed and fixed a few instances where I'd specified JUnit assertion imports for TestNG test classes. I fixed these.
I also expanded the README content to include links to the implementations of supported test runners.
Fix handling of suite-level failures; expose description-to-target mappings
The initial focus for this release was to expose the mappings from Description to test class instance (a.k.a. - target). In the process, I discovered fundamental issues in the way I was handling suite-level failures.
Prior to implementing the changes in this release, notifications for exceptions thrown by @BeforeClass
and @AfterClass
methods would be published with no context (AtomicTest == null). This was terribly uninformative. Now, these failures include non-test context objects. The description of a non-test context object represents the test class to which the failed configuration method belongs.
I also fixed a few random bugs and inefficiencies along the way.
- Add method to map from Description to Target
- Fix handling of suite-level failures:
- AtomicTest: Add support for suite descriptions
- EachTestNotifierInit: Remove 'ensureAtomicTestOf(Description)'; optimized runner acquisition
- LifecycleHooks: 'describeChild' - Ensure runner can support specified child
- RunAnnouncer: Add private shims to create ephemeral atomic test objects for ignored tests and suite failures
Upgrade Junit to version 4.13.2
In this release, we upgraded to the latest release of JUnit (4.13.2)
Add support for automatic retry of failed parameterized tests
In this release, I enhanced the automatic retry feature to include failures of tests under parameterized runners. Previously, enabling automatic retry with parameterized tests would result in a variety of bad behavior.
NOTE: The numbering for this release skips over 15.1.0
, which was deleted because I rushed the process and failed to actually merge the related pull request (#102) prior to publishing it. 🤦♂️
In addition to this added retry support, I fixed a few bugs I encountered along the way. Here's a summary:
- Create a fresh "atomic test" statement for each post-failure retry attempt.
- Refactor implementation to eliminate duplicate code in
Theories
runner support. - Create a new annotation proxy to indicate retried
@Theory
methods. - Optimize handling of ignored tests to avoid checking for activation of the automatic retry feature.
- Enhance the method descriptions produced by JUnitParams, adding the test class and annotations.
- Genericize the return type of
LifecycleHooks.callProxy
, eliminating the need for clients to type-cast the results. - Expand JavaDoc and add code comments to illuminate behaviors and explain "magic".
Release test watcher references as each test finishes
In this release, I added code to release references to test watchers as each test finishes. Prior to this release, these references were retained for the lifetime of the JVM executing the tests, which had the potential to exhaust available memory. For example, each JUnit Foundation unit test attaches a test watcher that retains a reference to the test class instance that created it. Because these references were never explicitly released, test class instances would accumulate during the course of test execution, causing memory consumption to escalate as more tests ran.
NOTE: I tagged this as a major-version release due to the remote possibility that someone besides me was relying on the ability to interact with test watchers after the associated atomic test has finished. Managing these references is now the responsibility of the client.