How to get code coverage data using jacoco agent when the tests and the actual code are two different projects
I have all the functional tests as a separate gradle project ,say A , and the actual code is another gradle project B .
I want to have code coverage data with jacoco agent for my testing project . But since the actual code is a different project , I want that when I run my tests i.e A , the jacoco agent should know that the code is B .
Is there a way I can interlink the testing project to run code coverage when code is actually a different project ?
See also questions close to this topic
Refreshing gradle project removes source folders
I am using eclipse java photon, I have installed the latest gradle and the gradle project is inside my android project, whenever i refresh my gradle project all the source folders go back to being normal folders, in my build.gradle file I have applied the eclipse plugin and I have only one dependency which is 'com.android.volley.....' needed for my android project, I am not getting another issue, not having source folders s not allowing me to run my android project, completely new to gradle and I can't find any other solution.
Error while building an android app using flutter and vscode
I am trying to build an android app with flutter and vscode but I am continuously getting an error.
Launching lib\main.dart on Micromax Q427 in debug mode...
Error running Gradle: Exit code 1 from: E:\Flutter\mytestapp\android\gradlew.bat app:properties: Starting a Gradle Daemon, 2 busy Daemons could not be reused, use --status for details Download https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.0.1/builder-3.0.1.jar Download https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar Download https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'android'.
Could not resolve all files for configuration ':classpath'. Could not download builder.jar (com.android.tools.build:builder:3.0.1)
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.0.1/builder-3.0.1.jar'. Premature end of Content-Length delimited message body (expected: 26945712; received: 8650688 Could not download intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1) Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar'. Premature end of Content-Length delimited message body (expected: 8234273; received: 6553552
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 14m 39s Please review your Gradle project setup in the android/ folder. Exited (sigterm)
I have tried many solutions but nothing worked also flutter doctor shows no issue and I am not able to understand why I am getting this error while building my app.
I have also asked this query in github but got no reply so far here is the link: https://github.com/flutter/flutter/issues/19614
Gradle multi-project dependencies with snapshots
I have a multiple project build with flat paths, e.g.:
settings.gradle: includeFlat 'projA','projB','projC'
There are about 20 different sub-projects with all sorts of different interdependencies. I'd like gradle to handle the dependencies but I don't want to tie the entire project together as a monolith, I want to keep these as individual uploads which go into our artifact repository (Nexus) with their individual sub-project versioning.
The problem is, if I call out the dependencies via the compile dependency, i.e.:
projA-build.gradle: compile project(":projB")
Then everything compiles and the artifacts are uploaded just fine but at runtime I get an error such as:
Could not resolve all dependencies for configuration ':runtime'. Could not find master:restclient:4.0-SNAPSHOT.
Though it's uploaded to Nexus correctly somehow the dependency is built in with that "master" in the artifact coordinates.
Am I going about this the wrong way or have the wrong expectations?
Android Native Unit test Coverage for cpp via gcov and lcov
I am trying to run
gcovon android platform for unit test coverage. I am able to generate
.gcdafile successfully via the flags.
LOCAL_CFLAGS += -g -O0 --coverage -fprofile-arcs -ftest-coverage LDFLAGS += -fprofile-arcs -ftest-coverage LOCAL_LDLIBS := --coverage
And I have made sure
gccare same version in my case 4.9 but I get this weird
error:file.gcno:version '402*', prefer '409*'
BR M S Kha
- What's the content of Python coverage data files?
Algorithm for fast data/time coverage check
I am working on a database containing ~50 million rows, each holding a timestamp and a value. The timestamps of the stem from a scope of about 3 years, but sometimes there are timeframes missing in between, ranging from 10 minutes of data lack to several weeks. I want to find these gaps, to see how well the data covers the recording period, and am now looking for a suitable algorithm to do so.
What I have been trying is to start with the oldest record and then go to the next earlier record and so on, until the most recent record is reached. If the gap between two neighboring records is higher than a certain treshold time, then it is counted as a gap. However, this requires the algorithm to check every single record, which takes a lot of time.
This is why I want to ask if there is a more efficent way, possibly heuristic way, of doing this? The data is in MySQL, in case thats relvant.
How to generate code coverage for android module
I am using jacoco for code coverage it is working fine and it is generated coverage folder inside reports when i run createDebugAndroidTestCoverageReport command through gradle. But my application is having module in this module i have android tests i want to try to run same command but it didn't generate coverage folder inside reports. So how to generate coverage folder inside reports for android library module. createDebugAndroidTestCoverageReport
Coverage As -> JUnit Test in Eclipse Oxygen reports NullPointerException
When I run a JUnit 4 test using Code Coverage from within the Eclipse IDE, All I get is a dialog saying "An internal error occurred during: "Launching AlgebraicNumberTest". java.lang.NullPointerException"
The same JUnit test runs fine under the debugger or using just plain run or from a gradle command line. Code coverage works fine when running the main application rather than JUnit tests. I just can't get Code Coverage and the JUnit test to work together. They were working together on this project at one point several months ago. I don't know what's changed.
I'm using JUnit 4.12 and Eclipse Oxygen.3a Release (4.7.3a).
* * * UPDATE * * *
I found the Eclipse log file at %USERPROFILE%\eclipse-workspace.metadata.log.
Here's the exception detail from the log file:
!ENTRY org.eclipse.core.jobs 4 2 2018-07-17 20:43:33.964 !MESSAGE An internal error occurred during: "Launching AlgebraicNumberTest". !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:204) at org.eclipse.visualvm.launcher.java.VisualVMJUnitDelegate.launch(VisualVMJUnitDelegate.java:20) at org.eclipse.eclemma.core.launching.CoverageLauncher.launch(CoverageLauncher.java:94) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Maven Sonarqube Jacoco 0 coverage
I have a multi-module maven project and I am seeing 0% coverage when I go into Sonarqube, but seeing proper coverage when I view the Jacoco reports in
Here is the relevant part of my pom.xml
<plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.7.201606060606</version> <executions> <execution> <id>jacoco-initialize</id> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>jacoco-site</id> <phase>package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins>
Here is my
## Sonar Scanner Settings File # SonarQube info sonar.host.url=xxx # Project config sonar.language=java sonar.projectKey=project sonar.projectName=project sonar.projectVersion=1.0-SNAPSHOT sonar.github.repository=lendup/project sonar.sources=module1/src/main/java,module2/src/main/java sonar.tests=module1/src/test/java,module2/src/test/java sonar.sourceEncoding=UTF-8 # Test Reports sonar.junit.reportPaths=module1/target/surefire-reports,module2/target/surefire-reports sonar.jacoco.reportPaths=module1/target/jacoco.exec,module2/target/jacoco.exec ## Java sonar.java.binaries=module1/target/classes,module2/target/classes sonar.java.source=1.8
My project does not use the maven surefire plugin, instead it is installed manually to the local repo like
mvn install:install-file -Dfile=assets/surefire-junit4-2.17.jar -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit4 -Dversion=2.17 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true