- 引入 SmartInt 和 SmartDict 类型,支持 YAML 占位符与业务类型的自动转换。 - 优化 CaseInfo 互斥校验逻辑,确保 request 与 api_action 二选一。 - 统一使用 Pydantic V2 的 model_config 规范。 - 将变量替换时机提前至模型实例化之前,支持占位符在校验前完成真实值注入, 保证了 int/bool 等字段的类型转换正确性。 - 优化断言渲染时机,支持响应提取值关联。
2.2 KiB
Project Structure Documentation
This document outlines the recommended structure for the Interface Automation Test project. A well-organized structure promotes maintainability, scalability, and collaboration.
Directory Structure
Here is the proposed optimized directory structure:
/
|-- core/ # Main source code
| |-- api.py
| |-- main.py
| |-- luffy.py
| +-- ...
|
|-- tests/ # Test cases
| |-- a_test_case.py
| +-- ...
|
|-- config/ # Configuration files
| |-- id.yaml
| |-- extract.yaml
| +-- ...
|
|-- utils/ # Utility modules
|
|-- docs/ # Project documentation
| +-- README.md
|
|-- .gitignore # Git ignore file
|-- pytest.ini # Pytest configuration
|-- pyproject.toml # Python project configuration
|-- README.md # Main project README
Description of Directories
-
core/: This directory contains the core application logic for the interface tests. Files likeapi.py,main.py, andluffy.pywhich handle the main business logic should reside here. -
tests/: This directory is for all the automated tests. Each test file should ideally correspond to a module or a feature. -
config/: This directory should store all configuration files, such asid.yamlandextract.yaml. This separation makes it easier to manage different environments (e.g., development, staging, production). -
utils/: This directory holds common utility functions and helper scripts that can be used across different parts of the project. -
docs/: This directory contains all project-related documentation, including this structure guide.
Benefits of this Structure
- Clarity: A clear separation of concerns makes it easy to find code.
- Maintainability: Easier to maintain and refactor code without affecting other parts of the system.
- Scalability: The structure can easily scale as the project grows in complexity.
- Collaboration: New developers can quickly understand the project layout and start contributing.
We recommend moving the existing files into this new structure to improve the overall quality of the project.