code-coverage

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?

Why gcc 4.1 + gcov reports 100% branch coverage and newer (4.4, 4.6, 4.8) reports 50% for “p = new class;” line?

筅森魡賤 提交于 2020-01-19 03:28:05
问题 When gcc 4.1 (using gcov) next line: p = new Class; is reported as 100% branch coverage <-- THIS IS OK for me. Why using gcc 4.4 and higher same line is reportted as: [+ -] p = new Class; (50% branch coverage)... <-- THIS IS a problem for covering 100% !!! Can I set any extra options to newer gcc versions in order to report same branch coverage as gcc 4.1 for single lines as "p = new Class;". Thanks in advance. 回答1: Solved ! We have some C/C++ files with and without exceptions handling, so

Code coverage in VS2013 show coverage of Test and not actual code

蹲街弑〆低调 提交于 2020-01-17 15:23:19
问题 I am following article for code coverage in VS 2013 http://msdn.microsoft.com/en-us/library/dd537628.aspx. It shows coverage of Test and not actual code. I have selected unit test from Test explorer and click on Analyze Code Coverage -> Selected Test . Code coverage window is opened up at the bottom and It shows dll of unit test and its coverage and actual dll with code coverage is not shown. Also, I looked into article http://msdn.microsoft.com/library/jj159523.aspx. Copied pdbs and dll into

Code coverage in VS2013 show coverage of Test and not actual code

别说谁变了你拦得住时间么 提交于 2020-01-17 15:23:11
问题 I am following article for code coverage in VS 2013 http://msdn.microsoft.com/en-us/library/dd537628.aspx. It shows coverage of Test and not actual code. I have selected unit test from Test explorer and click on Analyze Code Coverage -> Selected Test . Code coverage window is opened up at the bottom and It shows dll of unit test and its coverage and actual dll with code coverage is not shown. Also, I looked into article http://msdn.microsoft.com/library/jj159523.aspx. Copied pdbs and dll into

Cobertura code coverage for Freemarker auto-generated code

不羁的心 提交于 2020-01-15 10:47:49
问题 I am trying to set up Cobertura code coverage on a project which includes auto-generated code, created from templates using Freemarker (explicitly, using the fmpp maven plugin). I then have unit tests for those auto-generated classes. However, these unit tests are not being considered by Cobertura when calculating code coverage. The auto-generated classes appear in the report, but the coverage on those classes is always 0%. First, is there some configuration for Cobertura that I'm missing?

Open source code coverage libraries for JDK7?

前提是你 提交于 2020-01-14 22:46:40
问题 It seems like both Cobertura and Emma are outdated now. They don't cope with Java 7 byte code. Running instrumented tests with Cobertura results in verification errors java.lang.VerifyError: Expecting a stackmap frame at branch target 41 in method ..... A shame really because Cobertura really is cool and well-supported. For Java 6 byte code that is. But now I'm looking for a replacement. Preferably having both Maven and Jenkins support. Are there any people in here using a code coverage

Remove auto generated exception code from coverage report

丶灬走出姿态 提交于 2020-01-14 14:23:26
问题 Let's start with a minimal working example: main.cpp: #include <iostream> #include <string> int main() { std::cout << "hello " + std::to_string(42); return 0; } I compile this code using the following flags: [g++/clang++] -std=c++11 -g -Og --coverage -Wall -o main main.cpp clang 4.0.1 gcc 4.8.5. I get only 50% code coverage, since the compiler generates exception code, which is not executed, as explained in another stackoverflow question. The problem is that disabling exceptions via -fno

cobertura graph in hudson

有些话、适合烂在心里 提交于 2020-01-14 13:55:50
问题 is there a way to have the cobertura test coverage graph be shown on the front page of a project, similar to the test trend graph? I'd like to have that displayed next to the coverage graph. Any help would be appreciated. Thanks. 回答1: Hudson has a set of plugins which you can use to extend its functionality to best suit to your requirements. One of this plugins is the Cobertura Plugin. Once you've installed it, in each of your project's configuration a new Post-Build action will appear with

How do I collect coverage from child processes when running `cover -test`, and not otherwise? (Devel::Cover)

只愿长相守 提交于 2020-01-14 10:42:37
问题 (I think I've seen the answer to this, but I can't find it again. The closest I have come across is this question). I am hacking on prt and am trying to get full coverage data for my changes. Some of my new tests call system($^X, 'prt', ...) to run child processes. I then test the output of those processes. However, Devel::Cover does not collect coverage data in the child processes. How do I collect that data, without causing Devel::Cover to run when I do a regular make test ? Currently I

Why this line is not covered? Xcode code coverage

元气小坏坏 提交于 2020-01-14 09:51:49
问题 I'm experiencing an issue with the report of code coverage in Xcode. As you can see from this screenshot: On the left tab, line 58 is "touched" from the break-point, and on the right tab, the test passes. While on the right tab, I'm running only the test on line 37. Why does Xcode sign the line 58 in red, as not covered? Line 53 is not "touched" (if I set a break-point there). Using SQLite as a database. The entire project is available here. EDIT : Adding code: Test.swift func testAddFuelFail