Testing with golang and testify - mocking - tutorial part 3

preview_player
Показать описание
This is the last part of my testify tutorial series. In this video I am going to explain how to create and use mocks. I am also reusing what we learned in part one and two and show you how to use mocks with a real world example. I am also showing some best practices and teach you to become a fully fledged testing master.

github repo:

Links:

Playlist:

❤️ SUPPORT MY CHANNEL ❤️
--------------------------------------------------
A little support goes a long way!

📖 5 Books to skyrocket your career 📖
----------------------------------------------------

🎒 THE GEAR I USE 🎒
--------------------------------------------------

💻 Technical Gear

🎒 Digital Nomad Essential Gear

📷 YouTube Gear

👋 SOCIAL MEDIA 👋
----------------------------------------------------

@the_langhorst - INSTAGRAM
@the_langhorst - TWITTER
@the_langhorst - TIKTOK

🎶 MUSIC I USED 🎶
----------------------------------------------------

Karl Casey @ White Bat Audio

Song: Erlando - Questions (Vlog No Copyright Music)
Music provided by Vlog No Copyright Music.

‼️ Disclaimers

The links mentioned in this description may contain affiliate links. I may receive a commission for any purchases made through these links, but there won't be any extra cost for you. I am grateful for your support, as it enables me to keep providing you with valuable content for free.

#programming #coding #golang
Рекомендации по теме
Комментарии
Автор

It is the BEST video about this topic which I've watched! I've spent last two days improving my golang test skills and your video helps me better then other.

vladf
Автор

Go testify Go!

Thank you so much for this tutorial!
It's very well explained and informative. Coming from a different tech stack, this helped me a lot to understand how I can implement a well tested codebase.
All the best to you!

OiEuSouOThor_H
Автор

I loved your explanation! specially when you presented the Mocekry! I Laughed how funny you suggested it! Thank you!

mauricionepomuceno
Автор

Came from Arc not logged in browser here to say, Nice Work ~ Loved it.

shobhittewari
Автор

Go testify go! Thank you for valuable lessons! :)

kyryloantoshyn
Автор

Very informative and straight to the point 👍🏻 thank you

JohnDoe-jizv
Автор

What if you want to write testcase for List and Latest functions ? How can that be done ? Mocking the entire the List and Latest functions will not give more code coverage. Is in't it ?

dharavathsuresh
Автор

I'm a bit lost between the Original struct/interface implementation and the mock one because in a normal case we don't send the reference of the object if we use the provider manually, but with the mock one, we need to send the reference (&priceProvide). Why?

VincentSCHOENER
Автор

Hey great video,

Why do you use priceProviderMock := mocks.PriceProvider{} instead of for example priceProviderMock := mocks.NewPriceProvider(t) or priceProviderMock := new(mocks.PriceProvider)

OneManArmy_XD
Автор

thanks, it helps a lot, you've covered many areas. as for mock struct, You've explained how to test a service that calls DB repository (GET), but, I still don't know how to test a service that calls DB repository for PUT/POST (have no return value). Would you give me some references I could look up for now (and may be you could create part4). Thank you.

ultiumlabs
Автор

Awesome! Could you make another video explaining the controller-service-repository architecture in more detail?

zaphkiel_
Автор

Ok, testify is indeed cool. I now can 1:1 map between Junit and Testify

swagatochatterjee
Автор

This video promises that I will be a master in testing... let's see

Golandia
Автор

that tutor on next up, thanks for tough staff💪

MaximRovinsky
visit shbcf.ru