Re: [java code coverage] Is there any document/blogpost describing the step by step process of JaCoCo offline instrumentation in Android

2020-01-14 Thread testerguy1232
The testing tool only uses the android apk, not the source code. Can I 
still use the Java agent? If so, how do I instrument the apk using Java 
agent? 
Is there any sample project available that used java agent to instrument 
the apk? I am really sorry if I am asking dumb questions.

Regards,
Sam  

On Monday, January 13, 2020 at 11:20:26 PM UTC-6, Marc R. Hoffmann wrote:
>
> Hi,
>
> why do you think you need offline instrumentation? Using the JaCoCo Java 
> agent is very convenient and documented here:
>
> https://www.jacoco.org/jacoco/trunk/doc/agent.html
>
> Regards,
> -marc
>
> On 14. Jan 2020, at 01:05, tester...@gmail.com  wrote:
>
> Dear All,
>
> I am trying to use JaCoCo to measure the coverage achieved by an automated 
> testing tool that uses appium and python. 
> I checked the JaCoCo official webpage for offline instrumentation but 
> didn't understand the process properly. I would be really grateful if 
> someone can give a step by step procedure to do the JaCoCo offline 
> instrumentation in Android. 
> A blog post on this topic would be really helpful to the new users.
>
> Thank you!
>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jac...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/142163e8-fe60-4a0a-8f41-e186ee1c51d8%40googlegroups.com
>  
> 
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/5113efe9-9b9e-4ef3-b519-6ef6588820cf%40googlegroups.com.


Re: [java code coverage] Zero coverage when used both manually and maven plugin

2020-01-14 Thread MLK
Hi Marc,

I even tried with "output=file" but it only creates a file and doesn't show 
any stats when a report is generated. The issue that I'm having is although 
the exec file is created or dumped through a port, either one doesn't 
include any coverage stats. I doubt that the manual agent is not capturing 
the requests due to jacoco maven plugin configuration done through the pom 
file.



On Tuesday, January 14, 2020 at 2:44:43 PM UTC+5:30, Marc R. Hoffmann wrote:
>
> Hi,
>
> if you want to create a exec *file* use output=file (which is default and 
> can be omitted).
>
> Regards,
> -marc
>
>
> On 2020-01-14 09:03, MLK wrote:
>
> Hi All, 
>  
> I used the jacoco agent(jar v0.8.4)  in an application server to get the 
> functional test coverage. This application code already had the jacoco 
> maven plugin configured (in pom.xml  v0.8.1) to measure the unit testing 
> coverage. The .exec file which was dumped using the agent didn't had any 
> stats so I removed the maven plugin configuration , redeployed the 
> application and then new .exec file was showing the coverage stats.
>  
> This is the command I used to bind the agent,
> JAVA_OPTS="$JAVA_OPTS 
> -javaagent:/home/user/lib/jacocoagent.jar=address=*,port=,destfile=/home/user/jacoco-it.exec,append=true,output=tcpserver"
>  
> can this be happened due to different jacoco versions and any idea on how 
> to implement both methods? 
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jac...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/fd3f3e57-e692-4d13-b586-620cd7b25786%40googlegroups.com
>  
> 
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/b278d7d4-6005-41df-858a-3ce88d177af2%40googlegroups.com.


Re: [java code coverage] Coverage report showing very different numbers between operating systems

2020-01-14 Thread Marc Hoffmann
Wild guessing without knowing your exact setup: Maybe separation of
modules eliminated "cross coverage". I.e. a.test only counts for a not
for b. 

To debug this you can: 

* drill down both coverage reports and search for specific discrepancies


