Spring Boot Testing Mini-Series Part #3: Database Tests

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024

ความคิดเห็น • 45

  • @rajkrishna1933
    @rajkrishna1933 ปีที่แล้ว

    your videos on testing related code is amazing.frankly there are mo much actual hands on spring test on youtube.please make more such videos

  • @jesper7605
    @jesper7605 ปีที่แล้ว +3

    Great content! You cover several useful things I've never heard someone talk about before.

  • @robinmathur5807
    @robinmathur5807 3 ปีที่แล้ว +5

    Very clear explanation. After spending many hours finally found a good playlist on this topic. Great job man.

    • @codewitharho
      @codewitharho  3 ปีที่แล้ว

      Thank you, always glad when someone finds it useful!

  • @cloudsquall88
    @cloudsquall88 3 ปีที่แล้ว +3

    As always, amazing explanations! Thank you so much!

    • @codewitharho
      @codewitharho  3 ปีที่แล้ว +1

      Thanks, really means a lot that people find it useful!

  • @gallanonim4914
    @gallanonim4914 ปีที่แล้ว +1

    Arho - you provide wonderful content, great job 💪 Is there any chance to see new videos from you?

    • @codewitharho
      @codewitharho  ปีที่แล้ว +2

      Thank you! I should eventually get back to it - currently in the middle of moving places and renovations.

  • @pryflack3646
    @pryflack3646 3 ปีที่แล้ว +2

    Best presentation of Spring I've seen so far, thanks and please keep them coming!
    How would you stay with an SQL test script, and deal with deep hierarchies requiring foreign keys all the way up?
    I'd love to hear about the object mother pattern.
    PS: it's pronounced "skeema" not shama ;)

    • @codewitharho
      @codewitharho  3 ปีที่แล้ว +1

      Thanks! And also thank you for the pronunciation tip :D
      I try to avoid deep hierarchies but I understand that sometimes you need more complex data. I would look at Database Rider for more complex data setup.
      There's a little bit of information about the test data builder and object mother in the DRY vs DAMP video I made: th-cam.com/video/cD4ThqhnAp0/w-d-xo.html (although I'm considering a separate video about those patterns).

    • @pryflack3646
      @pryflack3646 3 ปีที่แล้ว

      Thanks I’ll have a look at database rider.
      I’m still a little unclear about the object mother pattern so I’ll be on the lookout then ;)
      I very much enjoy your channel, keep up the great work!

  • @FadiQua
    @FadiQua 2 ปีที่แล้ว

    Nice! Thank you for the tutorial

    • @codewitharho
      @codewitharho  2 ปีที่แล้ว

      I’m glad you found it useful.

  • @fotistsavalos2193
    @fotistsavalos2193 3 ปีที่แล้ว

    Nice series and great job!! Thank you!!

    • @codewitharho
      @codewitharho  3 ปีที่แล้ว

      Thank you and you're welcome!

  • @MrVitalirapalis
    @MrVitalirapalis 2 ปีที่แล้ว

    Good music, man :) the content as well

  • @AndrulisTravel
    @AndrulisTravel 3 ปีที่แล้ว

    Your videos are very good. Just my suggestion. Create a simple Rest API model/repository/service/controller with the basic post, put, get methods and a little bit of logic in the service layer (check if email exists, etc.). And then write tests. I understand that this will require time, but a full detailed video will have much more views from beginners.

    • @codewitharho
      @codewitharho  3 ปีที่แล้ว +1

      In my testing videos I’m currently assuming some basic knowledge about Spring. But I’ll keep in mind that there could be demand for some beginner Spring tutorials as well. Thanks for the suggestion!

    • @AndrulisTravel
      @AndrulisTravel 3 ปีที่แล้ว

      @@codewitharho Thanks for the replay. The idea was not to show how to create a Spring Boot app, but how to test it. You could use the already prepared app with 4 standard endpoints and some logic in the service layer. One entity and a repository. And show how to write all tests for this simple app :) It would cover all the basics in one video.

    • @codewitharho
      @codewitharho  3 ปีที่แล้ว +3

      Ah, I see. Actually, I have an overview video planned for the series. The reason that it is a series of smaller videos is that it takes a lot of time to make them and I wanted to see if they attract any interest. Will definitely consider a longer tutorial in the future! Thanks again for the feedback!

    • @hypnoticlizard9693
      @hypnoticlizard9693 2 ปีที่แล้ว +1

      @@codewitharho I think these videos are great but I dont think they have mainstream appeal as they are on a niche subject. You should set up some kind of donation link so you can get supported by the few people who benefit from these videos.
      As that will allow you to make great content even if the viewership isnt very high.
      I appreciate the efforts to make these videos.

  • @hendisantika
    @hendisantika 2 ปีที่แล้ว

    How do we mix testcontainers, mysql & flyway? Do You have article about that? Thanks

    • @codewitharho
      @codewitharho  2 ปีที่แล้ว

      I don’t have an article about MySQL specifically but you should be able to follow the article that uses Postgres and just replace the Postgres image with a MySQL image.

  • @MrNoxior
    @MrNoxior ปีที่แล้ว

    Why do you use an EntityManager in the tests? Isn't it better to use an injected repository?

    • @codewitharho
      @codewitharho  ปีที่แล้ว

      TestEntityManager helps you to test the full cycle of storing and retrieving the entity, e.g. flush the persistence context cache and then read the entity from the database. Otherwise the test could just end up reading from in-memory cache.

  • @ductamnguyen8257
    @ductamnguyen8257 3 ปีที่แล้ว

    Hi Arho, hope you're doing well. Do you know about Database Migration? and do you how to Unit Testing for Database Migration? Thanks in advance.

    • @codewitharho
      @codewitharho  3 ปีที่แล้ว +1

      I’m not sure what you mean. I went briefly through the migrations in the video. What kind of information are you after?

    • @ductamnguyen8257
      @ductamnguyen8257 3 ปีที่แล้ว

      @@codewitharho Thanks for your reply, yes you have gone briefly through database Migration.

  • @rajkrishna1933
    @rajkrishna1933 ปีที่แล้ว

    protobuf with rest api java is a topic which has limited resources in youtube.if you can,please add videos on this topic too..

    • @codewitharho
      @codewitharho  ปีที่แล้ว

      That’s quite a specific topic and unfortunately don’t have experience on.

  • @tko1176
    @tko1176 5 หลายเดือนก่อน

    When you remove the flush part, when does the flush occurs to make fail the test again? 14:36

    • @codewitharho
      @codewitharho  5 หลายเดือนก่อน +1

      It fails because it doesn't flush. Without specifically flushing it's up to the framework to do the flushing and we have no control of when that happens. The constraint check only happens on the database level after the flush.

    • @tko1176
      @tko1176 5 หลายเดือนก่อน

      @@codewitharho I understand. Thank you.

  • @kalyankasyapgarimella1047
    @kalyankasyapgarimella1047 2 ปีที่แล้ว

    Test Containers using private registry url images??? Can we have a video on this

    • @codewitharho
      @codewitharho  2 ปีที่แล้ว

      Thanks for the suggestion! It’s a very specific question and making these videos takes quite a lot of time, so I’d suggest asking in stackoverflow.com

  • @sohrabsheykhmohammadi1909
    @sohrabsheykhmohammadi1909 2 ปีที่แล้ว

    thank you so much

  • @rajkrishna1933
    @rajkrishna1933 ปีที่แล้ว +1

    your videos on testing related code is amazing.frankly there are mo much actual hands on spring test on youtube.please make more such videos

    • @codewitharho
      @codewitharho  ปีที่แล้ว

      Thanks, I appreciate that a lot! I have been struggling to find a good work life balance and am currently trying to arrange things so that I can focus more on this channel.