How the teamcity coverage report can present the integration test relative classes?

I used teamcity as my ci tool ,ant as my build tool,weblogic 9.2.3 as my app server,oracle as my db server.My project contains many modules such as war,ear.....Now i have an integration test to test a http url service.It start from posting a http message ,and then check the database data to verify whether the service is ok or not.So far,all is fine but the integration test can not involved in the teamcity coverage report,i tried many solutions and can not get the result.

Can anybody help me?to cofigure the Coverage instrumentation parameters in teamctiy console? or to configure others?
6 comments
Comment actions Permalink

Hello,

  Unfortunately, TeamCity 4.x doesn't support code coverage integration for real integration tests with application servers involved out of the box.

  TeamCity does the following when EMMA coverage is enabled:

  - instruments class files after their compilation (results in coverage.em files)
  - when non-integration tests are run, coverage is collected (this results in coverage.ec files)
  - when build is finished, coverage report is created based on coverage.em + coverage.ec files.

  Some details on how TeamCity's EMMA coverage works are described in our documentation.

  In fact, the approach used by TeamCity to instrument java classes allows to collect coverage information for integration tests as well.
  We didn't do this ourselves, but there are some hints in EMMA FAQ regarding this.

  Hope this helps,
  KIR

0
Comment actions Permalink

Thanks Kirill,you give me the confidence.

I will try in detail by what you said.

You mean that my approach for integration test is not right ,right?
I have seen the emma doc ,and i trust the offline mode in emma can resolve my problem,but what confused me is how to do for me?
If you give me more hints ,i'll appreciate much.

0
Comment actions Permalink

Hello,

  TeamCity already uses offline mode to instrument classes (and it does instrumentation right after javac execution).
  If you use javac to compile classes of your web-app, TeamCity should instrument classes automatically.

  What you have to do, I believe, is to put emma.jar from TeamCity's buildAgent (plugins/coveragePlugin/lib/emma.jar) to your application context. As stated in EMMA's FAQ, you should copy the emma.jar to JDK, which is used to start app server.

  You should also shutdown application server before build finishes. In this case, coverage.ec file will be created and will contain runtime coverage data.

  Another thing to do is to ensure that test classes for integration tests are not instrumented with EMMA. You can exclude files from instrumentation with -ix parameters to EMMA (this can be specified in the TeamCity coverage configuration page). Otherwise coverage.ec from integration tests themselves may override coverage.ec from the app server.

  Please note, all of the above are not-tested thoughts.

  Hope this helps,
  KIR

0
Comment actions Permalink

Today i have seen many doc and Q/A .then i looked my weblogic domain,i found the coverage.ec file ,it marked all my integration test classes.
and when i start my weblogic server ,the port 47653 was listening.
So i use this .ec file and .em file created before and user emma ctl to create report ,but get such error :
EMMA: processing input files ...
EMMA: 2 file(s) read and merged in 224 ms
com.vladium.emma.EMMARuntimeException: [CLASS_STAMP_MISMATCH] runtime version of class [com.bitfone.smartdm.selfreg.service.DMCareServiceFactory] in the coverage data is not consistent with the version of this class in the metadata, possibly because stale metadata is being used for report generation.
        at com.vladium.emma.report.ReportDataModel.getView(ReportDataModel.java:95)
        at com.vladium.emma.report.AbstractReportGenerator.initialize(AbstractReportGenerator.java:210)
        at com.vladium.emma.report.html.ReportGenerator.process(ReportGenerator.java:85)
        at com.vladium.emma.report.ReportProcessor._run(ReportProcessor.java:255)
        at com.vladium.emma.Processor.run(Processor.java:88)
        at com.vladium.emma.report.reportCommand.run(reportCommand.java:139)
        at emma.main(emma.java:50)

i am sure i used the same classes.The problem is resolving.

Another question ,if i resolved up question,how i can do to merge the report to teamcity
?

========additional==========
i see in my teamcity/buildagent/work/15a5acdc6db7067d/, there are coverage.ec and coverage.em files.and i find teamcity using the two file to create coverage report.

so i used another coverage.ec in my weblogic domain and coverage.em in teamcity/buildagent/work/15a5acdc6db7067d/ to create coverage report,it leads up error.

what can i do to merge new coverage.ec to teamcity report?

0
Comment actions Permalink

Thanks Kirill.
All is fine,and i resolved all the problem occured.

0
Comment actions Permalink

Sorry for the delay. The question is still actual with latest TeamCity release?

Kind regards,
Marina

0

Please sign in to leave a comment.