We usually abstract away the third party packages with our own custom interfaces and structs. It's a best practice so that we can easily switch implementations and packages for example. In my opinion, it's something that should be avoided entirely. Do you have a specific use case for that?
@@aminmir1917 sort of. Coming over from Python to Go im just trying to wrapped my head around the best way to do mocks in go. Testing in general really as it quick different approach from Python
@@aminmir1917 as for the particulars I'm just looking at how to do mocking properly in go specially with things like gomock hans how I stumbled across your videos :)
I see. Throughout the series I will focus specially on Testing/Mocking as these are topics I personally care about. Only thing is that I can't publish as frequent as I also have a full time job. Otherwise will try to do my best to talk about how I think testing should be done in Go in general.
I'm working at a new place and no one here sees the need for test suites. Can you elaborate about their ideal use cases? The lifecycle functions are still supported by testify, so I guess I can't see a reason why you absolutely need to use a test suite.
IMO test suites are very useful when you need a lot of setup for your tests. Let's say you have a struct with a lot of fields most of which are interfaces and you would want to mock them out in your unit tests. In those situations, suites help avoid those repetitive mocking and setup steps. With suites, you will never forget the setup and cleanup steps as you just define them once as part of the suite. But it doesn't mean that you can't achieve the same thing with just the vanilla go testing package. At the end of the day, it's a matter of preference.
Thanks for showing the step-by-step for using mockgen :)
Great video, please make more videos on gomock
That was really useful. Could you make more videos about work with testtify and gomock
Of course, in future parts I will continue working with these libraries.
You should consider using an IDE bro...
It would be really useful to see an example of generating mocks for 3th party package not just for packages in the project one is working on.
We usually abstract away the third party packages with our own custom interfaces and structs. It's a best practice so that we can easily switch implementations and packages for example. In my opinion, it's something that should be avoided entirely. Do you have a specific use case for that?
@@aminmir1917 sort of. Coming over from Python to Go im just trying to wrapped my head around the best way to do mocks in go. Testing in general really as it quick different approach from Python
@@aminmir1917 as for the particulars I'm just looking at how to do mocking properly in go specially with things like gomock hans how I stumbled across your videos :)
I see. Throughout the series I will focus specially on Testing/Mocking as these are topics I personally care about. Only thing is that I can't publish as frequent as I also have a full time job. Otherwise will try to do my best to talk about how I think testing should be done in Go in general.
@@aminmir1917 i have one dependency like that for mocking AWS dynamo db functions
I'm working at a new place and no one here sees the need for test suites. Can you elaborate about their ideal use cases? The lifecycle functions are still supported by testify, so I guess I can't see a reason why you absolutely need to use a test suite.
IMO test suites are very useful when you need a lot of setup for your tests. Let's say you have a struct with a lot of fields most of which are interfaces and you would want to mock them out in your unit tests. In those situations, suites help avoid those repetitive mocking and setup steps. With suites, you will never forget the setup and cleanup steps as you just define them once as part of the suite. But it doesn't mean that you can't achieve the same thing with just the vanilla go testing package. At the end of the day, it's a matter of preference.
makes sense to me, thank you!! @@aminmir1917
Great video !
running "mockgen": exec: "mockgen": executable file not found in $PATH
Really helpful, thanks!
How do you only have 11 subscribers?
Ah well I've started very recently and only published a few videos. That's probably why... :)
Nice tutorial