Comments (9)
Hello,
We have a feedback cycle that in case of compilation issues in the tests generated by the model, sends the compilation issue to the model for fixing the problem. Any time that the plugin shows the LLM warning, it actually detects a compilation issue in tests generated by LLM. By default, the plugin stops this cycle after three unsuccessful iterations (the LLM error message).
Possible solutions for fixing this issue:
- Simply rerun the process.
- Try to generate tests for smaller units (such as each method in this class), separately.
- Improve the prompt template in the settings.
- Increase the number of iterations of the LLM feedback cycle in the settings.
- Use another model for test generation.
Also, if the class that you want to test is openly available, we will be happy to try it ourselves and see if we can find an anomaly that can be improved from our side.
from testspark.
Thanks a lot for the answer. I am using TestSpark version 0.1.8 on the following project: commons-cli
While running TestSpark against all the methods in the project, I encountered issues. The error messages I received are 'prompt too long' or 'The result is invalid or uses unknown commands due to randomness and lack of guarantees from Chat GPT. Please try again.' Could you please help me identify which step might be going wrong?
Your assistance would be greatly appreciated."
from testspark.
Thank you for your message.
I will try the LLM-based test generation on this project and let you know my findings. If I find some solutions, I will be sure to share them with you. If I find some bugs, we will fix them as soon as possible. I will try to do it quickly, but it might take a few days.
from testspark.
Hi again,
I managed to reproduce the LLM could not generate any tests
error when I tried to generate tests for class org.apache.commons.cli.Util
. According to my debugging, this is an issue from our default prompt template. Can you please try this solution and let me know about the result:
-
Go to LLM settings (using the highlighted button in the attached photo.
-
Change the Class prompt in the prompt editor to:
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.
The source code of class under test is as follows:
$CODE
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
$POLYMORPHISM
- Generate tests for some of the classes with no tests generated warning (e.g., generate tests for class
org.apache.commons.cli.Util
). - Check if the problem is resolved. If you face the same issue or another issue, please let us know.
If this fixes the issue with the Util class, it means that we need to update our default prompt.
from testspark.
Thank you for your reply.
I want to make sure the TestSpark configuration of compile. Could you please give me an example of the following two configurations.
from testspark.
Hey,
If you can build your project with IDEA, you don't need to set anything here. For the commons-cli, I managed to make the build happen with the mvn
command (as it is mentioned in the project's README). So, no need to add anything here. According to my few tries of applying TestSpark on commons-cli, if you can build the project with IDEA, TestSpark will automatically find the build command and compilation path and eventually generate tests.
Also, here's another update about the prompt being too long error: I am trying some new approaches to reduce the prompt size in cases with a big class under test. Meanwhile, in large classes, TestSpark can still generate tests for smaller units, such as methods.
from testspark.
Hello @pderakhshanfar,
I have a gradle project and having a problem running the TestSpark plugin on a Java class in it. What exactly should I put under the "Project compilation settings" to generate test cases for the selected class?
Thank you!
from testspark.
Hey @Faiz-UT
TestSpark is fully integrated with IntelliJ IDEA builds. So, if you can build your Gradle project using IDEA (more information here), you can keep "Project compilation settings" empty. In this case (which is the default and easiest way of test generation in TestSpark), TestSpark will run the build configuration and also detect and include all of the outputs of the project for test generation.
Alternatively, you can add all of the directories containing compiled classes and commands for compiling the project in the compilation path and compilation command, respectively.
from testspark.
No response
from testspark.
Related Issues (20)
- Implement new objectives for EvoSuite that can be useful in IDE
- Integrate new test generation tools
- Adding JavaScript unit test generation
- Integrating Kex into TestSpark plugin
- Imports of the final test suite are incomplete
- Imports of a compilable test case may be incorrect
- The prompt reduction not working due to the LLM chat history (context) with the initial prompt not being purged
- [IMPORTANT] Incorrect filtering of the polymorphism relations
- Provide access level & potentially remove methods' docstrings in the methods information prompt component
- How to tackle the private methods of the class under test?
- TestSpark does not provide information about enum-parameters of CUT's methods
- Polymorphic relations prompt component does not distinguish sub-classes and sub-interfaces
- TestSpark lists method signatures of CUT itself if CUT is listed as a method parameter
- Create a prompting strategy for the CUTs whose full definition already exceeds the LLM's token limit
- View and modify the selected prompt in the "LLM Setup" dialog window
- Unused `psiClassesToVisit` variable in `PromptManager`
- Remove display services
- Object files relocation
- Cleaning a list of test cases
- Incorrect state after indicator cancellation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testspark.