* Use our command line tool to inspect and diff the content of the exec
files (execinfo, https://www.jacoco.org/jacoco/trunk/doc/cli.html) 

Regards,
-marc 

On 2020-01-14 09:56, 'Philip Smith' via JaCoCo and EclEmma Users wrote:

> Hi Marc, 
> 
> The moving between machines was simply being done to try and understand the 
> discrepancy we were seeing between our windows and unix based platforms; it 
> is not something that we would normally be doing.  
> This issue actually came to light as we had our coverage set to 90% in our 
> jacocoTestCoverageVerification task (see belo). On windows this was fine as 
> based on the 3 *.exec files we had a reported coverage of 90%, but when we 
> ran the job on the CI server (linux) the build failed as the verification 
> task was only reporting 84%. 
> 
> So when either the jacocoTestReport or jacocoTestVerification task runs, 
> based on what you have said above, does it also reference the local class 
> files as well as the *.exec files to produce the answer. I had assumed 
> perhaps wrongly that the only thing used at this point was the exec file? 
> 
> Really just trying to understand why a build process that produces 3 *exec 
> files, due to 3 separate test targets, can produce widely different answers 
> between the operating systems. Before when we had all the tests running under 
> the single target we had consistent results? 
> 
> val jacocoReportLocations = fileTree("/build/jacoco") { include("*.exec") }
> 
> val jacocoTestReport by getting(JacocoReport::class) {
> executionData(jacocoReportLocations)
> reports {
> xml.isEnabled = true
> }
> afterEvaluate {
> classDirectories.setFrom(files(classDirectories.files.map {
> fileTree(it) {
> exclude(coverageExclusions)
> }
> }))
> }
> }
> 
> val jacocoTestCoverageVerification by 
> getting(JacocoCoverageVerification::class) {
> executionData(jacocoReportLocations)
> mustRunAfter("jacocoTestReport")
> violationRules {
> rule {
> limit {
> counter = "LINE"
> minimum = "0.90".toBigDecimal()
> }
> }
> }
> afterEvaluate {
> classDirectories.setFrom(files(classDirectories.files.map {
> fileTree(it) {
> exclude(coverageExclusions)
> }
> }))
> }
> }
> 
> On Tue, Jan 14, 2020 at 5:56 AM Marc Hoffmann  
> wrote: 
> Hi Phil, 
> 
> are you moving exec files between builds and/or machines? Please note that 
> JaCoCo requires the exact same class files at execution and analysis time. 
> See our documentation for background information: 
> 
> https://www.jacoco.org/jacoco/trunk/doc/classids.html 
> 
> Regards, 
> -marc 
> 
> On 10. Jan 2020, at 18:16, smitp33 via JaCoCo and EclEmma Users 
>  wrote: 
> 
> Hi, 
> 
> We have noticed that a *.exec file generated on windows / mac are producing 
> reports with very different coverage numbers. 
> 
> On windows the *.exec file is showing 90% whilst on mac it is showing 84%. If 
> we take the *.exec file from the mac machine and put it onto the windows 
> machine and then generate the report again from this file it shows 91% - so 
> closer, but still not a match. 
> 
> Wondering what we can do to try and investigate this further? 
> 
> If it helps at all we are running multiple test tasks that we are then trying 
> to combine into an aggregate report ... 
> 
> val jacocoReportLocations = fileTree("/build/jacoco") { include("*.exec") }
> jacocoReportLocations.files.forEach {
> println(it)
> }
> 
> val jacocoTestReport by getting(JacocoReport::class) {
> executionData(jacocoReportLocations)
> reports {
> xml.isEnabled = true
> }
> afterEvaluate {
> classDirectories.setFrom(files(classDirectories.files.map {
> fileTree(it) {
> exclude(coverageExclusions)
> }
> }))
> }
> }
> 
> and the dir that sources the files has the following in it ... 
> 
> ..\build\jacoco\contractTest.exec 
> ..\build\jacoco\integrationTest.exec 
> ..\build\jacoco\test.exec 
> 
> Thanks in advance, 
> 
> Phil. 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jacoco+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/8da52cc5-d650-4bf9-b392-27c0c8e50d9d%40googlegroups.com
>  [1]. 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/jacoco/gmFf8Q1YWL8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> jacoco+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> 

Re: [java code coverage] Zero coverage when used both manually and maven plugin

2020-01-14 Thread Marc Hoffmann
Hi, 

if you want to create a exec *file* use output=file (which is default
and can be omitted). 

Regards,
-marc 

On 2020-01-14 09:03, MLK wrote:

> Hi All, 
> 
> I used the jacoco agent(jar v0.8.4)  in an application server to get the 
> functional test coverage. This application code already had the jacoco maven 
> plugin configured (in pom.xml  v0.8.1) to measure the unit testing coverage. 
> The .exec file which was dumped using the agent didn't had any stats so I 
> removed the maven plugin configuration , redeployed the application and then 
> new .exec file was showing the coverage stats. 
> 
> This is the command I used to bind the agent, 
> 
> JAVA_OPTS="$JAVA_OPTS 
> -javaagent:/home/user/lib/jacocoagent.jar=address=*,port=,destfile=/home/user/jacoco-it.exec,append=true,output=tcpserver"
>  
> 
> can this be happened due to different jacoco versions and any idea on how to 
> implement both methods?  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jacoco+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/fd3f3e57-e692-4d13-b586-620cd7b25786%40googlegroups.com
>  [1].

 

Links:
--
[1]
https://groups.google.com/d/msgid/jacoco/fd3f3e57-e692-4d13-b586-620cd7b25786%40googlegroups.com?utm_medium=emailutm_source=footer

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/2338b5241e090ea7c9e6afbd0ae17d28%40mountainminds.com.


Re: [java code coverage] Coverage report showing very different numbers between operating systems

2020-01-14 Thread 'Philip Smith' via JaCoCo and EclEmma Users
Hi Marc,

The moving between machines was simply being done to try and understand the
discrepancy we were seeing between our windows and unix based platforms; it
is not something that we would normally be doing.
This issue actually came to light as we had our coverage set to 90% in our
jacocoTestCoverageVerification task (see belo). On windows this was fine as
based on the 3 *.exec files we had a reported coverage of 90%, but when we
ran the job on the CI server (linux) the build failed as the verification
task was only reporting 84%.

So when either the jacocoTestReport or jacocoTestVerification task runs,
based on what you have said above, does it also reference the local class
files as well as the *.exec files to produce the answer. I had assumed
perhaps wrongly that the only thing used at this point was the exec file?

Really just trying to understand why a build process that produces 3 *exec
files, due to 3 separate test targets, can produce widely different answers
between the operating systems. Before when we had all the tests running
under the single target we had consistent results?


val jacocoReportLocations = fileTree("/build/jacoco") { include("*.exec") }

val jacocoTestReport by getting(JacocoReport::class) {
executionData(jacocoReportLocations)
reports {
xml.isEnabled = true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(it) {
exclude(coverageExclusions)
}
}))
}
}

