because of a new requirement, I modified a bunch of Code . The length is not long, so there are four or five lines, in the user registration process, the Program personnel in charge should not write the code, but verify that the modified Code is correct, the problem is that to verify the correctness of these lines of code, I have to ensure that they have been executed at least once, that there is no exception, and that they have done the right thing, OK. To trigger these lines of code, it is effort-consuming, because it is not enough for users to register these lines of code to be executed. If we regard the execution process of the Code as a tree, each if statement generates a branch of the tree . Obviously, the more complicated the logic is, the more branches the tree has. Unfortunately, the code to be tested is on a branch that is not frequently executed, there are many if statements in front of this Code that block it, so I want precisely prepare test conditions to ensure that the Code does not go to other branches during execution, but is the same as a pass, the IF Statements are successfully executed on the code block I want to test. Unfortunately, a bug is lurking in the previous Code. At this time, we have to solve other bugs first, and if my code has errors, then unfortunately And redo it once.
what preparations do I need to make this time:
1) Recall, think, when will this code block be called?
2) I found that this code is an invitation to friends. Code that will be triggered after a friend registers
3) How can a friend register? The User ID must be found in the database.
4) enter the command line and use a special command for processing. The command will convert the user ID into an unreadable string and print it out. Copy it.
5) Open the browser, enter a specific URL and append the generated string to the URL. Press ENTER
6) to redirect the browser to the logon window and enter the registration information, click to log on
it seems that the preparation is over. Don't be happy. At this time, our test process is just starting. At this time, the Code starts to run down from the vertex of the tree. If the user ID is incorrect, the code will not go into the desired branch, and then execute the code, so all the work will come back, come back, and come back...
no matter whether we are lucky or not, we will go over the previous step, that is, the code is executed, there are Exception Handling exceptions, there are no exceptions to view, after the program is executed, has the contribution value added according to the business logic increased? Well, all the work is over. It's time to celebrate. I have to confess that this is only the first of my many tasks, I have to work overtime this evening. Since the time is so tight, why should I write this? I think the job is to record and summarize it, so the next time you mention these things, you will feel a lot of pain in promoting yourself to improve your work.
In fact, these append functions may not be so complex. In a large system, it is difficult to go through the process once again, these work have actually wiped out our enthusiasm.