Integration testing | ASP.NET Core 5 REST API Tutorial 15

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

Hello everybody I'm Nick and today I will show you how you can get started with integration tests in ASP.NET core. We will be using the in-memory TestServer method which is provided by the use of the WebApplicationFactory class. It's a very cool method and I'd like to share it with you.

Don't forget to comment, like and subscribe :)

Social media:

#tutorial #rest #api #testing
Рекомендации по теме
Комментарии
Автор

Man you have the most useful tutorials on Youtube and your explanation is one of the best.I learned a tons from your video.Thank you very, very and very much.

Автор

A more detailed video about both integration tests and unit tests would be highly appreciated! Really nice tutorial series so far :)

michaelm
Автор

Thanks for this fantastic series!!!
I'm doing the series with .NET 5.

If the integration test failed because a 404 error could be because the test is using the real database and not the database configured in memory. You have to change this in the IntegrationTest constructor:

var appFactory = new
.WithWebHostBuilder(builder =>
{
=>
{

=> { });
});
});

I'm using the following Nugets for .NET 5:
- FluentAssertions
-
-
-

dloperab
Автор

2022 and I still learning from this series! Amazing!

PaameRafa
Автор

Great videos. Please make a full session just on writing various tests. Would be very useful. Thank you for putting this all together.

alokanat
Автор

Thank you for putting the time and effort for creating such amazing content.
Feedback:
1.Most advanced level programmers are going to love the speed at which you teach. It might be a good idea to go a little slow to attract more intermediate and novice level programmers.
2. Screen resolution and the focus on the screen can be better. There is no other way other than full sizing your content to view them.
Keep up the good work Nick!

neil
Автор

Hey Nick! I know this vid is pretty old but maybe you'll se the comment :). I was wondering how would you go about faking httpContext? Lets say the controller need to access HttpContext.User and get some info from it. Would it be possible to add httpcontext as a service or configure it to be part of a controller?

thisisboxingproductions
Автор

Hey Nick !
You are doing a real great work here.
I'm having so much fun learning those new concepts.

Thanks a lot, you are making a difference!

quentincouissinier
Автор

This is beautiful. Thanks for taking the time and effort to make such an amazing content Nick. Really appreciated.

bernardoreva
Автор

hey, I like so much your tutorials, they´re the most clean, direct and yet easy ones in the youtube

TheJessejunior
Автор

The whole video was clear and precise. Thanks for sharing this.

babakabbasi
Автор

My HttpClient was still connected with local DB. I used instead of and this fixed the problem.

laurakolcavova
Автор

I would love to have an indepth integration test video, especially with real database with docker container spin up !! THanks a lot for this video !

kuldeepadhikari
Автор

I usually use Refit to create an SDK for my API. That way I can share it, or I can use it in my other services that consume the API. But the cool think about it, is that I also test against my SDK Project (no my API project) so I force myself to update my SDK to do integration tests. I also use an Odata client to do integration test against my Odata endpoints.
Sharing just in case it helps someone.

facundo
Автор

Just checked your video, it was interesting. Will make base class for my integration tests. Other ideas I already used. Thanks.

taraspelenio
Автор

Excellent! In Integration testing, another video you can make is how to emulate model binding validation for Web Api's since the testing frameworks don't have that capability.

kwilderful
Автор

Fantastic! This was so informative and exactly what I was looking for to get caught up on Core 3 new integration testing features. I'm now subscribed and will check out more of Nick's videos.

ericwalter
Автор

So thankful for this video. This was exactly what I was looking for!

Wildxmo
Автор

Super Helpful! The explanation is clear and to the point!

FlippieCoetser
Автор

I would like to see how you integrate Single Sign On in a .NET Core application. Anyways, Perfect series of videos! ❤

jamsshhayd