sbabcoc / JUnit-Foundation

JUnit Foundation is a lightweight collection of JUnit watchers, interfaces, and static utility classes that supplement and augment the functionality provided by the JUnit API.
Apache License 2.0
22 stars 6 forks source link

Add test for handling of suite-level failures #105

Closed sbabcoc closed 3 years ago

sbabcoc commented 3 years ago

While upgrading the JUnit Foundation dependency of agent-java-junit, I discovered that we couldn't handle suite-level (@BeforeClass) failures. The notifications generated for such failures are associated with the class, not a specific JUnit test of the class. However, the AtomicTest class had no way to represent the description for a JUnit class.
I modified this class so it can handle non-test elements, although this is definitely not what clients are likely to expect. These "atomic non-tests" have no identity and no particle methods. I could potentially attach the specific configuration method that caused the failure, but this may only lead to confusion.
At the least, I need to add at least one unit test to verify that suite-level configuration method failures are handled properly.

sbabcoc commented 3 years ago

Resolved by #107 Prior to the merge of PR #107, we actually have a unit test that covered the general scenario, but this test lacked verification of the "atomic test" object that was supposed to be included with the failure notification. We now explicitly verify that the notification includes a non-test "atomic test" object.