I am new to C # programming and want to learn software development through testing. I read books, forums, I watch videos, but everywhere so far what I've seen or read, the example is shown at the beginning, without even reaching the full realization of at least one class. The eyes see, the brain seems to understand, but I do not do it). I can not force myself not to look at the whole project as a whole. Prompt can eat where intelligible FULL explanation how to develop through testing at least on a simple example, for example a blog (User, Post, Comments) with full implementation of at least one class. It is just understood that we divide dependencies, create api applications, but when you reach a specific example where data is taken from outside, it is not clear how to test it and whether it is necessary at all.

I came up with a simple example:

  • 1. Download the text file employee.txt (in which you find
    employee information lines
    id ~ first name ~ last name ~ middle name).
  • 2. Download the text file deparment.txt (in which you find
    lines with information in which department
    what employee idEmployee ~ name
    department).
  • 3. Share the lines in the employee.txt file.
  • 4. Share the lines in the deparment.txt file.
  • 5. Check the changes in the database and enter (new employee, the last name of the existing person has changed, the department has changed
    employee).
  • 6. Changes to display in the console.

I’m stupid, I can’t figure out where to start exactly by developing through testing?

  • 7
    Wait-wait, you will first learn ordinary programming, and then TDD. The essence of TDD is simple: you first write the test to the code, and then add the code of the class / classes, making sure that the test is finally compiled, run and completed successfully. To do this, of course, we must be able to simply write the code in the usual way. - VladD
  • I can recommend the article: [Unit Testing] [1] [1]: rsdn.ru/article/testing/UnitTesting.xml - vv2cc
  • 2
    @VladD remembered the instruction manual for using XP (not TDD) for designing a parachute. First you need to check whether this work is needed at all - reset the tester without a parachute. Crashed - you can move on. - alexlz
  • @alexlz: Well, the right approach! Suddenly the necessary functionality is already out of the box? :-D Remember the classic [: |||||:] about math, who needs to boil a pot of water? - VladD

2 answers 2

The book once helped me a lot (the practical application of the TDD in projects with examples and advice is NOT the language with #, but it doesn't matter for understanding). The most difficult thing was to force yourself to write tests before the code, and also to look at the development process from the other side. As for testing, as such, then for me the favorite among the books is this one . As correctly noted in the comments, in order to successfully apply unit testing, you must first master the selected technology.

  • Extreme programming? Paraphrasing Vysotsky: "But Chrysler, shod Chrysler ... I repent, I repent, I repent ..." - alexlz
  • I did not quite understand the meaning of what you were trying to convey with Vysotsky’s quote. Can it be "simple"? - wind
  • one
    I am not familiar with extreme programming and, accordingly, I can not judge who is cooler - Kent Beck or Sergey Mavrodi. Just at the end of the 20th century there was a C3 project (Crysler Comprehencive Compensation System - if the letters were not mixed up). It started without XP, but after a few months it was headed by K. Beck. The project ended in nothing - the "great bunch". Chrysler received a hole from a donut, and the XPs wrote several books and a bunch of articles on the topic "Cooler than XP - Boiled Eggs Only." More projects of this scale at XP'erov was not. - alexlz
  • I do not know anything about such statistics, but I like this approach, and not only me ... Do you advocate its unsuitability by comparing it with Mavrodi, or is it just infuriating pathos around it? - wind
  • 3
    Let's throw in ... Here's another classic about TDD vs. brains: devgrind.com/2007/04/25/how-to-not-solve-a-sudoku - VladD

A simple, understandable, interesting example of using the TDD method (and not testing tools!), In detail and in steps - http://www.slideshare.net/amritayan/test-driven-development-in-c

I read articles, watched videos, but found nothing better. I repeated all the actions and immediately everything fell into place. It's like riding a bike. You can not read the book "How to ride a bike" and go. We must sit down and go. And fall. I still "fall" (stumble on the usual programming style). But less often. Then "keep balance" will become a habit.