Unit Tests and Test Doubles like Mocks, Stubs & Fakes

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 มิ.ย. 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 @
    👉 TH-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

ความคิดเห็น • 180

  • @ggraham1100
    @ggraham1100 3 ปีที่แล้ว +28

    Absolutely the best informative, concise, and well structure video on Unit Tests that I have found in TH-cam. I will recommend this video to ensure that everyone has a foundational understanding of Units tests why, what, and how !

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว

      Thanks you so much for your appreciation and kind words..thanks again 🙏🙏🙏

  • @joaomatos1144
    @joaomatos1144 3 ปีที่แล้ว +18

    2021: One of the best explanations about Unit Tests. Just Subbed!

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว

      Thanks a lot for watching my video and thanks for your comment 🙏🙏🙏

  • @elliria_home
    @elliria_home 2 ปีที่แล้ว +6

    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.

  • @sagejames3689
    @sagejames3689 3 ปีที่แล้ว +7

    Very helpful and well-spoken. Exactly what I was looking for. Thank you!

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว

      Thanks for your comment....if you like my contents.. may I please request you to share the same with friends and family ..Thanks 🙏🙏🙏

  • @KO-vz5rd
    @KO-vz5rd 2 ปีที่แล้ว +3

    Thank you so much! So much confusion has been out there about mock vs. stub, and you clarify them beautifully...!

  • @actualprogramming
    @actualprogramming 4 ปีที่แล้ว +13

    Extremely helpful, Thanks 🙏🙏🙏.
    Would love to see a practical series on this as well.

  • @jazz4dayz543
    @jazz4dayz543 4 ปีที่แล้ว +2

    Great video! Really clearly explained with enough examples to get the point accross. Thanks :)

  • @ayshababur9388
    @ayshababur9388 4 ปีที่แล้ว +3

    Thank you for making this video. It was so helpful and clear!

  • @almasfizashaikh6159
    @almasfizashaikh6159 ปีที่แล้ว +2

    Such a well structured video, especially for someone new to the concept! Thank you :)

  • @Chavez3d
    @Chavez3d 2 ปีที่แล้ว +1

    This was very helpful thank you!! this cleared up serveral questions and misunderstandings I've had... THANK YOU!!

  • @jamesang8735
    @jamesang8735 11 หลายเดือนก่อน +2

    This is definitely the best video for unit test. Thank you!

  • @harshavardhan9991
    @harshavardhan9991 4 ปีที่แล้ว

    Thank you for detailed explanation !!

  • @harshaliyanachchi5638
    @harshaliyanachchi5638 3 ปีที่แล้ว +1

    Best video I found about unit test. Thank you.

  • @meenatural4502
    @meenatural4502 10 หลายเดือนก่อน +1

    Very well structured, informative, very talented teacher. Thank you!

  • @ruixue6955
    @ruixue6955 4 ปีที่แล้ว +21

    10:50 mock
    13:36 stub

    • @Cognitive-Programmer
      @Cognitive-Programmer  4 ปีที่แล้ว +4

      Thanks for this but to understand it properly you need to see the complete video 😀

  • @amitjoshi5798
    @amitjoshi5798 2 ปีที่แล้ว +1

    Explained perfectly. Thanks a lot!

  • @raotemamata
    @raotemamata 3 ปีที่แล้ว +1

    very nicely explained in simplest way. Thanks for this video.

  • @krishnaverma7744
    @krishnaverma7744 3 ปีที่แล้ว +1

    Wow.... Perfect slides...
    Perfect explanation...
    Thanks for sharing your knowledge...

  • @handover007
    @handover007 2 ปีที่แล้ว +1

    after a very long time I have seen such a video . Hats off.

  • @oneblackpanda
    @oneblackpanda 10 หลายเดือนก่อน +1

    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...

    • @Cognitive-Programmer
      @Cognitive-Programmer  10 หลายเดือนก่อน

      Thank you so much for your kind comment 🙏

  • @Guruprasad_Bhat
    @Guruprasad_Bhat 2 ปีที่แล้ว +1

    By far, best introductory explanation 🔥

  • @dataman17
    @dataman17 3 ปีที่แล้ว +1

    crisp and clear! Great job

  • @chandanguptaSDET
    @chandanguptaSDET 3 ปีที่แล้ว +1

    A gem for beginners!! Thanks

  • @danielmihu1552
    @danielmihu1552 3 ปีที่แล้ว

    It's a really good video with right explanations and arguments. Congrats!

  • @jaecheokkim99
    @jaecheokkim99 4 ปีที่แล้ว +1

    Thank you for easy explainations!

  • @Tanzeel431
    @Tanzeel431 3 ปีที่แล้ว

    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.

  • @Mueen520
    @Mueen520 3 ปีที่แล้ว +1

    Thank you for concise explanation.

  • @faithcyril5145
    @faithcyril5145 ปีที่แล้ว

    thank you so much. very intuitive

  • @mrr8702
    @mrr8702 ปีที่แล้ว

    thanks for this video, I learned a lot!

  • @podraig
    @podraig 4 ปีที่แล้ว +1

    Good explanations, thank you!

  • @NiyatiShah24
    @NiyatiShah24 2 ปีที่แล้ว +1

    Thank you! This was brilliant!

  • @kaphwamas
    @kaphwamas 4 ปีที่แล้ว +1

    Thank you so much for this lecture sir.

  • @dassyareg7587
    @dassyareg7587 ปีที่แล้ว

    Superb delivery. Absolutely amazing teaching.

  • @who-phpnerd
    @who-phpnerd 7 หลายเดือนก่อน

    Alhamdulillah
    Thank you Sir, your lecture is awesome! Please take my respect!

  • @Derpaherpa123
    @Derpaherpa123 4 ปีที่แล้ว +1

    Sir this was great. Thank you for this

  • @noahyannis2465
    @noahyannis2465 2 ปีที่แล้ว

    Great tutorial, thank you very much!

  • @louisecrowe4968
    @louisecrowe4968 3 ปีที่แล้ว

    Thank you for the really informative video!

  • @sasukesarutobi3862
    @sasukesarutobi3862 4 ปีที่แล้ว +7

    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);

  • @alihaydargubatov2790
    @alihaydargubatov2790 3 ปีที่แล้ว +1

    Amazing explanation. I wish you were my teacher at the university.

  • @dragonfalcon8474
    @dragonfalcon8474 3 ปีที่แล้ว

    This was a fantastic intro to Unit Testing.

  • @pablitoengineer
    @pablitoengineer 4 ปีที่แล้ว +3

    I would like to see your definition for spies as well!! Very good video!!

    • @Cognitive-Programmer
      @Cognitive-Programmer  4 ปีที่แล้ว +2

      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

  • @akashjani943
    @akashjani943 2 ปีที่แล้ว

    Just amazing!

  • @Pikachu871
    @Pikachu871 3 ปีที่แล้ว

    great video! really awesome explanations :)

  • @hugopristauz3620
    @hugopristauz3620 ปีที่แล้ว +1

    excellent explanations, very didactic, congrats 🙂

  • @lauragriffiths3332
    @lauragriffiths3332 3 ปีที่แล้ว +1

    Thank you!

  • @susantasahoo9166
    @susantasahoo9166 2 ปีที่แล้ว +1

    Nice & Simple explanation !!!

  • @mkc0321
    @mkc0321 2 ปีที่แล้ว +1

    amazing video, understood the difference between. mocks,stubs and fakes very well

  • @fuffsec
    @fuffsec 4 ปีที่แล้ว +1

    love your videos.

  • @ShivaniSingh-gd5or
    @ShivaniSingh-gd5or 2 ปีที่แล้ว +1

    thanks very much !

  • @misterrodger
    @misterrodger 3 ปีที่แล้ว

    Wonderful teacher!

  • @t100210022002
    @t100210022002 3 ปีที่แล้ว

    Great explanation!!!

  • @mytechio
    @mytechio 2 ปีที่แล้ว +1

    Hey,great video 🙏

  • @tattwadarshipanda6029
    @tattwadarshipanda6029 3 ปีที่แล้ว +3

    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.

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว

      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 🙏🙏🙏

  • @alexou857
    @alexou857 2 ปีที่แล้ว +1

    Thx my man :)

  • @marveipana8172
    @marveipana8172 3 ปีที่แล้ว

    Thanks Sir, good explanation :)

  • @aakankashasharma1007
    @aakankashasharma1007 2 ปีที่แล้ว +1

    9:34 - I am watching this when two days back, a major facebook/whatsapp/instagram outage happened. Lol

  • @dubble.
    @dubble. 9 หลายเดือนก่อน

    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.

    • @Cognitive-Programmer
      @Cognitive-Programmer  9 หลายเดือนก่อน

      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 🙏

  • @dodokwak
    @dodokwak 2 ปีที่แล้ว +1

    Thank you.

  • @codewithvinod9033
    @codewithvinod9033 ปีที่แล้ว

    great Job Sir

  • @biz0unc3
    @biz0unc3 2 ปีที่แล้ว +1

    Great video!

  • @musash1-17
    @musash1-17 3 ปีที่แล้ว +2

    Thank you, India.

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว +1

      Thank you so much for your comment 🙏🙏🙏

    • @musash1-17
      @musash1-17 3 ปีที่แล้ว

      @@Cognitive-Programmer no problem, i love you.

  • @shirishameka3011
    @shirishameka3011 4 ปีที่แล้ว +1

    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.

    • @SimonYells
      @SimonYells 4 ปีที่แล้ว

      What cross-compiler are you intend to use?

    • @shirishameka3011
      @shirishameka3011 4 ปีที่แล้ว

      @@SimonYells ARM Cortex A9

  • @DjCtavia
    @DjCtavia 3 ปีที่แล้ว +1

    Came by pure randomness, but it's a really good video, good job!

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว

      Thanks for stopping by and thanks a lot for your comment 🙏🙏🙏

  • @higiniofuentes2551
    @higiniofuentes2551 2 ปีที่แล้ว +1

    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!

    • @Cognitive-Programmer
      @Cognitive-Programmer  2 ปีที่แล้ว +1

      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

  • @ajaykryadav
    @ajaykryadav ปีที่แล้ว

    Too good sir

  • @TCHewagama
    @TCHewagama 3 ปีที่แล้ว

    good one

  • @arunpalaninathan1011
    @arunpalaninathan1011 3 ปีที่แล้ว

    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 !

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว

      Hello noted the mistake after upload. Sorry about that 🙏🙏🙏

  • @batner
    @batner 4 ปีที่แล้ว +2

    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.

    • @Cognitive-Programmer
      @Cognitive-Programmer  4 ปีที่แล้ว +1

      Hi
      Thanks for your comment.. , Yes but it's mostly depends upon how the code is written

  • @FahmiEshaq
    @FahmiEshaq 4 ปีที่แล้ว

    Crystal clear

  • @SlainR2
    @SlainR2 4 ปีที่แล้ว +3

    very impressive didactics

  • @sumandas4924
    @sumandas4924 4 ปีที่แล้ว +2

    Theory Explanation is really good. But some code samples for mock, stub and fake could have completed it properly.

  • @dhanrajk6614
    @dhanrajk6614 3 หลายเดือนก่อน

    Hi Sir, Is it possible use gmock to test functions which is written in c?

  • @samucancld
    @samucancld ปีที่แล้ว

    SOS EL UNO PAPÁ

  • @samarthvijayvargiya517
    @samarthvijayvargiya517 9 หลายเดือนก่อน

    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

  • @vivekm2674
    @vivekm2674 2 ปีที่แล้ว +1

    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.

  • @Smartskaft2
    @Smartskaft2 3 ปีที่แล้ว

    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.

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว

      Hello
      Thanks for your comment..yes you can do create stubs with google mock..

  • @daixtr
    @daixtr 4 ปีที่แล้ว +1

    Is it correct to say that "fakes" introduces a certain degree of impurity into unit testing?

    • @Cognitive-Programmer
      @Cognitive-Programmer  4 ปีที่แล้ว

      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

  • @abhishekbhattacharya9216
    @abhishekbhattacharya9216 ปีที่แล้ว

    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.

  • @thrivenipogu7521
    @thrivenipogu7521 8 หลายเดือนก่อน

    Autostub means?

  • @indramaniarora7901
    @indramaniarora7901 3 ปีที่แล้ว

    3:26. If the code is not working as expected, then it has bugs, right? then where is the diff between 1 and 2?

    • @Cognitive-Programmer
      @Cognitive-Programmer  3 ปีที่แล้ว +1

      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

    • @Smartskaft2
      @Smartskaft2 3 ปีที่แล้ว

      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?" ;)

  • @thexht7927
    @thexht7927 3 ปีที่แล้ว

    3:17 whether not weather.

  • @rianpriyanto2215
    @rianpriyanto2215 4 ปีที่แล้ว +2

    10:50

  • @kamy4518
    @kamy4518 2 ปีที่แล้ว +1

    Hello can you help me with unit test . Example with solution for c++ Java python c

    • @Cognitive-Programmer
      @Cognitive-Programmer  2 ปีที่แล้ว

      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 🙏🙏🙏

  • @sankarsubramaniyam6192
    @sankarsubramaniyam6192 2 ปีที่แล้ว +1

    How to mock c functions

    • @Cognitive-Programmer
      @Cognitive-Programmer  2 ปีที่แล้ว

      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 🙏

  • @a358747
    @a358747 3 ปีที่แล้ว +1

    10:50 mock
    13:36 stub
    15:05 fakes

  • @ignacioswboada660
    @ignacioswboada660 2 ปีที่แล้ว

    It's a good explanation, unfortunately it has no real examples of tests in code.

  • @GAMINGWORLDsagar
    @GAMINGWORLDsagar ปีที่แล้ว

    hello sir

  • @asoshah321
    @asoshah321 ปีที่แล้ว

    10 000 WHAT?

  • @heath1796
    @heath1796 3 ปีที่แล้ว

    Milligram not centigram...

  • @arupdash5904
    @arupdash5904 4 ปีที่แล้ว

    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

    • @ANOCEANGROUND
      @ANOCEANGROUND 3 ปีที่แล้ว

      STOP whining, add your 2 cents, but no thanks. BE NICE....

  • @learnwithcode4211
    @learnwithcode4211 3 ปีที่แล้ว

    Talk is cheap. show me the code

  • @barciu11
    @barciu11 3 ปีที่แล้ว

    10:50