Am I Testing the Right Way? - Two Unit-Testing Approaches Explained!
Talkat JCON Europe 2023 · on Thursday, 2023-06-22· at 12:00· Cinema 5, Im Mediapark 1, 50670 Köln, Germany·
summary
A small Java calculator with expression-tree handlers is implemented and tested with JUnit 5; the concrete claim is that two practical unit-testing scopes work: fine-grained (class-level) mocks tests each handler by mocking nested expressions and the calculator, including a division-by-zero assertion, while coarse-grained via public API exercises the real handlers through Calculator.calculate. Tests run green; tradeoffs: fine-grained forces API openings (unsealing) and many small mocks, coarse-grained keeps internals hidden but can mask poor internal design.
AI-written summary · about
chapters (7)
- 0:00Introduction and testing overview
- 3:57Defining unit testing approaches
- 14:18Fine grain testing style
- 23:22Coarse grain testing style
- 31:55Comparing both testing styles
- 36:12Choosing the right approach
- 37:17Q&A
related talks
54mAutomated Tests: What Courses Won't Teach You
48mEffective Unit Testing
01h 46mHow Java developers should test their applications (RU)
39mRethinking Unit Testing: Automating the Generation of Java
55mUnit Testing Like a Pro - Towards a Testable Design
57mProperty Testing in Java
41mHow deep are your tests
02h 58mOverview of Testing in Our Applications
