Skip to content

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

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

Open
tyuldashev opened this issue Oct 5, 2022 · 4 comments
Open

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

tyuldashev opened this issue Oct 5, 2022 · 4 comments
Assignees
Labels
comp-codegen Issue is related to code generator ctg-bug Issue is a bug

Comments

@tyuldashev
Copy link
Collaborator

tyuldashev commented Oct 5, 2022

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

    }
@tyuldashev tyuldashev added ctg-bug Issue is a bug comp-codegen Issue is related to code generator labels Oct 5, 2022
@tyuldashev tyuldashev moved this to Todo in UTBot Java Oct 5, 2022
@sergeypospelov
Copy link
Member

sergeypospelov commented Oct 6, 2022

@alisevych
Copy link
Member

@sergeypospelov This is in Release branch, not in main

@tyuldashev
Copy link
Collaborator Author

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.

@tyuldashev tyuldashev changed the title Empty test is generated for examples.algorithms.Graph Project version of 'utbot-api' used instead of plugin one Oct 7, 2022
@alisevych
Copy link
Member

alisevych commented Oct 13, 2022

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
Labels
comp-codegen Issue is related to code generator ctg-bug Issue is a bug
Projects
Status: Todo
Development

No branches or pull requests

4 participants