Skip to content

Project version of 'utbot-api' used instead of plugin one #1099

Open

Description

@tyuldashev

Description
When using samples from UTBot java project libraries compiled from this project are used during test generation.

To Reproduce

Steps to reproduce the behavior:

  1. Open UTbot java project
  2. Take the code before this commit which introduced UtMock.disableClassCastExceptionCheck(Object object)
  3. Open org.utbot.examples.algorithms.Graph class from UTBot Java project
  4. Start generation of the tests for the class with `Do not mock' setting

Expected behavior

No errors during generation of the test, because plugin uses its own libraries

Actual behavior
One of the error tests has no executable code and reveals that project code was used during generation

    public void testGetTime_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 1 occurrences of:
        // couldn't find method disableClassCastExceptionCheck([java.lang.Object]) in org.utbot.api.mock.UtMock

    }

Activity

  1. sergeypospelov commented on Oct 6, 2022

    @sergeypospelov
    Member
  2. alisevych commented on Oct 6, 2022

    @alisevych
    Member

    @sergeypospelov This is in Release branch, not in main

  3. tyuldashev commented on Oct 6, 2022

    @tyuldashev
    CollaboratorAuthor

    As I found out it looks like there is some type of conflict between plugin utbot-api.jar and project one.

    The utbot project I used for testing was quite old and didn't have commit which introduced UtMock.disableClassCastExceptionCheck(Object object) method. It seems that during test generation utbot-api module complied from old project code was used instead of utbot-api.jar supplied with the plugin.

    I think we need some kind of investigation why it happens and how to prevent such problems in future, so we could safely use samples from the project and not worry about potential conflicts.

  4. changed the title [-]Empty test is generated for examples.algorithms.Graph[/-] [+]Project version of 'utbot-api' used instead of plugin one[/+] on Oct 7, 2022
  5. alisevych commented on Oct 13, 2022

    @alisevych
    Member

    Additional context

    Reproduced. Most assuredly UtMock class is used not from the installed plugin, but from the opened and built project.

    Steps to reproduce

    1. Open IDEA , install release build or plugin from main branch
    2. Open UTBotJava project
    3. Checkout any version before 06/06/2022
    4. Generate tests for utbot-sample/src/main/java/org/utbot/examples/algorithms/ArraysQuickSort.java
    5. Check Errors report in generated test

    Expected behavior

    Tests are supposed to be generated without errors.

    Actual behavior

    There is the following error test:

    Screen Shot 2022-10-13 at 17 47 13

    Comments

    There is no method UtMock.assumeOrExecuteConcretely before 07.06.2022 in UtMock class.
    It should be present in the plugin's jar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

comp-codegenIssue is related to code generatorctg-bugIssue is a bug

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions