Unit Tests and Test Doubles like Mocks, Stubs & Fakes

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024

Комментарии • 184

  • @ggraham1100
    @ggraham1100 3 года назад +29

    Absolutely the best informative, concise, and well structure video on Unit Tests that I have found in RUclips. 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 года назад +19

    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.

  • @actualprogramming
    @actualprogramming 4 года назад +13

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

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

  • @jamesang8735
    @jamesang8735 Год назад +2

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

  • @handover007
    @handover007 2 года назад +1

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

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

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

  • @meenatural4502
    @meenatural4502 Год назад +1

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

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

  • @harshaliyanachchi5638
    @harshaliyanachchi5638 3 года назад +1

    Best video I found about unit test. Thank you.

  • @krishnaverma7744
    @krishnaverma7744 3 года назад +1

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

  • @almasfizashaikh6159
    @almasfizashaikh6159 Год назад +2

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

  • @who-phpnerd
    @who-phpnerd 9 месяцев назад

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

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

  • @Guruprasad_Bhat
    @Guruprasad_Bhat 2 года назад +1

    By far, best introductory explanation 🔥

  • @Chavez3d
    @Chavez3d 2 года назад +1

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

  • @mkc0321
    @mkc0321 2 года назад +1

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

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

  • @dassyareg7587
    @dassyareg7587 Год назад

    Superb delivery. Absolutely amazing teaching.

  • @amitjoshi5798
    @amitjoshi5798 2 года назад +1

    Explained perfectly. Thanks a lot!

  • @alihaydargubatov2790
    @alihaydargubatov2790 3 года назад +1

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

  • @Mueen520
    @Mueen520 3 года назад +1

    Thank you for concise explanation.

  • @raotemamata
    @raotemamata 4 года назад +1

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

  • @dodokwak
    @dodokwak 2 года назад +1

    Thank you.

  • @dataman17
    @dataman17 3 года назад +1

    crisp and clear! Great job

  • @lauragriffiths3332
    @lauragriffiths3332 3 года назад +1

    Thank you!

  • @faithcyril5145
    @faithcyril5145 Год назад

    thank you so much. very intuitive

  • @ShivaniOnYT
    @ShivaniOnYT 2 года назад +1

    thanks very much !

  • @dubble.
    @dubble. 11 месяцев назад

    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  11 месяцев назад

      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 🙏

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

  • @mrr8702
    @mrr8702 Год назад

    thanks for this video, I learned a lot!

  • @jazz4dayz543
    @jazz4dayz543 4 года назад +2

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

  • @dragonfalcon8474
    @dragonfalcon8474 3 года назад

    This was a fantastic intro to Unit Testing.

  • @ayshababur9388
    @ayshababur9388 4 года назад +3

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

  • @NiyatiShah24
    @NiyatiShah24 2 года назад +1

    Thank you! This was brilliant!

  • @chandanguptaSDET
    @chandanguptaSDET 4 года назад +1

    A gem for beginners!! Thanks

  • @susantasahoo9166
    @susantasahoo9166 3 года назад +1

    Nice & Simple explanation !!!

  • @hugopristauz3620
    @hugopristauz3620 2 года назад +1

    excellent explanations, very didactic, 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 🙏🙏🙏

  • @mytechio
    @mytechio 2 года назад +1

    Hey,great video 🙏

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

  • @alexou857
    @alexou857 2 года назад +1

    Thx my man :)

  • @samarthvijayvargiya517
    @samarthvijayvargiya517 11 месяцев назад

    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

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

  • @akashjani943
    @akashjani943 2 года назад

    Just amazing!

  • @danielmihu1552
    @danielmihu1552 3 года назад

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

  • @noahyannis2465
    @noahyannis2465 2 года назад

    Great tutorial, thank you very much!

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

  • @kaphwamas
    @kaphwamas 4 года назад +1

    Thank you so much for this lecture sir.

  • @dhanrajk6614
    @dhanrajk6614 5 месяцев назад

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

  • @misterrodger
    @misterrodger 3 года назад

    Wonderful teacher!

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

  • @jaecheokkim99
    @jaecheokkim99 4 года назад +1

    Thank you for easy explainations!

  • @codewithvinod9033
    @codewithvinod9033 Год назад

    great Job Sir

  • @SlainR2
    @SlainR2 4 года назад +3

    very impressive didactics

  • @ajaykryadav
    @ajaykryadav Год назад

    Too good sir

  • @sumandas4924
    @sumandas4924 4 года назад +2

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

  • @harshavardhan9991
    @harshavardhan9991 4 года назад

    Thank you for detailed explanation !!

  • @biz0unc3
    @biz0unc3 3 года назад +1

    Great video!

  • @louisecrowe4968
    @louisecrowe4968 3 года назад

    Thank you for the really informative video!

  • @Derpaherpa123
    @Derpaherpa123 4 года назад +1

    Sir this was great. Thank you for this

  • @podraig
    @podraig 4 года назад +1

    Good explanations, thank you!

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

  • @aakankashasharma1007
    @aakankashasharma1007 2 года назад +1

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

  • @samucancld
    @samucancld Год назад

    SOS EL UNO PAPÁ

  • @fuffsec
    @fuffsec 4 года назад +1

    love your videos.

  • @codekids99
    @codekids99 3 года назад

    good one

  • @a358747
    @a358747 3 года назад +1

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

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

  • @t100210022002
    @t100210022002 3 года назад

    Great explanation!!!

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

  • @marveipana8172
    @marveipana8172 3 года назад

    Thanks Sir, good explanation :)

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

  • @Pikachu871
    @Pikachu871 3 года назад

    great video! really awesome explanations :)

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

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

  • @thrivenipogu7521
    @thrivenipogu7521 11 месяцев назад

    Autostub means?

  • @FahmiEshaq
    @FahmiEshaq 4 года назад

    Crystal clear

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

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

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

  • @rtothec1234
    @rtothec1234 9 дней назад +1

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

  • @rianpriyanto2215
    @rianpriyanto2215 4 года назад +2

    10:50

  • @ignacioswboada660
    @ignacioswboada660 3 года назад

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

  • @thexht7927
    @thexht7927 4 года назад

    3:17 whether not weather.

  • @GAMINGWORLDsagar
    @GAMINGWORLDsagar Год назад

    hello sir

  • @heath1796
    @heath1796 3 года назад

    Milligram not centigram...

  • @asoshah321
    @asoshah321 2 года назад

    10 000 WHAT?

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

  • @AnoNym-zi5ty
    @AnoNym-zi5ty Месяц назад +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

  • @learnwithcode4211
    @learnwithcode4211 3 года назад

    Talk is cheap. show me the code

  • @barciu11
    @barciu11 3 года назад

    10:50