11. kwiecień 2019 - 9:00
Poleć na:

Practical Unit Testing in Java 10 - Workshop Kraków! | Codete | czwartek, 11. kwiecień 2019

Practical unit testing with Java
Workshops are based on simple, real-life, spring-based application as a case study, which is used to practise designing, writing and maintaining of unit tests.
We focus on the most useful and popular nowadays frameworks: JUnit, Mockito and AssertJ, using Java 8 features extensively. We not only describe their capabilities in detail, but also show how to combine them together to significantly facilitate the creation of well separated and transparent test cases.
Participants will acquire practical knowledge about the most common mistakes and best practices (including TDD and BDD).
Prerequisites


At least 1 year of practical experience with Java


Basic knowledge of Spring


Outcomes


A good understanding of unit testing, best practices and must-know testing frameworks


Access to exclusive materials covering the scope of the workshops


Agenda
DAY 1

Introduction


The purpose of software tests


Types of tests and key differences


Do we really need unit tests? - case study


Place of tests in software deployment process



JUnit


Introduction: general rules, execution order, annotations, assertions


Exercise


Testing exceptions: @Rule and @ExpectedException


Exercise


Test suites, parameterized tests, categories


Exercise



Unit test best practises


Defining good unit tests


Examples of poor unit tests - case studies


Naming conventions




Test boundaries, avoiding interdependencies


TDD and BDD


Is my code coverage sufficient?


Exercise



Mocking with Mockito


The need for mocking frameworks


Difference between mocks, stubs, fake & dummy objects


Basic mockito usage, BDD in Mockito


Exercises


Mockito advanced techniques


Exercises



DAY 2
Let’s read our tests like a book - AssertJ


Let’s play with AssertJ - replacing JUnit assertions with AssertJ


Exercise


Can we make current test cases simpler?


AssertJ additions for Java 8


More Exercises - including refactoring of existing test cases



Exercises:


Complex exercises using combination of previously introduced libraries



HOMEWORK:
Increase code coverage of the existing codebase, if required refactor the code in order to be able to unit test it.
Timeline
2-day workshops
We provide a delicious complimentary meal, coffee, and snacks.
If you have any further questions please contact us via