"Refactoring Learning" 03 Refactoring and testing

Source: Internet
Author: User

It's a new year, and I'm here to write this ghost.

This chapter of refactoring is mainly about a test framework for Java, and I just jumped

It's just a simple look at the idea.

    • Refactoring requires a good testing system, and we need to construct a system for refactoring, which is the prerequisite for refactoring.
    • No need to expect perfect testing, what is needed is an imperfect test that has been actually executed
    • Consider possible error boundary conditions when testing, and focus on the fire
    • Do not write tests because the test cannot capture all bugs, at least it can capture most
    • Take a reasonable time to catch most bugs
    • Write test code to let it perform automated testing

Okay, that's the main part of this chapter.

Not too much, just a brief discussion of your own understanding of the test.

The necessity and the simple view

One of the previous companies focused on bugs, there was an indicator, and my previous company often broke the indicator, then spent a lot of time looking for bugs and fixing bugs.

In fact, I can explain the necessity of this thing in my own experience, because I am not a careful programmer, but I have very good patience, and it seems to me that this thing is suitable for me.

Because this is a system, although the beginning is imperfect, but I can according to each leak bug feedback to continue to improve the system, it will become more and more perfect.

I've never played unit tests and automated tests, and that's not in my recent study range.

I think if my code structure is OK, then I would have been able to locate this bug very quickly, so I won't be learning this thing in the near future.

The only trouble is that I don't have this kind of automated testing, so I can't immediately find this bug until I wait for feedback from others, and it's hard to control the impact point when I'm not familiar with the code.

It's a pity that every bug I have will not contribute to my future tests. No way, I have to learn too much, this line is not planned!

In addition, the company may have to carry out unit tests in various projects next year, then it may be another version of the unit test notes.

So I think this thing is very useful, but my demand is not very urgent for the time being, waiting to be pushed.

2016, I wish you all a happy New Year!

"Refactoring Learning" 03 Refactoring and testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.