Schedule • Current
state of testing
• Testcontainers •🧪
Lab 1
•🧪
Lab 2
•🧪
Lab 3
introduction
Slide 3
Your test is called what?!
Slide 4
https://martinfowler.com/bliki/TestPyramid.html
Slide 5
https://martinfowler.com/bliki/TestPyramid.html
Slide 6
Slide 7
“Write tests. Not too many. Mostly integration.” https://kentcdodds.com/blog/write-tests
Slide 8
“You’re probably mocking too much.” https://medium.com/extreme-programming/testsdependencies-65f592a46529
Slide 9
Slide 10
Slide 11
Testcontainers
Slide 12
Slide 13
Slide 14
Slide 15
Slide 16
Slide 17
Testcontainers
Docker
Slide 18
“Docker is a great abstraction”
Slide 19
🧪 Our Demo App • Java • Uses • Uses
17 & Spring boot a database (PostgreSQL) Keycloak for authentication
• There is frontend available • Available as a Docker Image purposes
for demo
Slide 20
Slide 21
🧪 Lab 1. • Goal: run the app • App consists of 4 • Database • Keycloak • Backend • User Interface
manually (using Docker) parts:
Slide 22
🧪Lab
1.
Slide 23
🧪Lab
1.
Slide 24
🧪Lab
1.
Slide 25
🧪Lab
1.
Slide 26
🧪Lab
1.
Slide 27
Slide 28
Slide 29
Food :-)
Slide 30
🧪 Lab 2. • Goal: Test database access layer • Using JUnit test lifecycle • Using PostgreSQL Testcontainer • Using Spring Injection of properties dynamically
Slide 31
🧪 Lab
2.
Slide 32
🧪Lab
Hint:
2.
datasource-url wordt ook wel JDBC-url genoemd soms 😄