val jacocoTestCoverageVerification by
getting(JacocoCoverageVerification::class) {
executionData(jacocoReportLocations)
mustRunAfter("jacocoTestReport")
violationRules {
rule {
limit {
counter = "LINE"
minimum = "0.90".toBigDecimal()
}
}
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(it) {
exclude(coverageExclusions)
}
}))
}
}




On Tue, Jan 14, 2020 at 5:56 AM Marc Hoffmann 
wrote:

> Hi Phil,
>
> are you moving exec files between builds and/or machines? Please note that
> JaCoCo requires the exact same class files at execution and analysis time.
> See our documentation for background information:
>
> https://www.jacoco.org/jacoco/trunk/doc/classids.html
>
> Regards,
> -marc
>
>
> On 10. Jan 2020, at 18:16, smitp33 via JaCoCo and EclEmma Users <
> jacoco@googlegroups.com> wrote:
>
> Hi,
>
> We have noticed that a *.exec file generated on windows / mac are
> producing reports with very different coverage numbers.
>
> On windows the *.exec file is showing 90% whilst on mac it is showing 84%.
> If we take the *.exec file from the mac machine and put it onto the windows
> machine and then generate the report again from this file it shows 91% - so
> closer, but still not a match.
>
> Wondering what we can do to try and investigate this further?
>
> If it helps at all we are running multiple test tasks that we are then
> trying to combine into an aggregate report ...
>
> val jacocoReportLocations = fileTree("/build/jacoco") { include("*.exec") }
> jacocoReportLocations.files.forEach {
> println(it)
> }
>
> val jacocoTestReport by getting(JacocoReport::class) {
> executionData(jacocoReportLocations)
> reports {
> xml.isEnabled = true
> }
> afterEvaluate {
> classDirectories.setFrom(files(classDirectories.files.map {
> fileTree(it) {
> exclude(coverageExclusions)
> }
> }))
> }
> }
>
>
>
> and the dir that sources the files has the following in it ...
>
> ..\build\jacoco\contractTest.exec
> ..\build\jacoco\integrationTest.exec
> ..\build\jacoco\test.exec
>
> Thanks in advance,
>
> Phil.
>
> --
> You received this message because you are subscribed to the Google Groups
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jacoco+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/8da52cc5-d650-4bf9-b392-27c0c8e50d9d%40googlegroups.com
> 
> .
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jacoco/gmFf8Q1YWL8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jacoco+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/02056E8B-3887-4E1D-8171-9279435CCC07%40mountainminds.com
> 
> .
>

-- 
You received this 

[java code coverage] Zero coverage when used both manually and maven plugin

2020-01-14 Thread MLK
Hi All,

I used the jacoco agent(jar v0.8.4)  in an application server to get the 
functional test coverage. This application code already had the jacoco 
maven plugin configured (in pom.xml  v0.8.1) to measure the unit testing 
coverage. The .exec file which was dumped using the agent didn't had any 
stats so I removed the maven plugin configuration , redeployed the 
application and then new .exec file was showing the coverage stats.

This is the command I used to bind the agent,
JAVA_OPTS="$JAVA_OPTS 
-javaagent:/home/user/lib/jacocoagent.jar=address=*,port=,destfile=/home/user/jacoco-it.exec,append=true,output=tcpserver"

can this be happened due to different jacoco versions and any idea on how 
to implement both methods? 

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/fd3f3e57-e692-4d13-b586-620cd7b25786%40googlegroups.com.