Integration Testing ASP.NET Core 6 WebAPI Applications

preview_player
Показать описание
Building backend APIs has become even simpler with ASP.NET Core 6. But what about testing? This video teaches a simple way to create integration tests for ASP.NET Core 6 WebAPI applications.

In this video, we will test the most simplistic API that you'll ever see.

If you want to learn more about this simple style to build WebAPIs in .NET 6 called MinimalAPIs, check out the Introduction to Minimal APIs video linked in the video description.

00:00 Introduction
00:30 The WebAPI project
01:05 Creating the Test Project
01:42 Setting up the Test Project
03:16 Implementing the First Test
06:00 Implementing the Second Test
07:43 What's Next?

🔥 C#/.NET Bootcamp: The Fundamentals & more (Code FRIENDS10 for 10% OFF)*

📌 .NET Developer Roadmap

📌 YouTube Playlists:

📌 Source Code:

📌 Introduction To Minimal APIs in .NET 6:

📌Integration tests in ASP.NET Core (MSDN):

✅ SUBSCRIBE FOR MORE VIDEOS

🚀 CONNECT & SUPPORT

CREDITS

* Affiliate Link: I earn a small commission at no additional cost
Рекомендации по теме
Комментарии
Автор

Please continue this journey! We need more .NET testing content on YouTube!

SabotageAndi
Автор

In under six minutes you showed me exactly what I was looking for. Thanks

tylerpatterson
Автор

Thanks a lot for being pretty much the only tutorial also showing how to set up the project structure!

Ryan-tomq
Автор

After watching almost 10 videos on youtube, finally landed on the perfect one.
Thank you . You saved me today. Please do make more videos on .net6 c#.

preetipansy
Автор

Just what I was looking for!
It would be nice to see in action an example of factories and refreshing database in memory or with real database using TDD with this approach Integration Testing

Thanks Claudio 🙌

diegomelgar
Автор

Is it also possible to make Integration Tests for POST HttpMEthods? If yes, how would you do that?

shan
Автор

Your tutorial was very helpful to me. Thank you very much!

romeromedeiros
Автор

Hello! How can I share the context that the test project created while running with the context of the web api? If the web api creates its context from environment variable, that will be different to that the unit test project creates. (In addition, I concat a guid to the database name, so as each test class have different database name that can run asynchron.)

jaczura
Автор

Thanks for the tutorial!!!
One thing I'd like to see is how to make the web application factory use a test container instead of the one on the application

JoaoPedro-nvxs
Автор

Amazing Video, please make some more videos asap.
Love from india.
Thanks for amazing content.

SumitKumar-yqis
Автор

Hi Bernasconi, I am getting below error. Would please help me with solution

Test method threw exception:
Can't find This file is required for functional tests to run properly. There should be a copy of the file on your source project bin folder. If that is not the case, make sure that the property PreserveCompilationContext is set to true on your project file. E.g For functional tests to work they need to either run from the build output folder or the testhost.deps.json file from your application's output directory must be copied to the folder where the tests are running on. A common cause for this error is having shadow copying enabled when the tests run.

smithapatil
Автор

I do not understand what makes this integration test instead of unit test. Can you explain?
At least I learnt what is needed to test an API but I really wonder why it would qualify as integration test.

EminoMeneko
Автор

This doesn't work for me as I expect, in that all I get is "connection refused". I'm not sure if its because the server application isn't starting up, or if it is and it's on some other port than where I think it is, or what, but it's very confusing.

LordTridus
Автор

it says integration testing but it shows unit testing...i am confused

bigbosss
Автор

Hi Claudio, thanks for the great content! Could you do an example using a live database?

marquesdevelop