TC use JBPM improved control of the circulation process a refund, the refund process in September last year after on-line no longer had a, JBPM-related code is not what I originally wrote, I have compared the configuration inside the strange, the other release date quickly, and in the end of the project period, is there still any need to accept the demand to do more changes, more importantly, the revised code, not the impact of existing business logic can not be any problems.
I thought carefully, first of all that business demand is reasonable, and then thought for a while and need to pay attention to several points, seems to be able to control, the decision to take over this demand.
After dinner back at the beginning of RefundServiceBuyerModifyAgreement turned the unit testing, better, three kinds of common business covers two kinds of scenes, abnormal flow of the three kinds of coverage. I am the light of the new business scenario test cases make up a unit to be amended and combined with the fact that a number of Assert, and then began to change the code. Decision node plus additional Process Transition, modify JBPM configuration file, in accordance with the new process added a new path, and then changed its business code, and to increase the Dao way to meet a new demand.
In the process, the occurrence of an episode, I run the unit tests again, we had anticipated that would throw an exception (code not yet the realization of business), actually did not expect to see the green, the suddenly remembered, I just revised the formal environment configuration file, no action to amend the unit test environment configuration file, it is taking the old process. Open Total Commander, use shortcut keys to enter the need to synchronize the two configuration files directory, using Beyond Compare, synchronize, the Eclipse F5 and then to a few, it turned out, this is the expected red stripe.
Half an hour after the completion of all the coding. Added for the new unit testing process also saw the green article. I put all the code SVN sync, the one-time submission to the server.
And then log on to the CruiseControl server, cd to this meeting to establish the continuing integration of the transformation project, svn up, run mvn clean test, during which I also忙里偷闲, come up with today's Express first came to the spring of 2009, Fujian Tieguanyin, the bubble Haocha Cup. Waited for three minutes, all tests are run, and hung up 3 Case, I ran in the local Eclipse in the next, really run, however, open Excel and then to prepare the initial data, find the problem that the refund Case records and transaction records, the beginning of that is: a refund of the state of initialization data problem has been corrected after the F5 in the Eclipse in a few runs extra, had hoped to see green, or red, and a parabolic or abnormal.
Appears to be good before I got a wrong code, and carefully read the next code is the engine found in the configuration file of the questions: where to call this process there are two points, and I am only related to the transformation of a point. I will be left to a point, and runs extra, which turns out to be green. This error is quite subtle, if found functional testing until this problem, the need for me to track, locate, modify, submit, find someone to re-deploy to the test environment, functional testing and then invite members to Redo the test, Close BUG, it takes at least two hours; if sent to the omission of online testing, then trouble.
Before, I found some new category of unreasonable use of Eclipse tools for the reconstruction, for a relatively easy to understand the class name, the author, and then run a full set of CruiseControl server unit testing, have been more than 600 Case, which times there is no problem.
Then I ssh to our server 149 modify my code to update, packing, re-deployment, publishing as services. I switch to the local Eclipse integration testing in the engineering, integration testing will target services to address day-to-day test environment from the switch to 149 servers, running a full suite of integrated test, 10 minutes later, more than 90 test run, no problem. I looked at the table, there are five minutes to 8:00.
I think this is why we insist on writing a comprehensive coverage of the reasons for unit testing, even if it will cost us a lot of extra time. Because:
- With these tests, we can at least know that the changes will not affect the function of the past.
- Code changes can not be so afraid of, have confidence in their own code in order to better embrace the change.
- Stage in the development of most of BUG, so that both development and testing easier.
In fact, unit testing and documentation to write, like, take time to look is the expense of efficiency, but if you write some code but do not know it would be normal to the Run, if you are a group of people every day in Wangwang asked this question on that, take the time to write unit tests is cost-effective trading.








Responses to “Why do we write unit tests?”