Junit5 LinkedIn Learning
Junit5 LinkedIn Learning
Learning JUnit 5
19. What can be said about the order of the tests when parallel
execution is used?
Not a lot; they are executed parallel, but the exact order depends
on the machine the tests are running on.
20. What is the difference between the timeout annotation and
assertTimeout assertion?
The timeout annotation is timing the full method and the
assertTimeout only the execution of the assertion.
21. What plugin can we use for custom reports?
Surefire
22. What is the difference between BeforeAll and
BeforeEach?
BeforeAll is only executed once before all the tests and
BeforeEach before every test.
23. What needs to be done to get implementation code ready
for unit testing?
Make sure the code is testable. Long methods need to be split up
and a single piece of code needs to have a single responsibility.
The implementation code must also be deterministic.
24. What is Mockito used for?
to create mock objects for testing and write loosely coupled tests
that are really only testing the unit of code and not hidden
dependencies of that piece of code
25. Why do we need tests to be deterministic?
Otherwise they are not reliable since they are influenced by
circumstances.