Skip to content

Locate inner classes tests in outer test class if JUnit4 is used #1674

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

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

EgorkaKulikov
Copy link
Collaborator

Description

JUnit4 does not allow to run tests for both outer and inner class.
To avoid losing coverage, we locate all test methods for inner class in a body of outer test class.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Regression and integration tests

Standard scenarios to generate and run tests with nested classes for ALL supported test frameworks
Regression checks for classes without nested ones.

Manual Scenario

Check test generation for the following class

public class OuterClass {

    public int sum(int a, int b) {
        return a + b;
    }

    public class InnerClass {
        public int min(int a, int b) {
            if (a > b) return b;
            else return a;
        }
    }

Checklist (remove irrelevant options):

This is the author self-check list

  • [+] The change followed the style guidelines of the UTBot project
  • [+] Self-review of the code is passed
  • [+] The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • [+] No new warnings
  • New tests have been added
  • All tests pass locally with my changes

@EgorkaKulikov EgorkaKulikov merged commit cb723b5 into main Jan 16, 2023
@EgorkaKulikov EgorkaKulikov deleted the egor/junit4_nested branch January 16, 2023 13:15
@alisevych alisevych added comp-codegen Issue is related to code generator lang-java Issue is related to Java support ctg-bug-fix PR is fixing a bug labels Jan 18, 2023
@alisevych alisevych added this to the 2023.03 Release milestone Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-codegen Issue is related to code generator ctg-bug-fix PR is fixing a bug lang-java Issue is related to Java support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants