Search code examples
javamavenseleniumemma

Measuring code coverage for selenium tests that reside in separate project


I have two separate java maven projects: one is my web app itself and other one is tellurium+selenium automation tests for my web(I moved these tests to separate projects as their code doesn't really belong to the web app project code and doesn't use java classes of my web app, also I want to reuse some parts of those tests for testing my other web apps). Therefore, project where my tests reside doesn't know anything about my web app, except tellurium/selenium conf files(host name, credentials, browser).

So the question: is there any way to measure code coverage of my web app backend that is invoked by my tellurium/selenium tests that reside in separate project?

Thanks in advance. Any help is highly appreciated.


Solution

  • EMMA or cobetura can instrument your classes so that after the test run they create a coverage report.

    http://emma.sourceforge.net/reference/ch02s03.html

    <instr>/instr is EMMA's offline class instrumentor. It adds bytecode
    instrumentation to all classes found in an instrumentation path that
    also pass through user-provided coverage filters. Additionally, it 
    produces the class metadata file necessary for associating runtime 
    coverage data with the original class definitions during coverage 
    report generation.