JCOVERAGE use details

zhaozj2021-02-16  49

Author: New Profile Hu: In 2002 graduated from a university in Xi'an and computing mathematics, has been studying with JAVA and JAVA bread, of course, concerned about the little things OpenSource personal credo: mortal Olics, the same dedication same trouble! Personal blog: ip: lics@163.com, because you know the reason, I don't collect garbage and advertising, thank you for cooperation msn: lics@msn.com XP programming has been deeply loved for so much time. The code test coverage is a part of XP is an indispensable part of the administrator. In the current market, there are many tools in the market, the most classic Cover, but it is not free (for business is not free, for Open Source is free), today I will recommend JCOVERAGE, this is a very good tool, although not OpenSource, but for the personal version. Home: http://www.jcoverage.com/ jcoverage Allowance JUnit and Log4j, etc. You can see a detailed instructions in its documents, while JCOVERAGE can be used with Ant, notes: 1: Initialization is best to delete the jcoverage.ser file in the current directory, this file It is the result of the test, if it is found in the current directory, it will not test, or retest 2: When INSTRUMent, be sure to ensure that its class is compiled in debug mode, otherwise, the JCOVERAGE directive will not be injected, suggest Compiling a new DEBUG mode in the current directory 3: In the junit, be sure to ensure that the test is joined the JCOVERAGE instruction, otherwise you cannot generate a jcoverage.ser file, of course, you can't test the coverage, I am in this For a long time, it is mainly ClassPath's question. At this time you have to ensure that the classpath contains the join JCOVERAGE directive is not simple. If you use the engineering level ClassPath, then you will pain, I am so painful, you It is best to use a new classpath, which is the Class of the JCOVERAGE directive, which is necessary, is the example of me, why is the reason why you are so cumbersome; this seemingly simple problem will give your confidence. Because if you often use ant, there are many way in your classpath, such as one of the project you, in order to join the JCOVERAGE directive, join a copy of the JCOVERAGE directive, then at least There are three copies, and there are so many things that I don't want everyone to go. 4: Finally generate reports, you can choose HTML and XML format, but the free version is only HTML format, there is a place that is not a perfect place if you resource The code is UTF-8 encoding, So the generated report will have some part of the code annotation, there are two parts: Appendix 1: It is my personal Ant script, this footage is my personal environment, if you need to use, please modify, appendix 2: jcoverage The report screenshot, the report for HTML format, of course, you can also set it to other format Appendices: My personal works Ant scripts: < Javac Srcdir = "$ {build.jcoveReGeport.dir} / temp_source" debug = "yes"> < ClassPath Refid = "ClassPath" /> <-! ignored org.apache .COMMON Application -> 转载请注明原文地址:https://www.9cbs.com/read-20653.html


New Post(0)