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

Triplication of methods information component for fully augmented prompt #383

Open
Vladislav0Art opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Vladislav0Art
Copy link
Collaborator

Vladislav0Art commented Oct 10, 2024

Describe the bug

I have the following class under test. I generated tests for a line return a + b within add method and the prompt was as follows:

class CalcKotlinCtor {
    val a = 10

    fun add(a: Int, b: Int): Int {
        return a + b
    }
}
Generate unit tests in kotlin for the line `return a + b` within `org.example.CalcKotlinCtor.add` in the following code:
```
[Instruction]: Use a default constructor with zero arguments to instantiate `org.example.CalcKotlinCtor` and call the method under test `add`:

Constructors of the class org.example.CalcKotlinCtor:
=== Default constructor

Method:
fun add(a: Int, b: Int): Int {
        return a + b
    }
```

Dont use @Before and @After test methods.
Make tests as atomic as possible.
All tests should be for JUnit 4.
In case of mocking, use Mockito 5. But, do not use mocking for all tests.
Name all methods according to the template - [MethodUnderTest][Scenario]Test, and use only English letters.
Here are some information about other methods and classes used by the class under test. Only use them for creating objects, not your own ideas.
=== methods in org.example.CalcKotlinCtor:
 - fun add(a: Int, b: Int): Int
=== methods in org.example.CalcKotlinCtor:
 - fun add(a: Int, b: Int): Int
=== methods in org.example.CalcKotlinCtor:
 - fun add(a: Int, b: Int): Int

The prompt template used for the reproduction is:

Generate unit tests in $LANGUAGE for $NAME to achieve 100% line coverage for this class.
Dont use @Before and @After test methods.
Make tests as atomic as possible.
All tests should be for $TESTING_PLATFORM.
In case of mocking, use $MOCKING_FRAMEWORK. But, do not use mocking for all tests.
Name all methods according to the template - [MethodUnderTest][Scenario]Test, and use only English letters.
DO NOT use raw tests for both Kotlin and Java. Create normal functions only.
The source code of class under test is as follows:
$CODE
$METHODS
$POLYMORPHISM
$TEST_SAMPLE

As you see, the === methods in org.example.CalcKotlinCtor block triplicates. I reproduced it for Kotlin but Java might have been affected as well.

To Reproduce
Steps to reproduce the behavior:

  1. Use the provided CUT and execute test generation for a line.
  2. See the prompt that contains triplication.

Expected behavior
No data triplication.

@Vladislav0Art Vladislav0Art added the bug Something isn't working label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant