Unit Tests and Test Doubles like Mocks, Stubs & Fakes
Вставка
- Опубліковано 9 чер 2024
- 👉 Rebranding - An Insightful Techie
👉 We can't touch, smell or feel the software to ascertain its quality. We have to rely on Tests and Unit Tests plays the biggest role in the overall quality of the software
👆 This video contains easy to understand description about the Unit Tests and Test Doubles like Mocks, Stubs & Fakes.
👉 This video also explains how we MUST write Unit Tests and What all things we should know to write the effective unit test cases
Feel free to check out and follow CodesBay @
👉 UA-cam: / codesbay
👉 Twitter: / codesbay
👉 Facebook: / codesbay
👉 Instagram: / codesbay
👉 Github: github.com/CodesBay
👉 Pinterest: / codesbay
👉Tumblr: / codesbay
👉 Web: www.CodesBay.com
Follow me on
👉 Linkedin: / dakshhub
👉 Twitter: / dakshhub
👉 Instagram: / dakshhub
#unittest #unittesting #quality #softwarequality #python #java #cplusplus #javascript #scala #js #dotnet #webapp #mobileapps
Absolutely the best informative, concise, and well structure video on Unit Tests that I have found in UA-cam. I will recommend this video to ensure that everyone has a foundational understanding of Units tests why, what, and how !
Thanks you so much for your appreciation and kind words..thanks again 🙏🙏🙏
2021: One of the best explanations about Unit Tests. Just Subbed!
Thanks a lot for watching my video and thanks for your comment 🙏🙏🙏
You're an absolute master at teaching. I thoroughly enjoyed this. Your explanations are very clear and easy to understand. Thank you so very much for doing this.
Thank you so much for your kind words 🙏
10:50 mock
13:36 stub
Thanks for this but to understand it properly you need to see the complete video 😀
Very helpful and well-spoken. Exactly what I was looking for. Thank you!
Thanks for your comment....if you like my contents.. may I please request you to share the same with friends and family ..Thanks 🙏🙏🙏
Extremely helpful, Thanks 🙏🙏🙏.
Would love to see a practical series on this as well.
Thanks a lot 👍🙏🙏🙏
Thank you so much! So much confusion has been out there about mock vs. stub, and you clarify them beautifully...!
Thanks for your comment 🙏🙏🙏
Great video! Really clearly explained with enough examples to get the point accross. Thanks :)
Thanks for your comment
Thank you for making this video. It was so helpful and clear!
Thanks a lot for your comment
This is definitely the best video for unit test. Thank you!
Thanks a lot for your comment 🙏
after a very long time I have seen such a video . Hats off.
Thank you so much for your comment 🙏
Thank you for detailed explanation !!
Such a well structured video, especially for someone new to the concept! Thank you :)
Thank you so much for your comment 🙏
This was very helpful thank you!! this cleared up serveral questions and misunderstandings I've had... THANK YOU!!
Thank you so much for your comment
Best video I found about unit test. Thank you.
Thanks a lot for your kind words 🙏🙏🙏
Very well structured, informative, very talented teacher. Thank you!
Thank you so much for your comment 🙏
Explained perfectly. Thanks a lot!
Thanks a lot for your comment 🙏🙏🙏
Thank you for easy explainations!
Thanks for your comment 🙏
By far, best introductory explanation 🔥
Thank you so much for your Comment 🙏
very nicely explained in simplest way. Thanks for this video.
Thanks for your comment 🙏🙏🙏
crisp and clear! Great job
Thanks for your comment 🙏🙏🙏
Good explanations, thank you!
Thanks for your comment
Wow.... Perfect slides...
Perfect explanation...
Thanks for sharing your knowledge...
Thanks a lot for your kind words 🙏🙏🙏
It's a really good video with right explanations and arguments. Congrats!
Thanks for your comment 🙏🙏🙏
A gem for beginners!! Thanks
Thanks for your comment 🙏🙏🙏
Thank you so much for this lecture sir.
Thanks for your comment 👍
Superb delivery. Absolutely amazing teaching.
Thanks for your kind words 🙏
Thank you for concise explanation.
Thanks a lot for your comment 🙏🙏
Sir this was great. Thank you for this
Thanks a lot for your comment 👍🙏
Thank you! This was brilliant!
Thanks for your comment 🙏
Just a quick question about the assertion at 8:00 - would it be better not trying to replicate a function's behaviour in the test, as that can make it fragile to changes in the function? Would it be better to instead assert with the function's output and a known correct value?
So in the example above, it would be ASSERT_EQ (result, 300);
I clicked on the video link, saw your face and immediately hit the like button. I know already this video is going to be a good learning session.
Thanks a lot for your kind words 🙏🙏🙏
Thank you for the really informative video!
Thanks a lot for your comment 🙏🙏🙏
Thank you very much sir for this clear explanation, you have helped me understand unit testing - now can easily translate to my language of choice...
Thank you so much for your kind comment 🙏
Great tutorial, thank you very much!
Thanks a lot for your comment 🙏🙏🙏
thank you so much. very intuitive
Thanks for your comment 🙏
thanks for this video, I learned a lot!
Great to know.. Thanks a lot for your comment 🙏
This was a fantastic intro to Unit Testing.
Thanks for your comment 🙏🙏🙏
Alhamdulillah
Thank you Sir, your lecture is awesome! Please take my respect!
Thank you so much for your comment 🙏
Amazing explanation. I wish you were my teacher at the university.
Thanks a lot for your kind appreciation 🙏🙏🙏
Wonderful teacher!
Thanks a lot for writing this comment 🙏🙏🙏
great video! really awesome explanations :)
Thanks for your comment 🙏🙏🙏
love your videos.
Thanks a lot for your kind words 🙏🙏
excellent explanations, very didactic, congrats 🙂
Thank you so much for your comment 🙏
Thank you, India.
Thank you so much for your comment 🙏🙏🙏
@@Cognitive-Programmer no problem, i love you.
Great explanation!!!
Thanks for your comment 🙏🙏🙏
I would like to see your definition for spies as well!! Very good video!!
Hello
Thanks for your comment and valuable suggestion..
I initially thought about it but discarded the idea as it would be too much
Will definitely talk about it in some video
Thanks again
Nice & Simple explanation !!!
Thanks for your comment 🙏🙏🙏
amazing video, understood the difference between. mocks,stubs and fakes very well
Thank you so much for your comment 🙏
Thank you so much for your comment 🙏
Thank you so much for your comment 🙏
Thank you very much for this very interesting video!
I learned (finally) the purpose, and the different strategies to test
All you explained here is valid for any programming language?
In Python you have videos who explains the included system, but what are the different programs you can use with Cobol, JavaScript, Php, Sinatra, etc?
Thank you!
Thanks for your comment… whatever I talked about in this video is applicable for all programming languages and pretty much all unit test frameworks support this
Thank you!
Thanks for your comment 🙏🙏🙏
Just amazing!
Thanks for your comment 🙏
thanks very much !
Thanks for your comment 🙏🙏🙏
Thank you.
Thanks for your comment 🙏
Thanks Sir, good explanation :)
Thanks for your comment 🙏🙏🙏
9:34 - I am watching this when two days back, a major facebook/whatsapp/instagram outage happened. Lol
Great video!
Thank you so much for your comment 🙏🙏
Came by pure randomness, but it's a really good video, good job!
Thanks for stopping by and thanks a lot for your comment 🙏🙏🙏
Hey,great video 🙏
Thanks for your comment 🙏
Thx my man :)
Thanks for your comment 🙏
Hello Sir, My pranam to you. Really learning a lot from you. So clear, concise and upto the point. Can you make a tutorial on Docker as per your style - short, clear, concise and upto the point.
Hello
Thank you for your kind words. I had plan for docker too.. but will certainly expedite the same. You'll hear from me soon.
Thanks again for your comment 🙏🙏🙏
Hi Sir, Is it possible use gmock to test functions which is written in c?
For AAA, you can also use GWT which is commonly used. GWT stands for "Given", "When", "Then".
Example:
Given a first value 100;
Given a second value 200;
When we sum the two;
Then the result should be 300;
Extra useful notes:
Often you can write GWT comments above to clarify which parts do what.
If you write the GWT comments in co-pilot and ask for tests, it will likely write the tests for you and possibly even have an easier time writing the implementation too.
You can use things based on your choice, but Given, when, then is mostly used for depicting the business scenarios and not the unit test case. Hope it helps, thanks 🙏
Thank you for making this video. It is very helpful for beginners. Please make a video for Unit Testing C code Using Google Test. If possible make a video if cross compiler is used.
What cross-compiler are you intend to use?
@@SimonYells ARM Cortex A9
great Job Sir
Thanks a lot 🙏
Sir If I want to test a function which uses a runtime object which cannot be initialised in any way but it’s object can only be filled when application is running like from a window in a windows app. How can I simulate that behavior
I am trying with mock but it gives null references exception as it can only be generated when application runs
very impressive didactics
Thanks for your comment
good one
Thanks for your comment 🙏🙏🙏
Too good sir
Thank you so much 🙏
Unit tests are written for finding bugs is a wrong statement.
Their main benefits are catching regressions (when many people work on the same code base and someone breaks someone's else's code). Other benefits include, it serves as documentation and it also forces you to write loosely coupled modularized code, without which unit testing would be hard.
Thanks for sharing your thoughts 🙏🙏🙏
3:19 weather or whether ? I think this video never went for unit testing before its upload but the content it's says is pretty much good !
Hello noted the mistake after upload. Sorry about that 🙏🙏🙏
The hardest part of introducing unit tests into an existing code is the changes required to be able to separate the units you decide on from external dependencies.
Hi
Thanks for your comment.. , Yes but it's mostly depends upon how the code is written
Crystal clear
Thanks a lot for your comment
What is your view on Google Mock? I feel after using it for a while that it is written to cover both mocking and stubbing. At least, that's how it has been used everywhere I've seen.
Hello
Thanks for your comment..yes you can do create stubs with google mock..
Is it correct to say that "fakes" introduces a certain degree of impurity into unit testing?
Hello
Thanks for your comment... Some engineers do have adverse view on fakes...because its almost near to real implementation... So that can be termed as so called impurity...but I don't subscribe to this opinion
SOS EL UNO PAPÁ
Theory Explanation is really good. But some code samples for mock, stub and fake could have completed it properly.
Thanks for your comment.. noted
Autostub means?
I am trying to learn terms correctly related to fake,stub,mock, spy. Can you mention book references. Discussion of BDD, TDD are far too much and code samples are little or missing.
Hello can you help me with unit test . Example with solution for c++ Java python c
Thank you for your comment.. I am not planning to create any more series on language specific unit tests at this moment of time..but will certainly consider once my backlog is lighten.
Thanks again for your comment 🙏🙏🙏
10:50 mock
13:36 stub
15:05 fakes
Thanks 🙏🙏🙏
3:26. If the code is not working as expected, then it has bugs, right? then where is the diff between 1 and 2?
Hello
Thanks for your comment.
Working as expected means that it is doing what its expected to do neither less nor more. for example - an empty function is not a bug but if it does nothing it's not working as expected
Hope this helps
Thanks
I guess it is just a matter of definition. What is a bug?
I would agree with that a bug is unexpected behaviour. So anything not working as you expect it to, is in my mind a bug. Whether it crashes, sends an exception, or keeps working seemingly fine.
But it's just one of those things that we all feel different about. Alas, "bug or feature?" ;)
How to mock c functions
Thanks for your comment..Have you checked frameworks like CMock? To be honest I haven’t used any ‘C’ language mocking frameworks so can’t suggest on the usability of it.
Hope it helps ..thanks 🙏
10:50
3:17 whether not weather.
Thanks 🙏🙏🙏
hello sir
It's a good explanation, unfortunately it has no real examples of tests in code.
10 000 WHAT?
Milligram not centigram...
😀 🙏
WTF, 1 to n objects can be independent.
U crazy.
1 - n objects can't be a unit of code.
There is a reason and that is
"Those were created separately'
This is stupid AF
STOP whining, add your 2 cents, but no thanks. BE NICE....
Talk is cheap. show me the code
10:50