Spring Boot Integration Test with TDD | JUnit5 & H2 | JavaTechie

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

Комментарии • 91

  • @furkatlapasov5346
    @furkatlapasov5346 2 года назад +5

    I guess this is one of the most demanded topic. ✅ Right in the middle. 👍

  • @Neganoff
    @Neganoff Год назад +1

    Thank you!! Very very very!!!
    This topic was so incomprehensible to me that I had problems with my first study project. After watching this tutorial for twenty minutes, I wrote my first integration test and understood how I should be done it in the future.
    Now I want to write again: THANK YOU! I am now your subscriber

    • @Javatechie
      @Javatechie  Год назад

      Thanks Michael good to know that.keep learning

  • @prabhjotsingh9597
    @prabhjotsingh9597 2 года назад +5

    Thank you for sharing your knowledge. You're a great teacher
    Please make a video on these topics
    1. Java 17 features
    2. Tips to solve memory problems (like Profiling effectively etc)

  • @yashrao7236
    @yashrao7236 2 года назад +8

    Yet again classic JavaTechie video. You will understand everything from A to Z.
    Also can you please explain us context and reflection API in java and some use case where context is useful

  • @michelchaghoury9629
    @michelchaghoury9629 2 года назад +21

    We need Spring Security JWT + Swagger UI (how to integrate them to getter getting the token, secure routes and allowing only who has valid tokens all inside Swagger Web UI) Pleaseeee

    • @ShinAkuma
      @ShinAkuma 2 года назад +2

      He already has a tutorial on JWT authentication.

  • @sidharthamishra7759
    @sidharthamishra7759 Год назад +1

    Very nice video regarding junit 5 integration testing using spring boot... thanks brother

  • @dnyaneshdake6278
    @dnyaneshdake6278 2 года назад +4

    You are amazing, Thank you so much for such great tutorials.

  • @rambeersharma2091
    @rambeersharma2091 2 года назад +2

    Very good explanations with good quality content

  • @AshishYadav-se4db
    @AshishYadav-se4db 2 года назад +4

    You are amazing, always came with amazing content thank u sir!

  • @motolola
    @motolola Год назад +1

    Over the years, my career has benefitted tremendously from this channel and a few other channels like @Telusko, in28Minutes, etc. The lesson learned is priceless and I wish to publicly acknowledge you, sir.

  • @MilsonPazienza
    @MilsonPazienza 2 года назад +2

    Was waiting for these.

  • @user-my3xl1fp8n
    @user-my3xl1fp8n 9 месяцев назад +1

    great tutorial for beginner

  • @suhailmohammad8688
    @suhailmohammad8688 2 года назад +2

    Awesome explanation!!

  • @tanujkumaragrawal4756
    @tanujkumaragrawal4756 2 года назад +2

    Awesome content,,,, your explaination is awesome sir. 😍

  • @manidixit6713
    @manidixit6713 2 года назад +4

    Pls make a detailed video on Spring Security!

    • @Javatechie
      @Javatechie  2 года назад +2

      Please refer this Spring Security Complete Tutorial with Realtime Example | Facebook Group Usecase | JavaTechie
      ruclips.net/video/5jDrBD4Y1MI/видео.html

  • @ALLINONETV1
    @ALLINONETV1 Год назад +1

    Nice explaination..

  • @PappuKumar-ho3ek
    @PappuKumar-ho3ek 2 года назад +2

    Thanks bro....very well explained 👍

  • @michelchaghoury9629
    @michelchaghoury9629 2 года назад +2

    Pleasee Keep going we need BDD, E2E Testing Please and thank you

  • @2RAJ21
    @2RAJ21 27 дней назад +1

    Thank you

  • @shahjadealam4887
    @shahjadealam4887 2 года назад +1

    You are amazing, always came with amazing content thank u 🙂

  • @elektrovert
    @elektrovert 2 года назад

    Fantastic! Saved me hours of work! 😍

  • @tanvirahmed7993
    @tanvirahmed7993 Год назад +1

    great tutorial

  • @ashishsahu1310
    @ashishsahu1310 2 года назад +2

    Superb as always!! But how to test private methods in service layers. any video on that if you have posted.

    • @Javatechie
      @Javatechie  2 года назад +2

      We need to use power mock

    • @ashishsahu1310
      @ashishsahu1310 2 года назад +1

      @@Javatechie Ok Thank you.

    • @Javatechie
      @Javatechie  2 года назад +3

      I will prepare a video of it don't worry

  • @jiyelaljaiswal7458
    @jiyelaljaiswal7458 10 месяцев назад +1

    superb man!

  • @mostviewedtoks
    @mostviewedtoks Год назад +1

    Greatful

  • @varunsiddarth1265
    @varunsiddarth1265 2 года назад +1

    Waiting for ur video..

  • @VijayKumar-tm6kw
    @VijayKumar-tm6kw 2 года назад +2

    Could you please Upload Videos on Rest Micro Services

    • @Javatechie
      @Javatechie  2 года назад +1

      Please checkout my microservice playlist

  • @simbarasheschizhande114
    @simbarasheschizhande114 2 года назад

    Thank you. You are the best.

  • @suhailmohammad8688
    @suhailmohammad8688 2 года назад +1

    Good videos

  • @pujankc6822
    @pujankc6822 2 года назад +2

    Why is TestH2Repository interface introduced instead of using the existing ProductRepository interface ?

    • @Javatechie
      @Javatechie  2 года назад

      Moral of this integration test to not touch actual database hence I created one in memory db in test cases which is TestH2Repoditory

    • @pujankc6822
      @pujankc6822 2 года назад +1

      @@Javatechie I think this is achievable using ProductRepository also, right ?

    • @josealonso7321
      @josealonso7321 Год назад

      @@pujankc6822 Yes, using the @MockMvc annotation.

  • @ivandjuric6329
    @ivandjuric6329 Год назад +1

    thank you great video, only for test method findById for more cases id is auto increment, and you don't now exactly id

    • @Javatechie
      @Javatechie  Год назад +1

      Yes exactly but you can assert that field as not null

  • @funcoding1797
    @funcoding1797 Год назад +1

    🤩🤩🤩

  • @jitendrapatil3276
    @jitendrapatil3276 Год назад

    Very good video. One small question, why you didn't you use TestRestTemplate ?

  • @aayush5474
    @aayush5474 2 года назад +1

    Great thanks

  • @AleksandarT10
    @AleksandarT10 2 года назад +2

    Why are u creating TestH2Repository? Couldnt you Autowire and use Product repository?

    • @Javatechie
      @Javatechie  2 года назад +1

      For test case we shouldn’t hit application databases we should use test database

    • @AleksandarT10
      @AleksandarT10 2 года назад +2

      @@Javatechie Since you specified the test application properties to use H2, wouldnt the started database be the H2 database anyway?
      Or maybe add h2 in pom as test dependency?

    • @Javatechie
      @Javatechie  2 года назад

      You need to add h2 dependency in Pom so that while starting test context it will start embedded h2

  • @saumitrasaxena8470
    @saumitrasaxena8470 8 месяцев назад +1

    Good videao, nice explanation.. I have a question - Suppose now I want to deploy the code in QA or PROD environment. During build it will create , H2 databse in Prod Environemnt in-memory and that will occupy space as well in prod which is not good and can lead to performance issues...Please suggest on this...

    • @Javatechie
      @Javatechie  8 месяцев назад

      That's correct but you can assure that all your functionality is working but if you will think about memory then better to use Test container

    • @saumitrasaxena8470
      @saumitrasaxena8470 8 месяцев назад

      @@Javatechie But for test container you need Docker. Without docker it wont be possible to run test containers in local and the code build will fail if one dont have docker installed. Now if we need to depoy out code in prod environment , then just for running Integration Test case in Prod environment we need to have docker and that is more space-consuming and vulnerable to security threats for a prod environment...

    • @Javatechie
      @Javatechie  8 месяцев назад +1

      @@saumitrasaxena8470 deployment world has been changed buddy I don't think there is any application go live in prod without containers.

  • @praveens2272
    @praveens2272 2 года назад +3

    Hi Basant, if I am not wrong we should call the actual repository with fake database right. In large projects we put all the SQL statements in one SQL file and will execute the integration tests with activating test profile.

    • @Javatechie
      @Javatechie  2 года назад +1

      No Praveen it's bad practice to hit actual database for your test case

    • @praveens2272
      @praveens2272 2 года назад +3

      @@Javatechie thanks for your reply Basant.. no I am not saying we should hit the actual database, we should hit the actual repository class that connects to fake database with test profile activated. This way we will test the actual behaviour of the application.

    • @Javatechie
      @Javatechie  2 года назад +2

      Ohh got it yes we can do that ☺️

  • @yassine212
    @yassine212 2 года назад +3

    Thank you! please I have a question how to use the same approach @sql in a case where we are using querydsl ?!

  • @deepakbedi7913
    @deepakbedi7913 2 года назад +2

    @javaTechie can we have videos on websocket with messaging queue . noone has done videos on websockets java with stompsessions

    • @deepakbedi7913
      @deepakbedi7913 2 года назад

      @Java Techie ruclips.net/user/JavaTechie

    • @Javatechie
      @Javatechie  2 года назад

      I uploaded one messaging app using web socket please have a look

  • @GauravKumar-qm5ro
    @GauravKumar-qm5ro 2 года назад +2

    Hi JavaTechie, Good day to you. Suppose we are making a REST API call to another service(microservice) from our service layer. My question is how to write a test case for testing external API call.

    • @Javatechie
      @Javatechie  2 года назад +1

      Same way you need to follow,from test case using rest template you need to invoke your controller endpoint

    • @GauravKumar-qm5ro
      @GauravKumar-qm5ro 2 года назад +1

      @@Javatechie Can you please make video on wiremock.

    • @Javatechie
      @Javatechie  2 года назад

      Okay i will check this

  • @trilochanp7824
    @trilochanp7824 Год назад +1

    If we are using spring security over here. Then how we will bypass that to hit controller. Not only the URL pattern. Suppose we are trying to check the security context object as well in our controller class.

    • @Javatechie
      @Javatechie  Год назад +1

      You need to mock SecurityContextHolder i will check and update proper syntax

  • @punyabikash3624
    @punyabikash3624 2 года назад +1

    Very good explanation but Quality is not good its blurry and Quality option is disabled

    • @Javatechie
      @Javatechie  2 года назад +1

      Punya it depends internet speed. It support resolution 1080 P HD

  • @ameyambulgekar3680
    @ameyambulgekar3680 Год назад

    If we are using a feign client to get data from another microservice then how to mock for integration test...?

  • @gobinatha9768
    @gobinatha9768 2 года назад

    Hadoop with Kerberos setup with multi node please create one video

  • @nooruddinraotiwala353
    @nooruddinraotiwala353 4 месяца назад

    why static void instead of normal init() method???

  • @manoffewwords5982
    @manoffewwords5982 Год назад +1

    You should never include word update and delete in the path.

    • @Javatechie
      @Javatechie  Год назад

      Yes agreed, we need to play with the http method with base URL

  • @VimalKumar-ve7pz
    @VimalKumar-ve7pz Год назад

    For H2 dB, how to define schema name using application.yml

  • @gobinatha9768
    @gobinatha9768 2 года назад +1

    How to create Kerberos authentication using spring boot ?

    • @Javatechie
      @Javatechie  2 года назад

      Never tried this will check and update you

  • @RN-jo8zt
    @RN-jo8zt 11 месяцев назад +1

    instead of h2 repository can we use properties file ?

    • @Javatechie
      @Javatechie  11 месяцев назад

      No it's not recommended at all

  • @saravanakumara5602
    @saravanakumara5602 2 года назад +1

    Bro, if we use storedProc in the Realtime, can we do same testing ?

    • @Javatechie
      @Javatechie  2 года назад

      Yes why not we can.see at the end it will just invoke your controller then the process of flow is as it is

  • @parameshwarank8784
    @parameshwarank8784 2 года назад

    Which company you(Basant) are working?

  • @harshitsachdeva4836
    @harshitsachdeva4836 2 года назад

    Do the same thing using mockito

  • @prashhanthnelakanti4992
    @prashhanthnelakanti4992 2 года назад

    Hi Basant I tried to run mvn clean install so out of 5 tests 3 are failing. Can you please help us on this.

    • @ALLINONETV1
      @ALLINONETV1 Год назад

      I guess reason is in first test case one record will get insert and it never be deleted in code

  • @gopald7263
    @gopald7263 2 года назад

    1st comment

  • @SupriyaMondal3
    @SupriyaMondal3 2 года назад +1

    Thank you