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

Non-deterministic detection #2246

Merged

Conversation

SBOne-Kenobi
Copy link
Collaborator

@SBOne-Kenobi SBOne-Kenobi commented May 31, 2023

Non-deterministic detection

Created the possibility to detect and generate mocks for non-deterministic functions and objects. It reduces the number of flaky tests, especially from fuzzing.

Description

Fixes #1193

Added new instrumentation.
Added new fields in results for found mocks in concrete and fuzzing.

How to test

Manual tests

Run test generation on any class with Random usage. For instance

class ClassWithRandom {
  public int rndSum(int x) {
    Random r  = new Random();
    return x + r.nextInt();
  }
}

Expected that tests will be generated with mocks for Random class.

Self-check list

Check off the item if the statement is true. Hint: [x] is a marked item.

Please do not delete the list or its items.

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@SBOne-Kenobi SBOne-Kenobi self-assigned this May 31, 2023
@SBOne-Kenobi SBOne-Kenobi added ctg-enhancement New feature, improvement or change request comp-instrumented-process Issue is related to Instrumented process lang-kotlin Issue is related to Kotlin language support lang-java Issue is related to Java support labels May 31, 2023
@SBOne-Kenobi SBOne-Kenobi changed the title Non deterministic detection Non-deterministic detection May 31, 2023
@SBOne-Kenobi SBOne-Kenobi marked this pull request as ready for review May 31, 2023 13:31
@SBOne-Kenobi SBOne-Kenobi removed lang-kotlin Issue is related to Kotlin language support lang-java Issue is related to Java support labels May 31, 2023
Copy link
Member

@sergeypospelov sergeypospelov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed the main idea of this PR verbally. The code seems good to me.

@SBOne-Kenobi SBOne-Kenobi force-pushed the sbone/non-deterministic-detection branch 2 times, most recently from 9bff9d4 to de5f85d Compare May 31, 2023 14:13
@SBOne-Kenobi SBOne-Kenobi force-pushed the sbone/non-deterministic-detection branch from de5f85d to e741e96 Compare June 1, 2023 09:56
@SBOne-Kenobi SBOne-Kenobi merged commit f2c6c56 into UnitTestBot:main Jun 1, 2023
bissquit pushed a commit that referenced this pull request Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-instrumented-process Issue is related to Instrumented process ctg-enhancement New feature, improvement or change request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-deterministic behavior detection in Concrete Executor
2 participants