Hi,
I have the following scenario.
I execute tests, which uses/calls instrumnted jar's classes methods which are located on Machine2
Is it possible to give the <cloverDatabase>C:\coverage.db</cloverDatabase> path in pom.xml of delvopers' projects' pom xmls with host IP, for example http://{machine1_IP}/coverage.db, so the results of methods calls could be recorded in coverage.db file which is located on Machine1.
If it is possible, can you please tell me, how can it be done?
Thanks in advance,
Sevak
It's a great question! Thanks for asking it.
Hi Sevak,
It's not possible to use an URL for the <cloverDatabase>. However, I don't think that you actually need such feature at all.
From what you wrote, three scenarios come into my mind. I'm not sure which one (or maybe all?) fits your needs:
Scenario 1: separation of compilation, testing and reporting.
It's perfectly fine to run compilation (mvn clover2:setup compile/compileTest) on one machine, next to run tests (mvn test/verify) on another machine (or a number of machines, like agents in Bamboo) and next collect all coverage results from tests machines and run reporting (mvn clover2:clover) on yet another machine.
The only thing you have to take care about in such scenario is to copy clover.db and coverage recording files to proper machines / locations. You can use maven-antrun-plugin for this purpose, for instance.
Scenario 2: separation of application and test code execution.
Clover supports also a Distributed Coverage feature. It means that, for instance you can launch your unit tests from one machine (typically, it's a build server) and these units tests will call application logic running on another machines (typically, it's a test machine with an application server running on it). Clover is able to not only record global coverage, but also to track per-test coverage in such distirbuted environment.
Again, it's necessary to provide clover.db for test execution and to collect coverage recording files (from test machines) into a single place for report generation.
Scenario 3: separation of projects and modules during compilation.
What I have in mind is that you can compile every project or module separately, having a separate clover.db for each of them. It's perfectly OK to run such separately instrumented modules together - not only on the same machine, but also in the same JVM - each instrumented class will report coverage to the database it was instrumented with.
I recommend a following lecture:
One side note. You wrote:
so the results of methods calls could be recorded in coverage.db file
Coverage results are not being written to the clover.db file. A database does not change during test execution. Clover will create new coverage recording files aside the DB file. They're named like:
Cheers
Marek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your detailed answer
Let me decribe our scenario in details.
What I try to explain is that DEV instrumented jars(containing .classes) are located on one machine_B, meanwhile DEV sources(.java) are located on another machine_A.
In instrumented jars, there is information about the path of code sources, right?
In my case this path will be broken since after instrumentation, I moved jars to another machine.
And in order the report to be generated, source codes(.java) files' location path is necessary.
In this situation how can I deal?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The most important thing is that you need to copy clover.db together with jars. When you execute instrumented code it requires access to clover.db (access to sources is not necessary).
Also when you genere report, you may disable acess to source code or configure a different path. For some more details see: https://answers.atlassian.com/questions/240733/are-source-files-mandatory-for-clover-report
Cheers,
Jacek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.