How to get Code coverage via external rest assured API automation using jacoco?

  • I have a multi module application "Project A". This application is hosted in clustered app nodes using tomcat as web server. We are using Spring, Web Services as primary among many other technologies to build this.

    For doing the API Automation i have another project "Project B" which test all the public API of "Project A" using rest-assured.

    Both the "Project A" and "Project B" are distinctly different and hosted in different GIT location. We do the build and test using Jenkins.

    Now my requirement is to get code coverage of "Project A" using "Project B".

    What I have Done till now:

    A. I have installed jacoco-agent.jar in each of my app node and put the "JACOCO-ARGS" in the web server start up script.


    B. We usually keep one node on only while looking for code coverage.

    What I am getting now:

    I am getting the jacoco-it.exec file generated but with very less coverage. With all the API passing i am getting only 3% coverage at max. Where as by doing manual testing we are getting more than 50%.

    What I am looking for:

    1. Is there any other step which I am missing here?
    2. How to get max code coverage for this set up?
    3. What is the standard I need to follow while looking for code coverage?

    1. Check if your API tests with rest-assured operate with all the possible parameters (not just end-points) that could run your API in all possible ways
    2. Do not ignore negative tests. In my experience we just missed 50% of coverage because of we didn't bring the system into exceptional states which prevented the code to run into corresponding exception handling areas

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2