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

Compilation update #46

Merged
merged 0 commits into from
Aug 8, 2023
Merged

Compilation update #46

merged 0 commits into from
Aug 8, 2023

Conversation

arksap2002
Copy link
Collaborator

Description of changes made

Saving correct test cases during the incorrect common result

  • I have checked that I am merging into correct branch


// Asking LLM to generate test. Here, we have a loop to make feedback cycle for LLm in case of wrong responses.
while (!generatedTestsArePassing) {
log.info("New iterations of requests")

if (processStopped(project, indicator)) return

if (requestsCount >= maxRequests) {
if (isLastIteration(requestsCount) && project.service<Workspace>().testGenerationData.compilableTestCases.isEmpty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about the tests that are generated in the last request? In this case, the last request which is saved in line 196, will be ignored.

Copy link
Collaborator Author

@arksap2002 arksap2002 Aug 8, 2023

Choose a reason for hiding this comment

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

Fixed loop:

  1. checking for the last iteration
  2. request with the updated prompt
  3. if some error → update the prompt && continue
  4. else → save result from the request in this iteration

Copy link
Collaborator

Choose a reason for hiding this comment

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

If the maximum number of requests are set to 1, the loop will show invalidGrazieResult without sending any request. This is because at the beginning of the loop, the number of requests will be increased to 1 and isLastIteration checks whether the number of requests is greater equal to the maximum number of requests (here 1). I think to solve this issue, the isLastItteration method should be changed to:

private fun isLastIteration(requestsCount: Int) = requestsCount > maxRequests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed


// check is .class file exists
if (File(classFilePath).exists()) {
project.service<Workspace>().testGenerationData.compilableTestCases.add(testCases[index])
Copy link
Collaborator

Choose a reason for hiding this comment

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

When you send feedback, LLM will print the whole test file again. So, it is possible that we have some duplicate in compilable tests

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, we only add test cases here. We need to check if they are still compilable with the final test suite body of the test file (with imports and mocking-related annotations).

Copy link
Collaborator Author

@arksap2002 arksap2002 Aug 8, 2023

Choose a reason for hiding this comment

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

I checked it, because each test case is in a separate file. I created them here: https://github.com/JetBrains-Research/TestGenie/pull/46/files/0a67016bc734ba460ee0d79ba8e836b35ae04ade#diff-87db339e5713928f5d39e84379b8955a6a684be4aef50c12171fc981e823f2c6R236
And I avoid duplicates, because this is a set of test cases 🙂

Copy link
Collaborator

@pderakhshanfar pderakhshanfar left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks 👍

@pderakhshanfar pderakhshanfar merged this pull request into development Aug 8, 2023
@arksap2002 arksap2002 deleted the compilation_update branch August 8, 2023 13:25
arksap2002 pushed a commit that referenced this pull request Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants