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

  Рет қаралды 131,076

SpringDeveloper

SpringDeveloper

Күн бұрын

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

Пікірлер: 89
@manuelcarbajal7610
@manuelcarbajal7610 4 жыл бұрын
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
@Skiamakhos
@Skiamakhos 6 жыл бұрын
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.
@RamMohan222
@RamMohan222 6 жыл бұрын
Grate demo and good explanation about various layers of testing, special with mockito.
@punitdhiman
@punitdhiman 6 жыл бұрын
watched for first 20 minutes...its good and fruitful...Thanks!!!
@karthikperumalla7236
@karthikperumalla7236 4 жыл бұрын
Awesome presentation. Thanks a lot for sharing with us.
@richardlanglois5183
@richardlanglois5183 6 жыл бұрын
Great talk Sannidhi and Madhura, TDD is the way to go!
@venuvemula2127
@venuvemula2127 5 жыл бұрын
Loved the lived coding and enjoyed it but eventually the issue spoiled the fun. Well done gals
@vanitapatel6109
@vanitapatel6109 3 жыл бұрын
Great job girls, it was to the point and helpful..
@Ani2012Engneer
@Ani2012Engneer 4 жыл бұрын
grate explanation, it's really helpful
@nirmalpune
@nirmalpune 3 жыл бұрын
Very helpful....nicely explained!
@sagarrout007
@sagarrout007 6 жыл бұрын
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
@gerdsfargen6687
@gerdsfargen6687 Жыл бұрын
So good! Comprehensive and all
@oibook
@oibook 4 жыл бұрын
Excellent video. Same on Spring boot 2 and Junit 5 will be excellent.
@mymislife
@mymislife 5 жыл бұрын
This speech is amazing. Good job!
@LorenzoBettini
@LorenzoBettini 6 жыл бұрын
I enjoyed it a lot. But from what I recall, Sonarqube considers a critical issue having private methods in the controllers...
@zoladkow
@zoladkow 3 жыл бұрын
Loved it!
@tetsuya8736
@tetsuya8736 5 жыл бұрын
This is super.
@ariel_alves_dutra
@ariel_alves_dutra 4 жыл бұрын
Amazing presentation!
@uvsoftgroup4509
@uvsoftgroup4509 6 жыл бұрын
very good overview for the different levels of testing in a spring boot application
@nawabsonu
@nawabsonu 5 жыл бұрын
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.
@jesse2006
@jesse2006 4 жыл бұрын
please update to talk about using Jupiter jUnit 5 as the annotations and process is different
@pablohernandez4305
@pablohernandez4305 2 жыл бұрын
thanks for this video
@coolguy3316
@coolguy3316 4 жыл бұрын
I am surprised to see IntelliJ idea instead of STS :-)
@AhmetMurati
@AhmetMurati 4 жыл бұрын
Spring Tools Suite has some bugs especially when it comes to compiling, running the project
@BharCode09
@BharCode09 4 жыл бұрын
IntelliJ is IntelliJ! Also the more we are addicted to that, dumber we become, bcz it's so IntelliJent!
@leszeknagooglach
@leszeknagooglach 6 жыл бұрын
@DataJpaTest is itself is annotated with @AutoConfigureCache with @PropertyMapping("spring.cache.type") CacheType cacheProvider() default CacheType.NONE; So, is there really caching when using repository.save(entity) in a test?
@CharlesRay87
@CharlesRay87 6 жыл бұрын
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 :)
@kevinjom1117
@kevinjom1117 5 жыл бұрын
The driven design part and refactoring part are missing in this video though
@omkarmanjrekar6645
@omkarmanjrekar6645 3 жыл бұрын
This is really nice starting point for someone learning testing with Spring. Is there a github repository for the code shown in the video?
@darkenergy7121
@darkenergy7121 3 жыл бұрын
It was given on the last slide. Busted. You didnt watch the entire presentation..😂🤣😅
@VLADICA94KG
@VLADICA94KG 4 жыл бұрын
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
@Skiamakhos
@Skiamakhos 6 жыл бұрын
Hey does anyone know if there's an equivalent presentation for doing TDD in Spring MVC *without* Boot? Boot seems to be the buzzword of the day but a lot of us work on SpringMVC projects that didn't get Boot for whatever reason. How do we do all this "old school"?
@BrunoOliveiradotcom
@BrunoOliveiradotcom 6 жыл бұрын
Well done Gals you rock
@azatakhunov6061
@azatakhunov6061 2 жыл бұрын
good video
@radhakrishnayadav3370
@radhakrishnayadav3370 3 жыл бұрын
If you upload it to GIT, Can you share GIT link?
@juansalto8367
@juansalto8367 2 жыл бұрын
the best is that voice saying "trying" 25:56
@meowmeow70
@meowmeow70 6 жыл бұрын
are you guys abandoning spring tool suites? all the demo seems to be done with intellij... I thought you have your own ide..
@saurabhmishra8151
@saurabhmishra8151 3 жыл бұрын
If anyone's completed this tutorial, could you provide a link to the pom.xml file?
@mohammedershadulhaq9865
@mohammedershadulhaq9865 Жыл бұрын
This is not working in latest spring boot pls update the video
@tharindawicky
@tharindawicky 3 жыл бұрын
They are working on "Maven Project > Offline Mode = true", that's why the dependency did not download from maven central.
@nickdan007
@nickdan007 3 жыл бұрын
Thanks, I’m gonna check it, cause I had the same issue and I have to close the project and open the pom as a maven project so the dependencies load again in IntelliJ workspace .idea
@hazerend1402
@hazerend1402 4 жыл бұрын
Sometimes intellij is having that problem,missing dependency, you just have to invalidate cache and restart intellij
@seweryn3001
@seweryn3001 2 жыл бұрын
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
@kanaillaurent526
@kanaillaurent526 5 жыл бұрын
I'm lost with Spring. Why? Because Before we used to init mockMvc with "MockMvcBuilders.webAppContextSetup(this.wac).build()"; wac being "ApplicationContext wac= WebApplicationContextUtils.getRequiredWebApplicationContext(servletConfig.getServletContext());" In general there are too many ways to do the same thing and it always change. Am I wrong ?. And because I have the habit to keep all code that worked for me somewhere, I never know if my knowledge database is already obsolete. : -( Not even know if that demo works nowadays in 2019 and if it's the best practice. What should I do?
@ismailyavuz
@ismailyavuz Жыл бұрын
Read again from the official documentation for every release.. I think it's not only spring but software engineering...
@kanaillaurent526
@kanaillaurent526 Жыл бұрын
@@ismailyavuz thanks. Yes. Again... And again, and again, and again
@AntropomorficznaPersonifikacja
@AntropomorficznaPersonifikacja 5 жыл бұрын
It's really hard to watch when you cannot see whole line of code. Why this font is so huge (or screen so small)?
@softwaredevnk166
@softwaredevnk166 2 жыл бұрын
Good start, but later ahead the code did not work for me There was too much of confusion later after which I got off the track Could have done better
@gauravdighe4117
@gauravdighe4117 6 жыл бұрын
Do you have source code?
@RenannPrado
@RenannPrado 6 жыл бұрын
Gaurav Dighe 59:00 they give the link, I haven't tried to access though
@trozzonick77
@trozzonick77 4 жыл бұрын
I m kind of disappointed that in such TDD presentation you do not start withe the use case scenario. Tha is teh one that define your domain and SUT.
@ThePakChina
@ThePakChina 4 жыл бұрын
can u give us git link?
@prakashg1944
@prakashg1944 4 жыл бұрын
github.com/mbhave/tdd-with-spring-boot
@ahnmikey
@ahnmikey 5 жыл бұрын
20:38 I do not see the 'st' command in my intellij. Anyone who can explain how?
@maciejreszke870
@maciejreszke870 5 жыл бұрын
it's just custom binding
@alexispavlidis2728
@alexispavlidis2728 5 жыл бұрын
It's a live tempalte. Google intelij live tempales, you can build your own alias for tempales
@lolxd3248
@lolxd3248 5 жыл бұрын
24:30 Exception Driven Development.
@lolxd3248
@lolxd3248 5 жыл бұрын
@@AntropomorficznaPersonifikacja "kobiety do kodu"
@soyphea8697
@soyphea8697 5 жыл бұрын
I would prefer testing the service. We should use @TestConfiguration to create the bean service instead of use MockitoJunitRunner.
@RenannPrado
@RenannPrado 6 жыл бұрын
Excelent talk, too bad that internet was a problem
@cpsarathe
@cpsarathe 4 жыл бұрын
Do you really need database for Unit Test ?
@Rohit-ns5tt
@Rohit-ns5tt 4 жыл бұрын
Marathi Mulgi.👍
@chmaheshkrishna
@chmaheshkrishna 5 жыл бұрын
Nice video, however, CrudRepository issue is about incorrect library but not the internet.
@dmitrypotenko4950
@dmitrypotenko4950 5 жыл бұрын
The library was perfectly correct. The offline mode just didn't work for some reason. They should have tried resolve dependencies in the console by the command mvn dependency:resolve and see in the console what went wrong. This is the best what they could do.
@dougllassousa9659
@dougllassousa9659 4 жыл бұрын
@@dmitrypotenko4950 the dependecy is incorrect, the correct starter is spring-boot-starter-data, not ... stater-data-jpa
@dmitrypotenko4950
@dmitrypotenko4950 4 жыл бұрын
@@dougllassousa9659 mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
@dougllassousa9659
@dougllassousa9659 4 жыл бұрын
@@dmitrypotenko4950 Oh! that's right! My mistake
@premierde
@premierde 5 жыл бұрын
Please show how yo test security stuff.
@paulfrischknecht3999
@paulfrischknecht3999 4 жыл бұрын
/cars/{name} was too generic for the tests they had. only prius was needed...
@IvanVilanculo92
@IvanVilanculo92 3 жыл бұрын
I'm facing a problem where the WebMvcTest tries to instantiate every controller within the app and I have to mock all dependencies of every controller on every WebMvcTest 😔 Can someone help me? Here is the stack overflow link stackoverflow.com/questions/64724771/webmvctest-attempts-to-load-every-application-controller
@vasiliydorofeev1355
@vasiliydorofeev1355 5 жыл бұрын
Plz attaché source code
@user-us3cx7ut4l
@user-us3cx7ut4l 5 жыл бұрын
The git repos are mentioned at the end of the presentation: github.com/mbhave/tdd-with-spring-boot - github.com/sannidhi/tdd-boot-demo
@user-oq1sm7jr8n
@user-oq1sm7jr8n 5 жыл бұрын
too many test annotations ... ...
@guilhermeribeiro4344
@guilhermeribeiro4344 6 жыл бұрын
I didn't see any of TDD on this video. I only have seen Spring test framework explained.
@AntropomorficznaPersonifikacja
@AntropomorficznaPersonifikacja 5 жыл бұрын
women... and all is clear.
@acertoumisera1208
@acertoumisera1208 2 жыл бұрын
Put the git in the comments please.
@mohammedershadulhaq9865
@mohammedershadulhaq9865 6 жыл бұрын
Great presentation. Please do the speak aging with live coding. And please without any library problem. Full and Clean please.
@mmddyyyy-his
@mmddyyyy-his 5 жыл бұрын
why not restarting the IDE, close/reopen project, maven clean, or searching google
@dmitrypotenko4950
@dmitrypotenko4950 5 жыл бұрын
Search in google, not knowing the reason of the issue and without the internet, is not the best idea, you know. All other pieces of advice as (mvn clean, close and open) would have hardly helped them as it has nothing to do with reason why maven could not find library in the local repo.
@shaofeiliu9404
@shaofeiliu9404 6 жыл бұрын
nick talk, expand my view
@BurhanCerit
@BurhanCerit 3 жыл бұрын
i want to watch this video but i cannot understand the words its indian accent engilish, i just cannot :S
@blighthornsteelmace820
@blighthornsteelmace820 Жыл бұрын
turn on subtitles
@ekadet7882
@ekadet7882 4 жыл бұрын
'RED' is a universal color for danger. 'Restarting an APP' when it misbehaves is the universal solution to fix it. Not trying to even consider doing so is unprofessional. When the presenters were out of their home preparation - they sucked miserably.
@aliakbarpour6926
@aliakbarpour6926 6 жыл бұрын
Good tutorial but not acceptable as successful live coding tutorial because of internet connection scandal or sth in your dependency caching
@andy12829
@andy12829 3 жыл бұрын
Brahmins Always Lead .. Proud to be A Brahmin ❤️. Our Samaj is Proud of you Madhura🙏🎉🎉
@avinashkharche8186
@avinashkharche8186 3 жыл бұрын
wtf
@jasper5016
@jasper5016 3 жыл бұрын
2 people trying to explain but none of them can explain it properly. Very poor presentation.
Bootiful Testing
1:18:16
SpringDeveloper
Рет қаралды 28 М.
Testing with JUnit 5 and Spring
50:37
SpringDeveloper
Рет қаралды 15 М.
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
Luck Decides My Future Again 🍀🍀🍀 #katebrush #shorts
00:19
Kate Brush
Рет қаралды 8 МЛН
From Zero to Hero with Spring Boot - Brian Clozel
1:09:19
SpringDeveloper
Рет қаралды 177 М.
What's New in Spring Boot 2.0 - Phillip Webb, Madhura Bhave
1:04:00
SpringDeveloper
Рет қаралды 26 М.
Testing Spring Boot Applications - Phil Webb
1:01:31
SpringDeveloper
Рет қаралды 34 М.
How to Get Productive with Spring Boot
1:03:56
SpringDeveloper
Рет қаралды 18 М.
Scaling Spring Boot Applications in Real-Time
1:05:51
SpringDeveloper
Рет қаралды 22 М.
10 Ways to Get Super Productive with Spring Boot
56:56
SpringDeveloper
Рет қаралды 39 М.
JUnit 5 - New Opportunities for Testing on the JVM - Sam Brannen
1:05:36
Spring Tips: Bootiful Testing
38:15
SpringDeveloper
Рет қаралды 22 М.
Kubernetes for the Spring Developer - Meaghan Kjelland
20:43
SpringDeveloper
Рет қаралды 25 М.
Main filter..
0:15
CikoYt
Рет қаралды 14 МЛН
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 4,9 МЛН
Что не так с яблоком Apple? #apple #macbook
0:38
Не шарю!
Рет қаралды 429 М.
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
ЗЕ МАККЕРС
Рет қаралды 160 М.