Yako Integration

I cannot overcome this problem - I have 3 classes AB and C.

A is a test integration class that tests classes B and C at the same time.

B and C are classes in another package (class wrt A)

Now when I run the integration test class A, I want the code coverage to show which parts of B and C are covered. I do not get the required output.

What I get as an output is that no classes have tools.

So there is no test coverage for two classes ... If I write an example code in src / main / java in the same module as in A. It recognizes the class and tools.

Why doesn't he do the same for classes outside of his package.

Please help. thanks

+4
source share
1 answer

This can be caused by a number of problems:

1. Classes that do not start according to the jacoco agent

The first thing you need to check is whether your classes B and C are called by the jacoco agent. This can be done by creating a jacoco report and clicking on the session link (upper right corner).

If your class B or C is not listed here, it means that your jacoco agent has a problem, and it was not tied to the correct JVM that runs the B / C class, or if no code in the B / C class was called.

2. Classes launched according to the jacoco agent, but not available source files / classes

If your B or C class is listed here, but it is not clickable, it means that your B / C class was launched and detected by the jacoco agent, but it could not bind it.

Keep in mind that when creating a report, jacoco must have class files and source files to create the report. (if you use maven, it expects class files in the project.build.outputDirectory file and sources in the project.build.sourceDirectory file

3. Classes run according to the jacoco agent, but class files available

If your class B or C is deployed to the application server, it is possible that the application server also uses the bytecode of these classes during deployment, creating a situation where the class files in your local project do not match the class files detected by the jacoco agent (see this topic to discuss this issue: https://groups.google.com/forum/?fromgroups=#!topic/jacoco/GjSlBoFTRrc ). In this case, Jacoco offers the classdumpdir parameter, which can be set to the folder in which jacoco will unload the classes detected during the test run. You must use these classes when generating the report.

References

+2
source

Source: https://habr.com/ru/post/1445935/


All Articles