does Jacoco consider if unit tests are out side of src/test/java

45 views
Skip to first unread message

raj.se...@gmail.com

unread,
Nov 27, 2018, 12:51:36 PM11/27/18
to JaCoCo and EclEmma Users

Hello,

all my unit tests are out side of src/test/java. In this case, does Jacoco recognize my unit tests? 
plz help me in this regard.

-Raj  

Marc Hoffmann

unread,
Nov 27, 2018, 4:57:27 PM11/27/18
to jac...@googlegroups.com
Hi Raj,

the question is: are these unit tests executed?

JaCoCo has no idea about JUnit or any other framework. It simply records the execution of all classes loaded into the JVM.

Regards,
-marc


--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/e8390fcf-eb87-4a5d-bbd3-949b48a4b32a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted
Message has been deleted
Message has been deleted

raj.se...@gmail.com

unread,
Dec 17, 2018, 1:22:41 PM12/17/18
to JaCoCo and EclEmma Users
Hello Marc, sorry for late response.
Its took me some time to come up with example.

Let me explain you my problem.

sample.png


in the above pic, which is marked in black color is the actual business code and unit test is marked in red color. And Cucumber(BDD) tests are marked in blue color.
when I go with maven clean install its considering only unit tests which are under src/test/java. 

Here my question is... where should I change the configuration to consider the tests which are under src/cucumber/java.
Please find the attached pom.xml for more details.
 
Thanks
Raj
pom.xml

Evgeny Mandrikov

unread,
Dec 17, 2018, 4:00:31 PM12/17/18
to JaCoCo and EclEmma Users


On Monday, December 17, 2018 at 7:22:41 PM UTC+1, raj.se...@gmail.com wrote:
Here my question is... where should I change the configuration to consider the tests which are under src/cucumber/java.
Please find the attached pom.xml for more details.

pom.xml alone in absence of other files is not a complete example and can't be executed / debugged !

Since we can't execute it, we don't know what you see when you execute build.
And so why do you believe that something needs to be changed ?

And again same question as was already asked by Marc:
Are you sure that these tests are executed ? Why you execute "clean install" whereas "maven-failsafe-plugin" is declared in "acceptance-tests" profile ? Aren't you supposed to activate this profile using "clean install -P acceptance-tests" ?

raj.se...@gmail.com

unread,
Dec 17, 2018, 10:47:59 PM12/17/18
to JaCoCo and EclEmma Users
all these tests are executed successfully.  

I tried profile using "clean install -P acceptance-tests" but did not go well.

Here is the code for ref.       

Evgeny Mandrikov

unread,
Dec 18, 2018, 3:20:06 AM12/18/18
to JaCoCo and EclEmma Users


On Tuesday, December 18, 2018 at 4:47:59 AM UTC+1, raj.se...@gmail.com wrote:
all these tests are executed successfully.  

I tried profile using "clean install -P acceptance-tests" but did not go well.

Here is the code for ref.       

Once again - why do you believe that it did not go well?

Execution of "clean install -P acceptance-tests" produces two reports
one in "target/site/jacoco/index.html"

1.png



and another one in "target/site/jacoco-it/index.html"

2.png



exactly as declared in your "pom.xml" by configurations of "report" and "report-integration".

raj.se...@gmail.com

unread,
Dec 18, 2018, 6:33:28 AM12/18/18
to JaCoCo and EclEmma Users
Thanks.

actually it was my fault.. I did not execute profile "clean install -P acceptance-tests" properly    :(

-Raj

Balesh koijam

unread,
Dec 19, 2018, 9:36:43 AM12/19/18
to JaCoCo and EclEmma Users
i did a recent test example where i store one of my java class outside the test folder. i saw the code coverage was reported, so i dont think it is mandatory that java classes should be inside the test folder.

raj.se...@gmail.com

unread,
Dec 19, 2018, 12:27:37 PM12/19/18
to JaCoCo and EclEmma Users
that's true.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages