Vanilla Pop: How about the IT team?Can we use TDD to implement a design sprint and then look at the situation?
Horst: I still stick to my own policy of not approving micro-testing.However, I am happy to let the team decide how it can deliver features and quality to me.
Code Dog: I don't believe in TDD.You can't write the test before you write the code.do you know?No one will do this.If you think about it, within a few weeks, it will be back to the same way. I call it error-driven development.The people we debugged the code did just that.
Architect: I changed.I have consulted an expert and suggested that I try a more flexible mind.I try to do better.Stop imposing opinions on colleagues.Let the team decide instead of ordering them myself.Shall we all start singing a song called "Kumbiyah"?Pop is right.He showed me a way, so all we need to do is start implementation.The management wants us to take the lead and achieve 100% micro-test coverage of all codes.The vice president has issued this matter.There will be a continuous integration server to run them.We just need to implement it.This is the current rule.Good luck.
Jose: (whispering) Uh, flexible thinking lasts less than 5 minutes.
Junior Joe: (Whispering) Do you think that will be a new record?
Code Dog: Ah, this won't happen.We won't really do that, will we?That is a matter of quality control.
Jose: I don't know.Vanilla Pop's previous work was excellent.Have you seen these tests?
Code Dog: Uh... No, that's Pop's stuff.
Junior Joe: I think it's a bit eye-catching.I support.
Vanilla Pop: Thank you.
Architect: Vanilla Pop and Junior have 40% coverage.This is a small and new single page application.Code Dog is also doing TDD. According to my estimation, we can achieve 100% coverage next week.Let's go forward, guys.
(Time has passed.) On Tuesday, 50%.On Wednesday, 60%.On Thursday, 65%.Friday, 85%.(Go ahead!) 90% on Monday.
Architect: Not bad!I am very impressed with the transformation of code dog.He captured the essence of TDD.In fact, the code blocks he processed achieved 100% coverage.I propose to give him an award.
Code Dog: (surprised) Wow, thanks!
Dear developers: (patted the code dog on the back.)
Junior: Good job!
Vanilla: I am proud to know you.
Jose: It's great for developers.
Vanilla: He really did it.
Horst: What is the situation?I slide the screen like this, why can't I see anything?
Code Dog: (Embarrassed) I know what's going on.I will debug and fix it.
(closed)
Jose: Very strange.His code is 100% covered, but it seems to have errors.
Junior: Maybe it's an integration issue?I reviewed his code and suggested that he stop calling IO in the view layer.It is impossible to perform micro-testing without extensive use of fictitious objects.
Architect: Where is the code dog?I hope it can refactor the code appropriately.His code takes too much network bandwidth.
Vanilla: He is dealing with some situations that Horst discovered.
Architect: What?impossible!His code has 100% coverage. Check out these beautiful code coverage reports.
Vanilla: Yes, it is a miracle.Junior, can you show everyone his micro test?
Junior: Ah, good!
Vanilla: Ah, my God.Turing's soul would be shocked by this.
Jose: You look at Pop?He is not a developer with a personality like you.
Junoir: Would you think that his 50 micro-tests did not do any tests?I have no reason not to think so?
Vanilla: These tests are fake.
Architect: This person is incredible!He just pretended to be in TDD!
Jose: Oh, my God.He actually did this.It's crazy, messed up.Oh my god, terrible!
Explanation: Code coverage is a good way to analyze and understand the team's code automation progress.But if you advance too quickly, or use policies to enforce it, you will easily get false results.Code coverage testing tools can let us know what code is executed when the test is running, but it can't tell us whether the automated test is working.Imagine a function that sums two values.If the function is executed when measuring code coverage, then there will be 100% coverage, but full code coverage does not mean that the function will return a result of one plus one equal to two.
Pair programming or review test code can avoid fraud.If you are going to review code, then checking the micro-test code is more important than checking the product code.The micro-test specification reflects the developer's intention.If the micro-test quality is good enough, then we can believe that the product code that passes the test is also high-quality code.
In the next episode,expert developers ofTDDandStack Overflow.
用户评论