You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/ReleaseNotes4.12.md
+84-3Lines changed: 84 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,12 @@ In the usual case, where the array elements are in fact exactly equal, the poten
20
20
# Test Runners
21
21
22
22
23
-
### [Pull request #817:] (https://github.com/junit-team/junit/pull/817) Support for context hierarchies
23
+
### [Pull request #763:](https://github.com/junit-team/junit/pull/763) Allow custom test runners to create their own TestClasses and customize the scanning of annotations.
24
+
25
+
This introduces some extension points to `ParentRunner` to allow subclasse to control creation
26
+
of the `TestClass` instance and to scan for annotations.
27
+
28
+
### [Pull request #817:](https://github.com/junit-team/junit/pull/817) Support for context hierarchies
24
29
25
30
The `AnnotatedBuilder` is a strategy for constructing runners for test classes that have been annotated with the `@RunWith` annotation. All tests within such a class will be executed using the runner that was specified within the annotation.
26
31
@@ -140,7 +145,7 @@ If a custom failure message is not provided, a default message is used.
140
145
# Timeout for Tests
141
146
*See also [Timeout for tests](https://github.com/junit-team/junit/wiki/Timeout-for-tests)*
142
147
143
-
### [Pull request #823:](https://github.com/junit-team/junit/pull/823) Throw `TestFailedOnTimeoutException` instead of plain `Exception` on timeout
148
+
### [Pull request #823:](https://github.com/junit-team/junit/pull/823) Throw `TestFailedOnTimeoutException` instead of plain `Exception` on timeout
144
149
145
150
When a test times out, a `org.junit.runners.model.TestTimedOutException` is now thrown instead of a plain `java.lang.Exception`.
146
151
@@ -225,6 +230,8 @@ public class HasGlobalTimeout {
225
230
```
226
231
Each test is run in a new _daemon_ thread. If the specified timeout elapses before the test completes, its execution is interrupted via `Thread#interrupt()`. This happens in interruptable I/O (operations throwing `java.io.InterruptedIOException` and `java.nio.channels.ClosedByInterruptException`), locks (package `java.util.concurrent`) and methods in `java.lang.Object` and `java.lang.Thread` throwing `java.lang.InterruptedException`.
227
232
233
+
### [Pull request #876:](https://github.com/junit-team/junit/pull/876) The timeout rule never times out if you pass in a timeout of zero.
234
+
228
235
229
236
# Parameterized Tests
230
237
@@ -242,7 +249,7 @@ The factory for creating the `Runner` instance of a single set of parameters is
The `Stopwatch` Rule notifies one of its own protected methods of the time spent by a test. Override them to get the time in nanoseconds. For example, this class will keep logging the time spent by each passed, failed, skipped, and finished test:
248
255
@@ -342,6 +349,31 @@ If you call `TemporaryFolder.newFolder("foo/bar")` in JUnit 4.10 the method retu
342
349
343
350
With this fix, folder names are validated to contain single path name. If the folder name consists of multiple path names, an exception is thrown stating that usage of multiple path components in a string containing folder name is disallowed.
344
351
352
+
### [Pull request #1015:](https://github.com/junit-team/junit/pull/1015) Methods annotated with `Rule` can return a `MethodRule`.
353
+
354
+
Methods annotated with `@Rule` can now return either a `TestRule` (or subclass) or a
355
+
`MethodRule` (or subclass).
356
+
357
+
Prior to this change, all public methods annotated with `@Rule` were called, but the
358
+
return value was ignored if it could not be assigned to a `TestRule`. After this change,
359
+
the method is only called if the return type could be assigned to `TestRule` or
360
+
`MethodRule`. For methods annotated with `@Rule` that return other values, see the notes
361
+
for pull request #1020.
362
+
363
+
### [Pull request #1020:](https://github.com/junit-team/junit/pull/1020) Added validation that @ClassRule should only be implementation of TestRule.
364
+
365
+
Prior to this change, fields annotated with `@ClassRule` that did not have a type of `TestRule`
366
+
(or a class that implements `TestRule`) were ignored. With this change, the test will fail
367
+
with a validation error.
368
+
369
+
Prior to this change, methods annotated with `@ClassRule` that did specify a return type
370
+
of `TestRule`(or a class that implements `TestRule`) were ignored. With this change, the test
371
+
will fail with a validation error.
372
+
373
+
### [Pull request #1021:](https://github.com/junit-team/junit/pull/1021) JavaDoc of TemporaryFolder: folder not guaranteed to be deleted.
374
+
375
+
Adjusted JavaDoc of TemporaryFolder to reflect that temporary folders are not guaranteed to be
376
+
deleted.
345
377
346
378
# Theories
347
379
@@ -629,3 +661,52 @@ While using JUnit in Android apps, if any other referenced library has a file na
629
661
`Error generating final archive: Found duplicate file for APK: LICENSE.txt`
630
662
631
663
To avoid this, the license file has been renamed to `LICENSE-junit.txt`
664
+
665
+
666
+
### [Pull request #962:](https://github.com/junit-team/junit/pull/962) Do not include thread start time in test timeout measurements.
667
+
668
+
The time it takes to start a thread can be surprisingly large.
669
+
Especially in virtualized cloud environments where noisy neighbours.
670
+
This change reduces the probability of non-deterministic failures of
671
+
tests with timeouts (@Test(timeout=…)) by not beginning the timeout
672
+
clock until we have observed the starting of the task thread – the
673
+
thread that runs the actual test. This should make tests with small
674
+
timeout values more reliable in general, and especially in cloud CI
675
+
environments.
676
+
677
+
# Fixes to issues introduced in JUnit 4.12
678
+
679
+
The following section lists fixes to problems introduced in the first
680
+
release candidates for JUnit 4.12. You can ignore this section if you are
681
+
trying to understand the changes between 4.11 and 4.12.
682
+
683
+
### [Pull request #961:](https://github.com/junit-team/junit/pull/961) Restore field names with f prefix.
684
+
685
+
In order to make the JUnit code more consistent with current coding practices, we changed
686
+
a number of field names to not start with the prefix "f". Unfortunately, at least one IDE
687
+
referenced a private field via reflection. This change reverts the field names for fields
688
+
known to be read via reflection.
689
+
690
+
### [Pull request #988:](https://github.com/junit-team/junit/pull/988) Revert "Delete classes that are deprecated for six years."
691
+
692
+
In [745ca05](https://github.com/junit-team/junit/commit/745ca05dccf5cc907e43a58142bb8be97da2b78f)
693
+
we removed classes that were deprecated for many releases. There was some concern that people
694
+
might not expect classes to be removed in a 4.x release. Even though we are not aware of any
695
+
problems from the deletion, we decided to add them back.
696
+
697
+
These classes may be removed in JUnit 5.0 or later.
0 commit comments