How do you get code coverage to work?
Ok.
I've added the emma jar file to my project and enabled coverage in the tests. When I run the test, the emma messages appear in the console, but I can't find a way to display them.
I haven't got a menu item in the for displaying it anywhere.
请先登录再写评论。
"View -> show code coverage information" is probably what you are looking for.
Thanks! ... :-D
Have you got a key for the colours used in the gutter?
And can you change them?
No, haven't had time for this yet, sorry:(
No problem. Easy enough to work out ... but always nice just for completeness ... :)
I've done all that, but, still, no coloring shows up. Any ideas where to look next?
Well, you need to provide a step-by-step description of what you we doing, and what IDEA was telling you at each step.
Have you included the emma.jar file as part of your project?
I included emma.jar in my project
I enabled code coverage in my JUnit test configuration
I run my tests.
I select "show code coverage info"
The resulting window shows one choice, from the just-completed test run
I select it.
After that, no coloring, no percentages in the packages view. No visible sign of any coverage information that I can see.
Is there a *.es file stored in $IDEA_HOME/system/coverage directory?
No, there are no files at all in $IDEA_HOME/system/coverage.
OK, then I suppose there was a message in run console saying something like "No coverage gathered"?
No, there is no such message. Here's what's on the console:
-
C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\bin\java -enableassertions -Dlog4j.configuration=file:conf/log4j.xml "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 5368\lib\emma-agent.jar=-o \"C:\Documents and Settings\anders\.IntelliJIdea60\system\coverage\]]>.es\"" -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 5368\bin" -Dfile.encoding=windows-1252 -classpath "C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\charsets.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\deploy.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\javaws.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\jce.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\jsse.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\plugin.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\rt.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\ext\dnsns.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\ext\localedata.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\ext\sunjce_provider.jar;C:\cygwin\usr\local\tools\i686_win32\jdk1.5.0_07\jre\lib\ext\sunpkcs11.jar;C:\nimbus\main\server\build\testclasses;C:\nimbus\main\server\build\classes;C:\nimbus\main\server\lib\annotations.jar;C:\nimbus\main\server\lib\antlr.jar;C:\nimbus\main\server\lib\asm.jar;C:\nimbus\main\server\lib\asm-attrs.jar;C:\nimbus\main\server\lib\c3p0.jar;C:\nimbus\main\server\lib\cglib.jar;C:\nimbus\main\server\lib\commons-beanutils.jar;C:\nimbus\main\server\lib\commons-cli.jar;C:\nimbus\main\server\lib\commons-codec.jar;C:\nimbus\main\server\lib\commons-collections.jar;C:\nimbus\main\server\lib\commons-dbcp.jar;C:\nimbus\main\server\lib\commons-digester.jar;C:\nimbus\main\server\lib\commons-httpclient.jar;C:\nimbus\main\server\lib\commons-logging.jar;C:\nimbus\main\server\lib\commons-pool.jar;C:\nimbus\main\server\lib\dom4j.jar;C:\nimbus\main\server\lib\ehcache.jar;C:\nimbus\main\server\lib\ejb3-persistence.jar;C:\nimbus\main\server\lib\hibernate.jar;C:\nimbus\main\server\lib\hibernate-annotations.jar;C:\nimbus\main\server\lib\hsqldb.jar;C:\nimbus\main\server\lib\javassist.jar;C:\nimbus\main\server\lib\jaxen.jar;C:\nimbus\main\server\lib\jboss-archive-browsing.jar;C:\nimbus\main\server\lib\jdbc-stdext.jar;C:\nimbus\main\server\lib\jetty.jar;C:\nimbus\main\server\lib\servlet.jar;C:\nimbus\main\server\lib\jetty-util.jar;C:\nimbus\main\server\lib\jta.jar;C:\nimbus\main\server\lib\junit.jar;C:\nimbus\main\server\lib\log4j.jar;C:\nimbus\main\server\lib\mysql-connector.jar;C:\nimbus\main\server\lib\quartz.jar;C:\nimbus\main\server\lib\slf4j.jar;C:\nimbus\main\server\lib\spring.jar;C:\nimbus\main\server\lib\spring-mock.jar;C:\nimbus\main\server\wrapper\windows\lib\wrapper.jar;C:\nimbus\main\server\lib\xalan.jar;C:\nimbus\main\server\lib\xercesImpl.jar;C:\nimbus\main\server\lib\xml-apis.jar;C:\nimbus\main\server\lib\acegi-security.jar;C:\nimbus\main\server\lib\acegi-security-tiger.jar;C:\Program Files\JetBrains\IntelliJ IDEA 5368\lib\emma.jar;C:\Program Files\JetBrains\IntelliJ IDEA 5368\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 @C:\DOCUME1\anders\LOCALS1\Temp\idea_junit50511.tmp
EMMA: collecting runtime coverage data ...
EMMA: runtime controller started on port
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
100 test classes found in package ''
EMMA: package [] contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
EMMA: package contains classes without full debug info
Process finished with exit code 0
-
Does it help if you change the name of the configuration from ]]> to something meaningful?
Where do I change that? The name of my test configuration is 'unittest', so I'm not sure where the is coming from. The ]]> is almost certainly the problem, since that's not a legal filename.
OK, then I'll most probably be able to fix it by next EAP. It's already 11 PM, and it's football time here in Europe:)
>It's already 11 PM, and it's football time here
I hear that!
OK, I've fixed the problem. Till next EAP you can play with coverage support running tests for non-default packages.
Also you may try setting up the filters to instrument your classes only. This way you will get a much better tests startup performance.
Ah, after supplying a non-default package, the coverage information shows up as expected.