Spring Boot 3 Integration Testing With TestContainers | Junit 5 | JavaTechie

Sdílet
Vložit
  • čas přidán 21. 08. 2024
  • #JavaTechie #SpringBoot #IntegrationTest #Testcontainers
    In this tutorial, we will discuss how to do Spring Boot application Integration Testing using Testcontainers , same as production environment
    👉 Simple Integration Test using MySQL DB
    👉 Problem with above approch
    👉 Solution:
    Step by Step guides to perform Integration Test using Testcontainers
    Spring boot microservice Premium course lunched with 70% off 🚀 🚀
    Hurry-up & Register today itself!
    COURSE LINK : javatechie5246...
    PROMO CODE : JAVATECHIE50
    OR use Javatechie APP
    Download the JavaTechie app on your iOS or Android device from the App Store or Google Play Store.
    Find the links below :
    Android 🌐 : play.google.co...
    IOS 🌐 : apps.apple.com...
    GitHub:
    github.com/Jav...
    Blogs:
    github.com/Jav...
    Facebook:
    / javatechie
    Join this channel to get access to perks:
    www.youtube.co...
    Techies if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
    Disclaimer/Policy:
    --------------------------------
    Note : All uploaded content in this channel is mine and its not copied from any community ,
    you are free to use source code from above mentioned GitHub account
  • Věda a technologie

