Menu

Is it possible to run Emma by java code ?

Developers
Coral
2007-05-16
2013-05-09
  • Coral

    Coral - 2007-05-16

    Hi all,
       Emma is a really nice tools I very like it. So I wanna use it in different way of the project. In my testing project, I wanna run the EMMA directly by java code. I means use java code to generate code coverage for the given impl and test project. I have checked the tutorial and some parts of source code. But I didn't find any good solution for it.
       Is it possible ? Are there some API for the running EMMA has been defined in EMMA.JAR? 

       Thanks for any reply,

    Best Regard,

     
    • Vlad Roubtsov

      Vlad Roubtsov - 2007-05-16

      Yes, it is. All EMMA ANT tasks and command line tools are merely wrappers around "processors" (extensions of com.vladium.emma.Processor). You can invoke all of EMMA tool functionality programmatically:

      1. get an instance of the processor via its create() method
      2. set its properties
      3. execute run()

      There are 5 processors: CtlProcessor, InstrProcessor, MergeProcessor, ReportProcessor, RunProcessor. I suggest using the codebase in branch 2.1, this design pattern is polished there and there is more javadoc.

       
    • Coral

      Coral - 2007-05-17

      Thanks for your reply!
      The source code version I checking is emma-2.0.5312 release. That's the Latest File Releases on sourceForge. But it's almost no any javadoc. It's difficult for me to understand how you design it. You suggest me to using the codebase in branch 2.1, But there are not source code of this release on sourceForge. I tried to use CVS to download the source code but I can't get it because of the timeout error every time. Would you mind to check whether the CVS service is OK or not? Thank you.

      Thanks for your suggestion! It's really helpful!

       
    • Smoke

      Smoke - 2008-10-03

      Vlad: I think what's deceptive is that in the docs for the source code, you note that the various Processor classes are made public to get around the Java invocation bugs (at least, that was the note I was reading on the versions posted at http://kickjava.com/src/com.vladium.emma.index.htm\).  That implies that once those bugs are fixed, the Processor classes aren't going to be around much longer.

      Do you think you could perhaps do a guide detailing how EMMA plug-in developers can programatically invoke EMMA?  Your usage documentation is of a high standard and if we can get something similar as a guide to how to send information into EMMA, how to capture its output messages and so forth it would be a massive help in getting more EMMA plugins out there.

      (BTW: congrats on writing the standard coverage tool! :)

       

Log in to post a comment.