[Reconstruction learning] 03 reconstruction and testing, reconstruction learning 03 Testing
This ghost is written here in the New Year.
This chapter of refactoring focuses on a java testing framework.
Just a simple look at its thoughts
- Reconstruction requires a good test system, and we need to build such a system for reconstruction, which is the premise of reconstruction.
- There is no need to expect a perfect test. What is needed is that the imperfect test has been actually executed.
- When testing, consider possible Error Boundary Conditions and focus on Firepower
- Do not write the test because the test cannot capture all bugs, at least it can capture the majority
- Spend reasonable time capturing most bugs
- Write test code for automated testing
Okay. This is the main content of this chapter.
If there are not many tests, let's briefly discuss your understanding of the test.
Necessity and simple view
A previous company pays great attention to the number of bugs and has an indicator. In the past, I often broke this indicator, and then spent a lot of time looking for bugs and solving bugs.
In fact, I can use my own experience to illustrate the necessity of this thing, because I am not a careful programmer, but I have a very patient, and in my opinion this thing is very suitable for me.
This is a system. Although it was not perfect at the beginning, I can continue to improve this system based on feedback from every BUG detected, and it will become more and more perfect.
I have never played unit testing or automated testing, and this is not part of my recent study.
I think that if my code structure is okay, I would have been able to quickly locate this BUG, so I will not learn about it in the near future.
The only trouble is that I don't have this automated test, so I can't immediately find this BUG until someone else gives feedback, it is also difficult to control the associated impact points when you are not familiar with the code.
Every BUG of mine will not contribute to my future tests. It is a pity! No way. I have too many things to learn. This is not a plan!
In addition, the company may implement unit tests in various projects next year. At that time, another version of Unit Test Study Notes may be prepared.
So I think this is very useful, but my demand is not very urgent for the time being, and the wait is being promoted.
I wish you a happy New Year!