简体   繁体   中英

How to do annotation processing and analyze the result with Junit test run status

In my project I have created custom annotation which I have added to important classes and methods.

I want to process these annotation after running my junit test suites to check if my annotated methods are covered and how much coverage of those methods. How can I achieve this programatically?

With Google reflections you can analyze JARs (or the classpath) to find the methods decorated with your custom annotation.

Than you can inspect the output of JUnit and link data together. How to get the output of a JUnit run depends on how you execute your suites, but it should always be possibile to generate the report in XML format and then parse it (or directly use the API without messing with XML)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM