# unit_test_llm
**Repository Path**: L_934586/unit_test_llm
## Basic Information
- **Project Name**: unit_test_llm
- **Description**: hello~hello~
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-07-25
- **Last Updated**: 2026-04-13
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
**创建虚拟环境并激活**
```python
python -m venv .venv
.venv\Scripts\activate
# 下载依赖
pip install -r requirements.txt
```
**导出mvn test的输出日志**
```ps
powershell -Command "mvn test | Out-File -Encoding UTF8 test-output.log"
```
**导出所有依赖的jar路径**
```cmd
mvn dependency:build-classpath "-Dmdep.outputFile=classpath.txt" "-Dmdep.includeScope=test"
```
```cmd
# 生成报告的命令
allure generate ./allure-results -o ./allure-report --clean
# 生成单文件报告
allure generate ./allure-results --single-file -o ./allure-report --clean
# 跳过maven测试
mvn clean package -Dmaven.test.skip=true
# mvn测试指定跳过哪些模块
mvn test -pl !module_name
# 执行单个模块的测试
mvn clean test -pl module_name
```
**在需要进行生成单元测试的项目的pom.xml中加入**
```pom
io.qameta.allure
allure-junit5
2.7.13
test
// mockito-inline用于支持静态方法mock
org.mockito
mockito-inline
4.5.1
test
org.apache.maven.plugins
maven-surefire-plugin
3.0.0-M5
false
false
allure.results.directory
${maven.multiModuleProjectDirectory}/allure-results
org.apache.maven.plugins
maven-antrun-plugin
3.1.0
clean-allure-results
process-test-classes
run
org.apache.maven.plugins
maven-compiler-plugin
3.11.0
eclipse
true
false
8
8
-proceedOnError
false
org.codehaus.plexus
plexus-compiler-eclipse
2.8.8
org.projectlombok
lombok
1.18.24
```
**maven-surefire-plugin一定要设置3以上,否则在提取mvn test的输出日志的时候,没办法提取到全限定类名**
```pom
// 设置某个模块出现错误的时候是否跳过后续模块
false
// 设置某个模块出现错误的时候是否影响最终的输出,如果设置为true,即使测试failure,那么最终显示的也是build success
false
```
**tree-sitter解析树结构**
```text
program
└── package_declaration
├── package → 关键字 "package"
├── scoped_identifier → 包名 "com.book.controller"
│ ├── scoped_identifier → "com.book"
│ ├── . → "."
│ ├── identifier → "controller"
│ ├── ; → "分号"
│
└── ; → 分号
├── import_declaration × N → 多个导入语句
│ ├── import → 关键字 "import"
│ ├── scoped_identifier → 完整导入路径,如:cn.hutool.json.JSONObject
│ │ ├── scoped_identifier → "cn.hutool.json"
│ │ ├── . → "."
│ │ ├── identifier → "JSONObject"
│ │ ├── ; → "分号"
│ │
│ │
│ │
│ └── ; → 分号
├── block_comment → 类上的 Javadoc 注释/** ... */ 注释文本内容(无子节点,叶子节点)
├── class_declaration → 类声明节点
├── modifiers → 修饰符列表(含注解和访问控制)
│ ├── marker_annotation → 注解 @RestController,注解里面没内容的是marker_annotation
│ │ |── @ → "注解符号@"
| | |── identifier → "RestController"
│ │
│ ├── annotation → @RequestMapping("/book")
│ │ ├── @ → "注解符号@"
│ │ |── identifier → "RequestMapping"
│ │ ├── annotation_argument_list → "("/book")"
│ │
│ └── public → 访问修饰符
│
├── class → 关键字 "class"
├── identifier → 类名 "BookController"
└── class_body → 类体 {}
├── field_declaration → 字段声明(1)
│ ├── modifiers
│ │ ├── annotation → @Resource
│ │ └── private
│ ├── type: identifier → IBookService
│ └── declarator
│ └── name: identifier → bookService
│
├── field_declaration → 字段声明(2)
│ ├── modifiers
│ │ ├── annotation → @Resource
│ │ └── private
│ ├── type: identifier → StringRedisTemplate
│ └── declarator
│ └── name: identifier → stringRedisTemplate
│
├── field_declaration → 字段声明(3)
│ ├── modifiers
│ │ ├── annotation → @Resource
│ │ └── private
│ ├── type: identifier → GetCurrentTime
│ └── declarator
│ └── name: identifier → getCurrentTime
│
└── method_declaration → 方法声明:list(...)
├── modifiers
│ ├── annotation → @ApiOperation("获取图书列表接口")
│ │ └── arguments
│ │ └── string_literal → "获取图书列表接口"
│ ├── annotation → @GetMapping
│ │ └── name: identifier → GetMapping
│ └── public
├── type: identifier → 返回类型 "Result"
├── name: identifier → 方法名 "list"
├── formal_parameters → 参数列表
│ ├── formal_parameter → 参数1
│ │ ├── modifiers
│ │ │ ├── annotation → @ApiParam(...)
│ │ │ │ └── arguments → value="页数", example="1"
│ │ │ └── annotation → @RequestParam
│ │ ├── type: identifier → Integer
│ │ └── name: identifier → pageNum
│ └── formal_parameter → 参数2
│ ├── modifiers
│ │ ├── annotation → @ApiParam(...)
│ │ └── annotation → @RequestParam
│ ├── type: identifier → String
│ └── name: identifier → searchBookName
└── body: block → 方法体 {}
├── local_variable_declaration
│ └── variable_declarator
│ ├── name: identifier → wrapper
│ └── value: object_creation_expression
│ └── type: identifier → QueryWrapper
├── expression_statement
│ └── method_invocation
│ ├── object: identifier → wrapper
│ ├── arguments: ("book_name", searchBookName)
│ └── chained: .eq("delete_state", 0)
├── local_variable_declaration → bookPage = new Page<>(...)
├── local_variable_declaration → page = bookService.page(...)
├── local_variable_declaration → bookList = page.getRecords()
├── comment → 被注释掉的代码块
├── local_variable_declaration → jsonObject = new JSONObject()
├── expression_statement → jsonObject.putOpt("total", ...)
├── expression_statement → jsonObject.putOpt("bookList", ...)
└── return_statement
└── value: method_invocation
├── object: identifier → Result
├── method: success
└── arguments: (jsonObject, "图书列表请求成功")
```