The Best Way to Run Integration Tests in Your CI/CD Pipeline

preview_player
Показать описание

Integration testing is a testing approach that tests the integration between multiple components. Usually, this will involve a database to test your query logic. Docker is an excellent tool for creating throwaway databases for your integration tests. And you can make it even better with the Testconatiners library. It allows you to programmatically create your docker containers for integration testing. In this video, I'll show you how to use GitHub Actions to run your tests in a CI pipeline.

Testcontainers - Integration Testing Using Docker In .NET

How To Build a CI/CD Pipeline With GitHub Actions And .NET:

Join my weekly .NET newsletter:

Read my Blog here:

Chapters
0:00 Preparing the test boilerplate
3:53 Adding some test cases
8:33 GitHub Actions workflow setup
9:46 Running tests in CI pipeline using GitHub Actions
13:04 Testcontainers alternative: Docker Compose
Рекомендации по теме
Комментарии
Автор

Hi Milan,
I want to thank you, by following your videos and learning the concepts you mention from multiple resources, I found a job that I couldn't even imagine.
Your pragmatic clean architecture course was the best investment I've ever made in myself 🌻

cansozbir
Автор

Explaining every steps is very helpful, Learnt new things like what is the meaning of --- no restore .

pragmatic-pr
Автор

Really great topic to simplify testing. I prefer these general .NET coding videos that you produce, rather than the Clean Architecture rehash videos.

pedrosilva
Автор

Great video that covers a lot of topics. I suggest breaking this video into smaller digestible pieces. Insert more background information for people who are not very familiar with the topic. Thank you for the good job.

vibisoft
Автор

I love Your work ❤. I thinking about test i docker, and you make it😅

Yigrashill
Автор

I'm not sure if i like the fact that an Integration test is using a docker container for the DB. I'm fine with Functional test using it, but the idea of an Integration test is to test the integration between layers and data in an isolated way. In this case if the connection with the DB in docker fails for some reason, your test is going to fail and not because the scenario you are testing, which defeats the purpose of integration tests.
For integration test i would use InMemoryDB instead.
But those are my two cents. Cheers!!

charlyeco
Автор

Hi Milan,
Thanks for sharing this content. I feel your videos have been helping me understand the .NET ecosystem more and more as time goes by making me a better developer. I wanted to ask how we can implement test containers to write integration tests for a Proxy API, meaning that the API doesn't interact with a Database but rather relies on receiving data from multiple downstream service (like other API's). Thanks in advance!

seyurlutchminarain
Автор

You mention functional tests. I assume that's the api tests that call the endpoints in your github actions.
Could you do a video on this but include barriers such as if your endpoints require authentication.
Great video and thanks

uu
Автор

what is the best way to test data insertion into a azure table storage ?

rezarezash
Автор

Hey Milan, i really appreciate your videos. I learn a lot from them and i am always looking forward to your new videos. I have a question regarding your clean architecture course. I have seen that they are offered for half price off at the moment on your website, however when i try to order them the price is back to full. Can you help me with that? I would like to purchase your course.

MariMari-bhxh
Автор

Hey Milan,
Question for you, if all your integration tests share the same in-memory database, won't they inadvertently affect each other? I think I understand unit testing pretty well, so I'm thinking of the concept where tests are independent of each other. Wouldn't a shared in-memory database break this?

For instance, if I run integration tests that ADD a user, followed by another integration test that UPDATES a user, followed by another integration test that DELETES a user, then everything works great. But, what if the unit tests now run in the order of DELETE, ADD, UPDATE, or ADD, DELETE, UPDATE?

kjw