Trying to learn unit testing, TDD and BDD RRS feed

All replies

  • User475983607 posted

    Unit testing is simply known inputs produce expected results.  Typically, unit tests test business logic.  The idea is rather than testing business logic while running the application, logical units are separated and test individually in a test project.  Often this means rethinking how application are designed.  This is where Test Driven Development (TDD) and Behavior Driven Development (BDD) come in.   They provide a path for developing testable classes.

    Often developers new to unit testing, create tests that include data access which is called integration testing not unit testing.   Generally, the problem is understanding how to separate data access from the business logic.  Unit tests typically take advantage of Interfaces, mock data, and dependency injection.  This are the bit developers need to learn to get unit tests working. 

    Tuesday, October 6, 2020 8:27 PM
  • User1120430333 posted

    What is a unit test?


    Maybe you should take a better course. It doesn't cost that much for a monthly subscription. .


    Tuesday, October 6, 2020 9:43 PM
  • User-474980206 posted

    while writing units test is a skill required for TDD, it is an analysis and programing methodology. That is, TTD is a style of design and coding. It is more important to understand TDD than write a unit test. The unit test is the easy part, and one you understand the TDD methodology the unit tests come natural.

    In short TDD, says to design the unit test first. this helps define the api of the class/component. You then code the component to pass the unit test. 

    After you master TDD, then its about code coverage with the unit tests. is there a unit test for each code branch in the component? BDD is methodology for designing good coverage in unit tests.

    TDD & BDD are showing the pitfalls of object oriented design. Inheritance and internal state makes units test very complex and difficult. 

    you will notice that C# 9.0 is adding more support for functional programing to catch up with swift and rust

    note: rust is a great language to use to learn modern TDD.


    Tuesday, October 6, 2020 11:09 PM