i am new to clover.
i have installed clover with ant and eclipse and written test cases and i generated the code coverage report successfully .
now i want to attach clover with my web-project in eclipse and if i run with on appache server
then i want to generate code coverage how much code covered when click on any link.
and also it should be increase as i click more links.
if is it possible please give me solution ..
thanks in advance.
Steps you have to perform:
1) Set the flush policy to "threaded" or "interval" (Project Properties > Clover > Flush Policy) and rebuild the whole project.
2) Create a WAR with instrumented classes and deploy to your server. Make sure that clover.jar is available on server's class path.
3) If your application server runs on the same PC as your Eclipse, then use absolute path for initstring (Project Properties > Clover > Initstring > disable "Relative to project root" and choose "custom initstring" toggle).
If not - copy clover.db (coverage.db) produced after compilation to your server and run server with -Dclover.initstring=/path/to/clover.db parameter.
4) Run your server (I guess that using "Run with Clover as..." and your run configuration in Eclipse shall be sufficient).
4) Execute your manual tests
5) Generate report as soon as tests are done. In case when server was running on a different machine, you'll have to copy coverage data files back to your PC.
thanks a lot Marek.
Select "Custom value" radio button. Disable the "Relative to project dir checkbox". Put an absolute path in the "Custom value" text box. Rebuild the whole project.
Coverage recording files will be written into the same directory where coverage.db is located. You shall find file(s) named like 'coverage.dbsome_hash_code'.
Open the Clover's Coverage Explorer view. You will find the "Run new report" button there. Choose an HTML report, for instance.
thanks Marek to give your valuable time..
got it... now i have select Custom value radio buttion ...and given the path as above selected directory..
now how i know it is generating new code coverage report,
and how to open Clover's Coverage Explorer view ..??
is you talking about eclipse ide 's Clover's Coverage Explorer view.
thanks for reply and showing intrest.....Marek.
may be the questions which i am asking can be stupid ...but
reply me Marek and let me confirm one thing that this cofiguration will generate
report dynamically when i click on any link after depolying war file...?
i want to confirm one thing that is.
i add clover in a sample project,have class LoginAction and then i add another class LoginActionTest and i have written the test cases.... if i Run With Clover as
junit Test then it generated the the report and aslo if i upload the war file on server i can see report through run new report.
but now i have my main project which have action,form,utility class and have not any test class.
so how i run this project to generate report using Run with Clover as-> java applet or java application or junit test.
so question is that is it necessary that i write test cases for class or
is it possible without them to generate code coverage report ?? means if i click on gui link then it should tell how much code executed which it tells with test cases.
1) Do you want to have just global, aggregated coverage from both JUnit runs and manual tests?
2) Do you want to have per-test coverage from manual test, in which clicking on a single GUI link is treated as a new test?
ad 1) In this case, it should already work for you. In other words, you can run application instrumented by Clover multiple times, no matter whether you're running it via unit tests or via normal application run.
New coverage recording files are being written to a directory where clover.db is located.
So when you generate HTML report after your JUnit + manual test, you shall be able to see code coverage from both (aggregated).
ad 2) In such case this is more tricky, because you have to instruct Clover what is a test case boundary. It could be achieved in two ways:
a) if you have some dedicated class (or classes) which handle URL clicks, then you could use <clover-setup> with <testsources> option to tell Clover what classes/methods are boundaries of your test cases.
For instance, if your application has controller classes named AbcController and each of them has methods named handleRequestXyz, the <clover-setup> would look like:
<clover-setup> <testsources dir="..."> <testclass name=".*Controller"> <testmethod name=".*handleRequest.*"> </testclass> </testsources> </clover-setup>
b) if you cannot find such class/method pattern, you could write an artificial JUnit test class with test methods named as your test cases, use a distributed coverage feature and call these test methods on URL clicks.
thanks Marek to give me detail information.
i alredy worked on ad 1) and it was fine ...
but now i want to follow ad 2) -> a). because don't want to use artificial junit test class as in 2 -b)
my apllication is developed in struts 1.3
and i have to invoke contextpath/abc.do
and each class have have execute(.....) function.
i alredy added the clover through eclipse gui.
should i use build.xml ...?if yes should i again configure
clover.jar in build.xml
and also how to use covrage.db and clover setup for class and request method as i told for link like ..localhost://abc/xyz.do
Open Project Properties > Clover > Test Classes tab.
Select "Assume all classes matching the following Ant-pattern set are tests ..." toggle.
Enter proper include pattern.
Clover will instrument code in such way that all methods in classes will be marked as test methods (including your 'execute' methods). Having too much actually should not be a big deal.
Alternatively, use Ant and build.xml to fine-tune test pattern with regular expressions for classes and methods.
Statuspage customers logged more than 194 years of collective incidents in 2018. That’s a whopping 87% increase from the 104 years logged in 2017 , and we aren’t even through December yet....
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs