emma

Missing branches when using assertTrue instead of assertNull

廉价感情. 提交于 2020-01-21 01:11:13
问题 In Java/Junit, I need to test for null with some object. There are a variety of ways I can test a condition but I have been using assertTrue for most of my tests. When I check for nulls in an assertTrue, EclEmma states that it is only testing one branch. When I resolve the statement into a variable manually (like setting the result to a boolean and passing it into assertTrue) the code coverage is deemed complete on the assert but not on the variable initializing line. Why is this happening?

Code coverage for Android (calabash-android BDD)

南笙酒味 提交于 2020-01-12 09:35:54
问题 I'm testing my android application using calabash-android which provides it's own "test project", with a script that renames it's package to reflect the app under test, and then uses an InstrumentationTestRunner subclass: adb shell am instrument -w -e class sh.calaba.instrumentationbackend.InstrumentationBackend #{ENV['TEST_PACKAGE_NAME']}/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner I'll accept any answer that allows me to generate a code coverage report similar to Emma

EMMA with Junit, should I be testing with the instrumented classes or java classes?

帅比萌擦擦* 提交于 2019-12-31 07:14:07
问题 I've been going through this tutorial for my ANT Script for emma/junit, it states In the <classpath> element of <junit> , change the locations of your real classes, so that you are pointing at the ${instr.dir} attribute instead of your normal target/classes folder. Here is my emma section from of my build.xml for Apache Ant (pastebin link to full build.xml) <!-- =================================================================== --> <!-- Run the tests with EMMA * depends from compile --> <!--

SonarQube: Multiple unit test and code coverage result files

点点圈 提交于 2019-12-23 21:14:04
问题 we have the following structure in our project: maven project 1 maven project 2 module 1 module 2 module 3 maven project 3 Project 1 and 3 have each one unit test and code coverage result file. They are no problem. Project 2 has three unit test and code coverage result files, one for each module. Now I want to show the unit test and code coverage in SonarQube. But I can only configure one result file (sonar.surefire.reportsPath and sonar.emma.reportPath). How can I configure the three files,

java.lang.VerifyError when using emma / Cobertura on JDK 1.7

拟墨画扇 提交于 2019-12-23 15:21:47
问题 I am facing the exact same issue mentioned in the link below when trying to create a build using Apache Buildr. Testng, Emma, Cobertura, coverage and JDK 7 result in ClassFormatError and VerifyError I tried using the -XX:-UseSplitVerifier option(as below) when testing the artifacts but that doesn't resolve my issue. test.using( :java_args => ['-ea','-XX:-UseSplitVerifier']) Error: Instrumenting classes with emma metadata file /test-client/reports/emma/coverage.em JavaTestFilter: Unable to

How to calculate code coverage in Hudson using emma for a multi-module maven project but only run tests once

倖福魔咒の 提交于 2019-12-23 03:19:42
问题 We have several multi-module projects which I want to run emma against, but I don't want the tests to be run twice, because this results in misleading statistics on the Hudson project home page as unit tests are counted twice. For a single module project, we can ommit the install goal and just use clean emma:emma to run the tests once, is there any way we can test only using emma instrumented byte code and then build & install the project artifacts without running the tests a second time?

Partial EMMA code coverage in Scala Case Class for IntelliJ IDEA 10.5

不羁岁月 提交于 2019-12-22 05:40:43
问题 I'm using IntelliJ IDEA 10.5 with the Scala plugin v0.4.1338 updated on August 14th, and Scala 2.9.0.1. I recently began using the EMMA test coverage utility in IDEA to generate coverage reports. I cannot determine why the constructor line of my Scala case class is only showing partial (yellow) coverage. I have looked in the EMMA FAQs and researched the matter online with no success. Does anyone have any idea how I can reach 100% coverage on a case class? 回答1: case class A(a: Any) generate a

Java test coverage: who covers what?

限于喜欢 提交于 2019-12-22 05:37:13
问题 Is there a tool similar to emma, that reports which test covers a specific implementation ? 回答1: In case you want to see, which tests cover which line of code, you may use Clover that shows you: how many times one line got covered which tests covered line in question To see what one can expect from Clover, here is a screenshot: 回答2: If you don't want to bother paying / setting up Cover, a much simpler way is: remove / disable all breakpoints put a breakpoint on the line that you which to know

How to force Emma code coverage report to ignore some methods?

天大地大妈咪最大 提交于 2019-12-22 01:42:39
问题 Some methods, such as auto-generated getters, setters, equals and toString, are trivial for test. However, if they aren't added into the testing classes, the code coverage percentage (calculated using Emma) is reduced and may crash our system build. How can I force emma to ignore these methods in the code coverage percentage? Regards, Felipe 回答1: From the EMMA FAQ: A feature to allow EMMA users to mark arbitrary methods as excluded from coverage is being considered for future versions. So

Emma does not generate coverage.ec

▼魔方 西西 提交于 2019-12-21 20:10:20
问题 I setup Emma and it used to work for me. Then we had source code changes and now it doesn't generate coverage.ec at all. It does generate coverage.em . Near the end of testing, it has error messages: [exec] INSTRUMENTATION_CODE: 0 [echo] Downloading coverage file into project directory... [exec] remote object '/sdcard/coverage.ec' does not exist BUILD FAILED /var/lib/jenkins/android-sdk-linux_x86/tools/ant/build.xml:1056: exec returned: 1. Line 1056 of build.xml is "{adb}" failonerror="true".