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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • 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

Per test coverage from integration tests

I have instrumented my web app (a Maven project) source code (NOT tests) using clover and deployed it to tomcat (Initstring=absolute path & flushpolicy = threaded, distributed cov =ON). This acts as a clover client.

Now, i have a different project created for my integration tests (an Eclipse project) and instrumented where coverage.db is pointed to a different location (flushpolicy = threaded, distributed coverage=ON). This acts as a clover server. When i run my "Junit" tests, i was able to see the code coverage but not per-test coverage.

I understand that the clover server & client are using different Initstring values. What should be done to get per-test coverage? Merging dbs?

1 answer

1 accepted

0 votes
Answer accepted

Hi Verand,

You should build both application and tests using the same database. You shall not merge databases - a merged database can be used for reporting only.

In case you'd need to change initstring value at runtime, you can use the -Dclover.inistring=/path/to/clover.db property.

Cheers
Marek

Hi Marek,

If we try to build both application and test (considering them as different independent projects) using the same database, the application clover db will be overwritten by the test clover.db when we build the projects. Do you think it would cause a problem?

Unless you delete the clover.db file Clover should update the file instead of overwriting it

Hi Marek,

I am seeing different. When i built project A from eclipse it created clover.db of size ~1MB and when i built project B from eclipse (initstring is same), it didn't update the file instead it overwrote existing clover.db (new size is ~500KB). I am using clover version #3.2.2. Is there something that i am missing here?

Thanks,

Verand

Oh. You're building your Eclipse project using the Eclipse IDE, right? Can you switch to a command-line build, such as Maven? I'm asking because Clover-for-Eclipse plugin overwrites an existing database.

Yes, I was building my projects from Eclipse IDE. Now, i switched my "dev" project to maven while my "test" project remains to be the Eclipse project.

Followed steps as below to get per-test coverage:

1. First, i instrumented my "test" project using Eclipse IDE => this has generated clover.db file

2. Next, i instrumented my "dev" project using maven => this has updated my existing clover.db bcz my initstring is same and built a war out of it which is inclusive of all my instrumented classes (does not include "test" files).

3. Deployed war to tomcat container (also, distributed coverage ON)

4. Now i executed a JUnit test (distributed coverage ON and communicating to my tomcat client) => generated new coverage files as expected but i could not get per-test coverage.

Something else that i should be doing to achive per-test coverage?

Thanks,

Verand

Suggest an answer

Log in or Sign up to answer
TAGS
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