Test Driven Development with Spring Boot - Sannidhi Jalukar, Madhura Bhave

preview_player
Показать описание
Ever wonder how to test a hard problem like caching or write an integration test without making an external API call? Or come across a situation where testing something was so hard that it never got tested? A lot of developers today find themselves in situations where they are unsure of how to write light-weight unit tests. In our presentation, we will talk about how to do Test-driven development for a Spring Boot application and how some of the latest Spring Boot annotations and utilities make that easy. We will deep dive into some tricky real world testing scenarios that have baffled us in the past such as database queries, caching, reactive components, and message brokers.

Sannidhi Jalukar, Software Engineer, Pivotal
Madhura Bhave, Software Engineer, Pivotal
Filmed at SpringOne Platform 2017
Рекомендации по теме
Комментарии
Автор

5:00 Integration test
10:40 Controller Unit testing
13:45 Controller creation
14:46 Service unit testing
19:05 Exception handler creation
25:29 Repository unit testing
51:28 Integration testing

manuelcarbajal
Автор

Something that often messes up importing dependencies in IntelliJ is this: in preferences, under Build, Execution, Deployment / Build Tools / Maven / Importing, un-check the checkbox that says "Keep source and test folders on reimport". I don't know who would ever want this checked. It basically makes the IDE ignore when you try to reimport dependencies.

Skiamakhos
Автор

please update to talk about using Jupiter jUnit 5 as the annotations and process is different

jesse
Автор

Great talk Sannidhi and Madhura, TDD is the way to go!

richardlanglois
Автор

Grate demo and good explanation about various layers of testing, special with mockito.

RamMohan
Автор

I enjoyed it a lot. But from what I recall, Sonarqube considers a critical issue having private methods in the controllers...

LorenzoBettini
Автор

In the beginning, it was good because I have already seen Phil webb Spring Boot testing session. You guys are also good but network connection or something it get spoiled there. I loved it the beginnning abd now xou can see in teg i ma alos gettngi bda. :P

sagarrout
Автор

This is really nice starting point for someone learning testing with Spring.
Is there a github repository for the code shown in the video?

omkarmanjrekar
Автор

Great job girls, it was to the point and helpful..

vanitapatel
Автор

One question for CachingTest: Why the configured @AutoConfigureTestDatabase when they used @MockBean on CarRepository? It won't reach out memory database anyway....am I wrong? Thanks

VLADICAKG
Автор

Loved the lived coding and enjoyed it but eventually the issue spoiled the fun. Well done gals

venuvemula
Автор

@DataJpaTest is itself is annotated with @AutoConfigureCache with CacheType cacheProvider() default CacheType.NONE;

So, is there really caching when using repository.save(entity) in a test?

leszeknagooglach
Автор

Don’t get a purpose of testing repositories instead of larger units like application services or even modules. It is close to the “test-per-class” antipattern. I think we should focus more on testing behavior than implementation :)

CharlesRay
Автор

watched for first 20 minutes...its good and fruitful...Thanks!!!

punitdhiman
Автор

The driven design part and refactoring part are missing in this video though

kevinjom
Автор

Awesome presentation. Thanks a lot for sharing with us.

karthikperumalla
Автор

Thanks for doing presentation on this.
It was good at start, kind of lost interest once network problem started happening and we started into caching. Personally, I also felt we were going too fast with the presentation giving little time to understand what is written.

nawabsonu
Автор

I am surprised to see IntelliJ idea instead of STS :-)

coolguy
Автор

Excellent video. Same on Spring boot 2 and Junit 5 will be excellent.

oibook
Автор

ANYONE: what is the starting Spring project? What dependencies? I doesn't work on my end. Probably incorrect versions/lack of dependencies on my side. Thanks

seweryn