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

КОМЕНТАРІ • 180

  • @ggraham1100
    @ggraham1100 3 роки тому +28

    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 !

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

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

  • @sagejames3689
    @sagejames3689 3 роки тому +6

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

  • @actualprogramming
    @actualprogramming 4 роки тому +13

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

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

  • @jazz4dayz543
    @jazz4dayz543 3 роки тому +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!

  • @jamesang8735
    @jamesang8735 10 місяців тому +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.

  • @harshavardhan9991
    @harshavardhan9991 4 роки тому

    Thank you for detailed explanation !!

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

  • @harshaliyanachchi5638
    @harshaliyanachchi5638 3 роки тому +1

    Best video I found about unit test. Thank you.

  • @meenatural4502
    @meenatural4502 9 місяців тому +1

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

  • @amitjoshi5798
    @amitjoshi5798 2 роки тому +1

    Explained perfectly. Thanks a lot!

  • @jaecheokkim99
    @jaecheokkim99 3 роки тому +1

    Thank you for easy explainations!

  • @Guruprasad_Bhat
    @Guruprasad_Bhat 2 роки тому +1

    By far, best introductory explanation 🔥

  • @raotemamata
    @raotemamata 3 роки тому +1

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

  • @dataman17
    @dataman17 3 роки тому +1

    crisp and clear! Great job

  • @podraig
    @podraig 4 роки тому +1

    Good explanations, thank you!

  • @krishnaverma7744
    @krishnaverma7744 3 роки тому +1

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

  • @danielmihu1552
    @danielmihu1552 3 роки тому

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

  • @chandanguptaSDET
    @chandanguptaSDET 3 роки тому +1

    A gem for beginners!! Thanks

  • @kaphwamas
    @kaphwamas 4 роки тому +1

    Thank you so much for this lecture sir.

  • @dassyareg7587
    @dassyareg7587 Рік тому

    Superb delivery. Absolutely amazing teaching.

  • @Mueen520
    @Mueen520 3 роки тому +1

    Thank you for concise explanation.

  • @Derpaherpa123
    @Derpaherpa123 3 роки тому +1

    Sir this was great. Thank you for this

  • @NiyatiShah24
    @NiyatiShah24 2 роки тому +1

    Thank you! This was brilliant!

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

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

  • @louisecrowe4968
    @louisecrowe4968 3 роки тому

    Thank you for the really informative video!

  • @oneblackpanda
    @oneblackpanda 9 місяців тому +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...

  • @noahyannis2465
    @noahyannis2465 2 роки тому

    Great tutorial, thank you very much!

  • @faithcyril5145
    @faithcyril5145 Рік тому

    thank you so much. very intuitive

  • @mrr8702
    @mrr8702 Рік тому

    thanks for this video, I learned a lot!

  • @dragonfalcon8474
    @dragonfalcon8474 3 роки тому

    This was a fantastic intro to Unit Testing.

  • @who-phpnerd
    @who-phpnerd 6 місяців тому

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

  • @alihaydargubatov2790
    @alihaydargubatov2790 2 роки тому +1

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

  • @misterrodger
    @misterrodger 3 роки тому

    Wonderful teacher!

  • @Pikachu871
    @Pikachu871 3 роки тому

    great video! really awesome explanations :)

  • @fuffsec
    @fuffsec 3 роки тому +1

    love your videos.

  • @hugopristauz3620
    @hugopristauz3620 Рік тому +1

    excellent explanations, very didactic, congrats 🙂

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

  • @t100210022002
    @t100210022002 3 роки тому

    Great explanation!!!

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

  • @susantasahoo9166
    @susantasahoo9166 2 роки тому +1

    Nice & Simple explanation !!!

  • @mkc0321
    @mkc0321 2 роки тому +1

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

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

  • @lauragriffiths3332
    @lauragriffiths3332 2 роки тому +1

    Thank you!

  • @akashjani943
    @akashjani943 Рік тому

    Just amazing!

  • @ShivaniSingh-gd5or
    @ShivaniSingh-gd5or 2 роки тому +1

    thanks very much !

  • @dodokwak
    @dodokwak 2 роки тому +1

    Thank you.

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

  • @biz0unc3
    @biz0unc3 2 роки тому +1

    Great video!

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

  • @alexou857
    @alexou857 2 роки тому +1

    Thx my man :)

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

  • @dhanrajk6614
    @dhanrajk6614 2 місяці тому

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

  • @dubble.
    @dubble. 8 місяців тому

    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  8 місяців тому

      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 🙏

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

  • @codewithvinod9033
    @codewithvinod9033 Рік тому

    great Job Sir

  • @samarthvijayvargiya517
    @samarthvijayvargiya517 8 місяців тому

    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

  • @SlainR2
    @SlainR2 4 роки тому +3

    very impressive didactics

  • @TCHewagama
    @TCHewagama 3 роки тому

    good one

  • @ajaykryadav
    @ajaykryadav Рік тому

    Too good sir

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

  • @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 3 роки тому

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

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

  • @samucancld
    @samucancld Рік тому

    SOS EL UNO PAPÁ

  • @sumandas4924
    @sumandas4924 4 роки тому +2

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

  • @thrivenipogu7521
    @thrivenipogu7521 8 місяців тому

    Autostub means?

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

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

  • @a358747
    @a358747 3 роки тому +1

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

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

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

  • @rianpriyanto2215
    @rianpriyanto2215 3 роки тому +2

    10:50

  • @thexht7927
    @thexht7927 3 роки тому

    3:17 whether not weather.

  • @GAMINGWORLDsagar
    @GAMINGWORLDsagar Рік тому

    hello sir

  • @ignacioswboada660
    @ignacioswboada660 2 роки тому

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

  • @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 2 роки тому

    10:50