Komentáře • 52

  • @vishnu15mpl
    @vishnu15mpl Před 9 měsíci +8

    “Manager will dance on top of your head” - quite funny. But on a serious note, thank you for all your work on this.

  • @sayanbiswas8847
    @sayanbiswas8847 Před rokem +8

    Solved a critical user story today in my company watching your videos on spring batch processing. Thanks a lot for your hard work :)

    • @Javatechie
      @Javatechie  Před rokem +1

      Glad to hear this 😊. Keep learning 👍

  • @senya-man9710
    @senya-man9710 Před rokem +12

    This channel is making me a better java developer everyday, kudos to you Sir.

  • @rajeevsai91
    @rajeevsai91 Před 6 měsíci +1

    I started reading the documentation, but was a little confused. So, I just opened youtube searched for 'testcontainers javatechie', learnt about the concept in an easier way. Now I can start coding. Thank you very much for all the great effort you are putting in bro! You are helping a whole community.

    • @Javatechie
      @Javatechie  Před 6 měsíci

      Thank you so much buddy . Keep learning

  • @gopisambasivarao5282
    @gopisambasivarao5282 Před rokem +3

    Appreciate your efforts, Basant. God bless you. 🙂

  • @rajivn3707
    @rajivn3707 Před rokem +3

    God bless you for making these videos you made me better at what I really wanted to do!!

  • @nikhilballari5484
    @nikhilballari5484 Před 5 měsíci +1

    This is a very commendable effort !! You are an inspiration to java developers like me, Sir. Kudos to you !!

  • @rohitmanohar2733
    @rohitmanohar2733 Před 11 měsíci +2

    Sir this video is circulating in my company as official reference for updating test traditional test case.

  • @alirezaasadi8656
    @alirezaasadi8656 Před 4 měsíci +1

    Thanks for the good content man. appreciate it

  • @hernanbiondini
    @hernanbiondini Před 9 měsíci +1

    From which SpringBoot version can I use the "test containers"? Very good channel, greetings from Argentina!

  • @2RAJ21
    @2RAJ21 Před 23 dny

    Thank you

  • @Anilkumar-reddy
    @Anilkumar-reddy Před rokem +1

    Very Helpful bro😍😍

  • @mukeshmandal3984
    @mukeshmandal3984 Před rokem +1

    Excellent work!. I am curious to know, how to check the inserted data in test containers.

    • @Javatechie
      @Javatechie  Před rokem +1

      Yes you can just inject @CourseRepository and call findAll() method and log it

  • @user-tr3zd3ui2e
    @user-tr3zd3ui2e Před rokem +1

    Thanks, it really helped.
    One query : Can we see the test data in test sql db?
    ❤❤

    • @Javatechie
      @Javatechie  Před rokem

      Yes you can just inject @CourseRepository and call findAll() method and log it

  • @deepakgowda7292
    @deepakgowda7292 Před rokem +1

    Super sir ❤

  • @TheMakeupmonika
    @TheMakeupmonika Před rokem +1

    thank you so so much Sir !

  • @0xb0110
    @0xb0110 Před 7 měsíci +2

    You don't have to start and stop the container yourself, this is already done by the @Testcontainers annotation.

  • @ainigma100
    @ainigma100 Před 5 měsíci

    Thank you for the great video!
    Can you please make a tutorial on testing a spring boot 3 application that has security enabled (Keycloak). Assuming that we do not want to disable the security while running unit tests (being able to test the controller) and integration tests (using keycloak testcontainer). The application can have @EnableMethodSecurity and we also use @PreAuthorize("hasRole('user')") above the controller methods to have more granular control. What is the proper way to test a secured Spring Boot 3 application? Maybe during the actual tests we should generate an actual token and then try to test the endpoints.
    Thank you in advance!

  • @abulsyed4851
    @abulsyed4851 Před 11 měsíci

    Great vid. Could you also make a video on functional testing with cucumber? Not many videos on this out there.

    • @Javatechie
      @Javatechie  Před 11 měsíci

      Here it is buddy i already did it a few yr back czcams.com/video/8AEQt4CSX5U/video.html

  • @saiRakshya
    @saiRakshya Před 4 měsíci +1

    Make one video about CORS configuration

  • @hariprasad2697
    @hariprasad2697 Před 6 měsíci +1

    So, this kind of testing is possible only if we're using docker in projects, incase if we're not using docker tools or any other tools in our projects, then ultimately we have to do regular integration testing only right

  • @poorpanda9033
    @poorpanda9033 Před 9 měsíci +1

    Thank you so much. Do you have a linkedin I would like to tag you

    • @Javatechie
      @Javatechie  Před 9 měsíci

      I haven't created a LinkedIn profile for my channel but yes You can find my LinkedIn with "Basant Hota"

  • @allchannel5985
    @allchannel5985 Před 10 měsíci

    Hi good job. Please we can use directly H2 database?

  • @senya-man9710
    @senya-man9710 Před 11 měsíci +1

    Is it necessary to explicitly stop the containers?

  • @__nitinkumar__
    @__nitinkumar__ Před měsícem

    Is it possible to mock atleast the 3rd party API calls.
    Let's say my service calls an external HTTP API, can I mock that, because that may not be up, and may be I don't want to pass the real credentials

  • @anshulbadwaik
    @anshulbadwaik Před 10 měsíci +1

    To run TestContainers, do we have to install Docker in our local machine ?

    • @Javatechie
      @Javatechie  Před 10 měsíci

      Yes without docker how can we run the container

  • @franckozeusmakita7022
    @franckozeusmakita7022 Před rokem +1

    Thanks for this nice Integration Testing. please can you explain me what is this method doing: private String asJsonString(Object object) {
    try {
    return new ObjectMapper().writeValueAsString(object);
    } catch (JsonProcessingException e) {
    e.printStackTrace();
    }
    return null;
    }
    I am new in Integration Testing. Thks

  • @arvindimage
    @arvindimage Před 11 měsíci

    Its awesome ...thanks much.
    When we are running tests locally...we can start docker..not an issue but when we are running in cicd..how can i setup and start docker before running tests there??

    • @abulsyed4851
      @abulsyed4851 Před 11 měsíci +1

      I has the same question in mind. But when I pushed to github. My CICD github actions was able to run the integration just like in local. The test containers config itself will setup the database in the pipeline.

    • @arvindimage
      @arvindimage Před 11 měsíci +1

      @@abulsyed4851 thanks. You mean there is no need of docker setup?? Can u plz share the code file and project of possible...will be really helpful

    • @abulsyed4851
      @abulsyed4851 Před 11 měsíci +1

      @@arvindimage yeah that's correct. I didn't have to setup anything in my GitHub actions, other than java.

  • @haiderm1384
    @haiderm1384 Před 5 měsíci

    Great tutorial. However this does not work in pipeline as we cannot run docker in docker on gitlab. How can we start testcontainer as a service in gitlab and then run the test there?

  • @CH6097-g2p
    @CH6097-g2p Před 9 měsíci +1

    we want testcontainers with webflux

    • @Javatechie
      @Javatechie  Před 9 měsíci +2

      Okay will do that

    • @CH6097-g2p
      @CH6097-g2p Před 9 měsíci +2

      @@Javatechie Thank you very much. Appreciate if you can deliver the video fast. there are not much resources about that.