Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A class is not included in the test coverage report if it is written in a separate file on one line. #687

Open
DomainName97 opened this issue Sep 17, 2024 · 3 comments
Assignees
Labels
Bug Bug issue type S: waiting for clarification Status: additional information required to proceed

Comments

@DomainName97
Copy link

Describe the bug
Same test suite, but different instruction coverage measurements exist

Expected behavior
Сoverage measurements should be equal

Reproducer
When a class written in a separate file on one line, it is not included in test coverage. But if you write it in several lines, it will be included in the test coverage report.

Reports
Снимок экрана 2024-09-17 в 13 43 37

Снимок экрана 2024-09-17 в 13 43 15

Environment

  • Kover Gradle Plugin version: 0.8.3
  • Gradle version: 8.6
  • Kotlin project type: Kotlin/Android
  • Coverage Toolset (if customized in build script): Kover
@DomainName97 DomainName97 added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Sep 17, 2024
@shanshin
Copy link
Collaborator

Hi, could you create a small reproducer project?
It was not possible to reproduce this issue locally.

@shanshin shanshin added S: waiting for clarification Status: additional information required to proceed and removed S: untriaged Status: issue reported but unprocessed labels Sep 17, 2024
@DomainName97 DomainName97 reopened this Sep 27, 2024
@DomainName97
Copy link
Author

I will try to explain. The class VerificationFailedException has a parameter(throwable) in the constructor, which is not used in the code.

Creating a class object looks like the following

catch (exception: RustoreHttpException.BadRequestException) {
            throw VerificationFailedException(exception)

Then I check the type of an object not using class parameters

is VerificationFailedException -> {
         ...
 }

In that case, the class is not included in the test coverage report if it is written in a separate file on one line. But if the class parameter is used in the code, then the single-line class will be included in test coverage

@DomainName97
Copy link
Author

Furthermore, if you write it in several lines, it will be included in the test coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: waiting for clarification Status: additional information required to proceed
Projects
None yet
Development

No branches or pull requests

2 participants