Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Clover mapping for manual test cases

We would like to use the Atlassian Clover for manual testing. It works like a charm, but we would like to see which manual test case covers which source file.

It would be a test optimalization for manual test cases.

It would be very useful to know, because after this we could run only the affected manual test cases again (the manual resource is more expensive then the resource of the ci server :). It would be a mapping between manual test cases and source files.

It is available for JUnit test cases, and we can extract, see the link:

Unfortunately it does not appear in the XML report, it's another feature request. :)

An API would be the best, where we could instruct Clover (for example to pass an id). It would be perfect for any automatic testing tool, for examle Selenium, to give a signal to Clover about test "context". (For example the id of the Selenium test case.)

Is this API exists, or could you give a workaround for this problem?

1 answer

1 accepted

1 vote
Answer accepted

Hi Istvan,

Great question!!

Yes, it is possible to "hack" Clover and measure per-test coverage from manual test cases too. The only thing which has to be done is to "tell" Clover when manual test case starts and ends. The easiest way to provide this information is to write a JUnit test case, with one test method for each manual test case. Clover will add "start test / end test" instrumentation to such methods. Next you have to run this JUnit test together with your application - I suggest using Distributed Coverage feature for this as you will be able to start your application as usual.


1) Write JUnit test case having following features:

  • tests do not start until application under test is launched
  • one test method per one manual test case
  • single test method starts just before corresponding manual test case is started
  • single test method ends just after corresponding manual test case is finishedto


import junit.framework.TestCase;

public class MyManualTest extends TestCase {

    public static void main(String args[]) {
        MyManualTest myTest = new MyManualTest();
        int testNo = myTest.getTestNumber();
        switch (testNo) {
            case 1:
            case 2:

    private int getTestNumber() {
        // e.g. entered by user / read from commandline arg ...
        return 1;

    private void waitUntilYourApplicationStarts() {
        // e.g. "Press any key when ready" / check for existence of some marker file

    private void waitUntilTestEnds() {
        // e.g. "Press any key when test is finished" / check for some marker file

    public void testManualTest1() {
        // Clover will add "test start" here
        // Clover will add "test end" here

    public void testManualTest2() {
        // Clover will add "test start" here
        // Clover will add "test end" here


2) Compile JUnit test case together with your application under test (produce two jars, for instance) with Distributed Coverage feature enabled.

  • flushpolicy = interval or threaded might be needed


<clover-setup initstring="/path/to/my/clover.db" flushpolicy="interval" flushinterval="1000">

3) Run unit test and application:

a) unit test shall be launched with -Dclover.server=true parameter, e.g.

java -cp ... -Dclover.server=true MyManualTest

b) application shall be launched as usual (note that distributed coverage configuration is already compiled into instrumented classes), e.g.

java -cp ... MyApplication



As soon as your tests are finished, you can generate HTML report in which you can track code coverage down to a single source line:

  • open report page for a single class
  • click on "Show Tests" link (just below the summary header); a list of all releated test cases will be shown
  • select test case(s) you're interested in; lines which were hit by selected test case(s) will be highlighted

You could also generate test optimization snapshot file and use SnapshotPrinter to get the "source file-test case" mapping.

It's a brilliant solution! We will try it in the trial period. Thank you very much!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Learn how to request and manage app requests in the Marketplace

G’day everyone! Super exciting news coming from the Marketplace. We have now fully rolled out the ability for end-users to submit app requests to admins directly from within the product! No longer ...

43 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you