Unit Tests and Test Doubles like Mocks, Stubs & Fakes

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ธ.ค. 2024

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

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

    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 ปีที่แล้ว +20

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

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

    Never have I understood testing fundamentally like the way I have now. Thank you, sir; great explanation!

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

      Thank you so much for your comment and kind words.. Thanks a lot 🙏

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

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

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

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

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

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

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

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

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

    Superb delivery. Absolutely amazing teaching.

  • @oneblackpanda
    @oneblackpanda ปีที่แล้ว +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...

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

    Best video I found about unit test. Thank you.

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

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

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

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

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

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

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

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

  • @who-phpnerd
    @who-phpnerd ปีที่แล้ว

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

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

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

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

    By far, best introductory explanation 🔥

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

    Nice & Simple explanation !!!

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

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

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

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

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

    crisp and clear! Great job

  • @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 3 ปีที่แล้ว +1

    Explained perfectly. Thanks a lot!

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

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

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

    Thank you! This was brilliant!

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

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

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

    A gem for beginners!! Thanks

  • @dubble.
    @dubble. ปีที่แล้ว

    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  ปีที่แล้ว

      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 🙏

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

    excellent explanations, very didactic, congrats 🙂

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

    This was a fantastic intro to Unit Testing.

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

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

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

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

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

    Great tutorial, thank you very much!

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

    thanks for this video, I learned a lot!

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

    Wonderful teacher!

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

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

  • @tattwadarshipanda6029
    @tattwadarshipanda6029 4 ปีที่แล้ว +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  4 ปีที่แล้ว

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

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

    thank you so much. very intuitive

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

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

    • @Cognitive-Programmer
      @Cognitive-Programmer  5 ปีที่แล้ว +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

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

    Great video!

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

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

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

  • @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

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

    Thank you!

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

    thanks very much !

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

    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

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

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

  • @higiniofuentes2551
    @higiniofuentes2551 3 ปีที่แล้ว +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  3 ปีที่แล้ว +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

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

    Thank you.

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

    Thank you for the really informative video!

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

    Thank you for easy explainations!

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

    Thank you so much for this lecture sir.

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

    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  4 ปีที่แล้ว

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

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

    Great explanation!!!

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

    Just amazing!

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

    Thx my man :)

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

    great Job Sir

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

    Sir this was great. Thank you for this

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

    Thank you for detailed explanation !!

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

    Good explanations, thank you!

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

    very impressive didactics

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

    Thanks Sir, good explanation :)

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

    great video! really awesome explanations :)

  • @vivekm2674
    @vivekm2674 3 ปีที่แล้ว +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.

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

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

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

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

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

    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  4 ปีที่แล้ว

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

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

    How to mock c functions

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

      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 🙏

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

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

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

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

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

    Autostub means?

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

    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.

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

    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  4 ปีที่แล้ว +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 4 ปีที่แล้ว

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

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

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

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

      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

  • @batner
    @batner 5 ปีที่แล้ว +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  5 ปีที่แล้ว +1

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

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

    Too good sir

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

    good one

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

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

  • @rtothec1234
    @rtothec1234 4 หลายเดือนก่อน +1

    If you want to find no bugs in your unit tests then write no unit tests.

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

    Crystal clear

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

    SOS EL UNO PAPÁ

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

    3:17 whether not weather.

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

    10:50

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

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

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

    Milligram not centigram...

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

    hello sir

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

    10 000 WHAT?

  • @AnoNym-zi5ty
    @AnoNym-zi5ty 5 หลายเดือนก่อน +1

    I must disagree. You can smell the quality of code instantly if you see it. Code smell.

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

      Hi
      Thanks for sharing your thoughts.. however if I can just add my 2 cents.. a production level code, because of its size and comp will always smell bad even though it might not really be

  • @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 4 ปีที่แล้ว

    Talk is cheap. show me the code

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

    10:50