Spring Boot ❤️ Testcontainers by Iván López

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

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

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

    Great talk. Just started using testcontainers. Gr8 technology

  • @serrrsch
    @serrrsch 11 месяцев назад +1

    Great presentation

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

      Thank you!

  • @sampleshawn5380
    @sampleshawn5380 5 месяцев назад

    Actually problem i am facing is no test state isoloation, my pg instance contains the data inserted by some other test and when new test tries to insert that same data it is throwing exception, what to do?
    how to spin-up a new container start of each test and tear ti down after it
    OR
    how to restore pg state when all of it's tables/seqeuences just populated?
    OR
    how to sort of rollback things after test so that nothing commits to the db in the end?
    Appreciate the help in advance

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

      You can use the beforeAll / beforeEach hooks of your test runner to make this happen. I understand that marking the test container as static, in a test class (in Java) is equivalent to beforeAll

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

    Good talk, I like it. What is the theme of intellij you use?

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

      Thanks! I use one built-in "Light with Light Header"

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

    Awesome

    • @ilopmar
      @ilopmar 11 месяцев назад +1

      Thank you so much 🤩! I'm glad you liked it

  • @ART000747
    @ART000747 6 месяцев назад

    Why use RestAssured instead of WebTestClient?

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

    The end is kind of misleading. You briefly mentioned testing vs. development environment, but through the code it leaves the impression that testcontainers and docker-compose work together, which is not really the case. I think you should have wiped all testcontainers code to make it clear.
    Great talk nonetheless, this is very good stuff and insanely speeds up development testing.

  • @shakilahmed4647
    @shakilahmed4647 11 месяцев назад +2

    The only thing missing here is to run the docker containers once for all the test cases because starting/stoping the containers for all test classes is time consuming

    • @ilopmar
      @ilopmar 11 месяцев назад +4

      Right. If you make them beans and let Spring mange its lifecycle, then you only start them once. You need to make sure you cleanup everything between tests to avoid test-pollution. I didn't have enough time to show that but I'll keep in mind for the future.
      Thanks for your feedback.

    • @dant5550
      @dant5550 11 месяцев назад +2

      just do a container reuse if you dont want to raise container per test