Search code examples
javaeclipsecode-coverageeclemma

How to show coverage color on the code in Eclipse?


I run my application with coverage mode, but, a file don't have color on the code. Is there a macro (or an other solution) to show color of coverage in Eclipse ?


Solution

  • Your question implies that you have the EclEmma installed in your Eclipse, otherwise I suppose that the coverage mode you mentioned would not be accessible. In case it's installed you should see the EclEmma configuration button near the Run Configuration button in the Eclipse toolbar. It looks like Run button, with a coloured bar at the right bottom corner enter image description here. Click it to see the drop-down list and choose Coverage Configurations.... You will see a dialog that looks like Run Configurations but it has an additional tab marked Coverage. Open it and check the only checkbox found there. enter image description hereAfter it's checked, you can run your code in the coverage mode by pressing the Coverage button in the Coverage Configurations dialog or just by choosing the required configuration from the drop-down list of the EclEmma toolbar button.

    Note that the coverage colors might be not seen in the editor if they are not properly set in the Eclipse preferences (General->Editors->Text Editors->Annotations, Full Coverage, No Coverage and Partial Coverage).

    For more detail see the EclEmma website.