Unit Test (Agent)
The Unit Test (Agent) is an end-to-end test case generation agent that provides core capabilities throughout the entire process, including test design, test case generation, and intelligent test case repair. This function can accurately generate test cases that comply with the code logic, automatically identify compilation errors of generated test cases, and intelligently repair test cases with compilation errors, effectively improving the development efficiency and quality of test cases.
Built-in Agents
Agents are programming assistants tailored for diverse development scenarios. CodeArts Agent provides multiple out-of-the-box agents that require no manual creation, aiming to provide efficient programming assistance for various development scenarios. For more information, see Built-in Agents.
| Name | Description |
|---|---|
| general | A general-purpose agent used to research complex problems and execute multi-step tasks. |
| explore | A code repository exploration agent dedicated to quickly locating files, searching code keywords, and answering related questions. |
| spec-task-agent | An agent used to generate implementation tasks based on requirements and design. |
| spec-requirement-agent | An agent used to generate requirements for the Easy Approach to Requirements Syntax (EARS) format based on the project description and context. |
| spec-design-agent | An agent used to generate comprehensive technical designs, converting requirements (what to do) into architectures (how to do it). |
| developer-test-agent | An agent dedicated to unit test generation, repair, coverage optimization, and review. It can be invoked using either of the following methods:
|
Agent-based Unit Test Generation
- Log in to CodeArts Agent as instructed in JetBrains.
- On the IntelliJ IDEA sidebar, click the CodeArts Agent icon
to open the chat panel. - In the chat box, change the model to Agent. The selected model is displayed on the right. You can select a model as required from the drop-down list.
- Select a code snippet and send a unit test generation command to CodeArts Agent. It can be invoked using either of the following methods:
- Prompts: Enter a prompt directly into the chat box to invoke it, for example, "Use developer-test-agent to generate a unit test for the main method in the Dijkstra.java file." Figure 1 Unit test
- Right-click shortcut: This method is only available for IntelliJ IDEA of the JetBrains series. In agent mode, right-click a Java method name and choose CodeArts Agent > Generate Unit Tests (Agent) from the shortcut menu to quickly enable it. Figure 2 Choosing Generate Unit Tests (Agent)
- Prompts: Enter a prompt directly into the chat box to invoke it, for example, "Use developer-test-agent to generate a unit test for the main method in the Dijkstra.java file."
- Check whether a unit test file is generated. If yes, the execution is successful and the test is passed.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot