Unit Testing: Test Driven and Scenario Based Testing

Sdílet
Vložit
  • čas přidán 24. 10. 2018
  • This is the first of a four part series, recorded this summer, where Robert is joined by Phil Japikse to discuss unit testing. This series expands on the 2017 Unit Testing episode.
    In this episode, Robert and Phil take a deep dive into the details and philosophy of Test Driven Development (TDD), including demonstrating a glorious failure that proves out the benefit of writing tests around your code. Next, they discuss scenario based testing with xUnit, re-using a single unit test to cover multiple use cases for the system under test.
    Links:
    www.skimedic.com/blog
    github.com/skimedic/presentat...
    xunit.github.io/
    github.com/moq/moq
    Episodes in this series:
    Test Driven and Scenario Based Testing (this episode)
    xUnit
    MOQ Framework
    Existing Code
  • Věda a technologie

Komentáře • 20

  • @EricTViking
    @EricTViking Před 5 lety +2

    Good to see you guys back in the saddle again! @13:58 what has been accomplished is that the Calculator class has started to take shape - one step at a time. And that's the key to TDD - the steps should be small ones that lead to the finished solution, and not large leaps of code. For TDD to work the steps need to be small incremental ones. When the steps are too big, you get problems - as was demonstrated ;) Looking forward to the next episode...

  • @FSMOLD
    @FSMOLD Před 5 lety +3

    Thanks for this video.The bug is :The divide function parameters' type needs at least one double or decimal or float,then the result would get the "decimal". int operate with int always get int.

  • @KalanaMahaarachchi
    @KalanaMahaarachchi Před 4 lety

    This is a great introduction. Like this.

  • @WinLoveCry
    @WinLoveCry Před 3 lety +1

    Nice... great series

  • @garethwynn01
    @garethwynn01 Před 2 lety

    One of the benefits of writing the minimally passing test that returns a hard coded value of 15 is that you know at that point that you have a working test. There isn't a chance that you're "testing to compliance" by making the test pass when it shouldn't and you know this because the code is so simple you aren't going to make that mistake. You can then expand the implementation while still keeping your test in a passing state. The test is then acting as a development tool aiding in the implementation. Rather than just something you create once you believe the implementation is "complete". It's really common to see developers write tons of implementation code, test it by continually running the application and then write the tests at the end when actually it's much easier to create your tests and use those to exercise just that unit of the code as you write it.

  • @JohnLudlow
    @JohnLudlow Před 5 lety +7

    Personally I think it's misleading to say that you write your tests first. I think a lot of people get the idea that you write 20 tests, then write some production code.
    I like to say that you write your tests and your production code at the same time, switching from one to the other, letting the tests lead the production code.

  • @hssjohng8662
    @hssjohng8662 Před 5 lety +1

    PHIL JAPIKSE IS BACK!!!!!

  • @mbut123
    @mbut123 Před 5 lety +2

    I'd add fluent assertions to the initial nuget list for a new unit test project.

  • @dosenmarko
    @dosenmarko Před 5 lety +1

    FYI, Nunit does not support exception attribute for several version already. I still prefer the syntax of nUnit where test is attributed as test and not as 'fact'. Don’t know if this was live somewhere, but this is not a way to teach someone if you don’t know it.

  • @RealDids
    @RealDids Před 5 lety

    Please bring better unit testing and TDD support to Visual Studio for Mac.

  • @jamesallen74
    @jamesallen74 Před 5 lety

    Why does the audio not sync with the video?

    • @GaryJohnWalker1
      @GaryJohnWalker1 Před 5 lety +1

      It doesn't sync. And the reason I just came out of full screen to check comments in case it was "just me" and this computer looking at lips not matching the sound!

    • @visualstudio
      @visualstudio  Před 5 lety

      Sorry about that. We fixed this for the rest of the videos in the series. Robert

  • @mrfusion3000
    @mrfusion3000 Před 2 lety

    How is it possible in 2018 to not get synchronization between picture and sound working?

  • @m0hamedSharaf
    @m0hamedSharaf Před 5 lety

    Really you don't have to switch tabs each you want to run the tests..

  • @imcoyote9925
    @imcoyote9925 Před 5 lety

    Please reduce the noise in the sound.

    • @visualstudio
      @visualstudio  Před 5 lety

      Sorry about that. We fixed this for the rest of the videos in the series. Robert

  • @sacredgeometry
    @sacredgeometry Před 3 lety

    20:05 now we see why people advocate for TDD and unit tests. Because they are incompetent.

    • @PhilGerb93
      @PhilGerb93 Před rokem

      You’re not wrong that it was incompetent to not know how to divide.. But if you truly think that TDD and unit tests are for idiots, then you need to inform yourself more about the subject… And never ever say that in an interview, you’ll get laughed at.

  • @NBGTFO
    @NBGTFO Před 5 lety +2

    This is so basic as to be a waste of time for anyone who has done professional development for any length of time. If you're completely new to programming, then this video many be of some minor benefit. Is that really your target audience?