From the course: Java: Testing with JUnit
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Custom messages and reports
From the course: Java: Testing with JUnit
Custom messages and reports
- [Instructor] All right, let's talk about options for creating custom messages and reports. First of all, we have seen display name already. Second, we saw that we could add a custom message as a third argument for assertions. And what we'll also see, and this is new, is the Surefire plugin that we can use. So first of all, we have seen display name already. With the annotation "@DisplayName", we could add a custom message to our report. And what we also saw was that we could add a third argument to assertEquals. So, for example, here, we could specify and insert a custom message, for example, "Unexpected value, expected 900". Clearly, this is not going to be very informative. This was what the test would also be saying, but in order to get this message on the screen, we have to make sure that the test is going to fit. Let me run this again. And if I scroll down a bit, you can see here, our custom message, "Unexpected…
Contents
-
-
-
-
-
(Locked)
Dependency injection in your tests5m 7s
-
Repeated tests2m 55s
-
(Locked)
Parameterized tests9m 29s
-
(Locked)
Timeouts4m 49s
-
(Locked)
Parallel execution3m 42s
-
(Locked)
Lifecyle control: Before and after5m 10s
-
(Locked)
Custom messages and reports4m 28s
-
(Locked)
Conditional test execution4m 19s
-
(Locked)
Disabling unit tests1m 45s
-
(Locked)
Solution: Refactoring1m 1s
-
(Locked)
-
-