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

Sample test-code candidates based on current open file #415

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

stephanlukasczyk
Copy link

@stephanlukasczyk stephanlukasczyk commented Nov 21, 2024

Description of changes made

The test-sample provider for LLM with these changes now only shows tests that call one or more methods in the currently open source file. If none where found, as a fallback, it still provides all test samples to the user for further selection.

Why is merge request needed

The current test-sample provider for LLMs runs over the full project and searches for all tests that could be used as samples. On the one hand, this might be slow for larger projects, on the other hand, tests for other classes than the currently open one (in the editor) might not contain anything that can be beneficial for the LLM, because the other code might do something completely different.

The idea of this merge request is to only provide test cases as samples that call the currently open file because they obviously are somehow related the the current file and they might provide beneficial information to the LLM. Besides, this makes the list of potential test samples presented to the user shorter and more relevant, which allows them to choose a sample easier.

Other notes

This merge request is part of the assignment I've received from @pderakhshanfar.

What is missing?

The PR is open for discussion. I am particularly unhappy with the stage of testing—the main algorithms are not tested—however, I did not find a way to properly set up the required environment, since the test-sample selection algorithms require information from basically a running IDE.

  • I have checked that I am merging into correct branch

Previously, all tests from a project where incorporated as test-code
candidates for the LLM, however, this can be slow for larger projects.
This change uses the currently open file, determines the test methods
that call code in the currently open file, and only use those as
candidates for the LLM.  As a fallback, if none could be found, all
tests from the project will be candidates.
The core algorithm is still not tested because I do not see how I could
get the required objects in the necessary state.  The unfortunate thing
about the implemented selection algorithms is that they rely on an open
editor for a normal execution, which seems to be hard to set up for a
unit test.  Any feedback and help on this is highly appreciated!
@stephanlukasczyk stephanlukasczyk marked this pull request as ready for review November 24, 2024 20:08
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.

1 participant