|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Executable Unit Validation |
| 4 | +nav_order: 4 |
| 5 | +parent: Design Patterns |
| 6 | +--- |
| 7 | + |
| 8 | +Executable unit validation refers to the process of testing and verifying the generated code to ensure that it can be |
| 9 | +compiled and executed by the compiler. The aim of executable unit validation is to enhance the accuracy and |
| 10 | +executability of the generated code, ensuring that the generated code units meet expectations and can be effectively |
| 11 | +utilized. |
| 12 | + |
| 13 | +In AutoDev, corresponding to functionalities such as SQL combined with the database, unit testing, and functional code |
| 14 | +generation, we have preliminarily designed the following validation mechanisms: |
| 15 | + |
| 16 | +- Unit Test Syntax (TODO): Check whether the generated unit test code complies with language syntax specifications to |
| 17 | + ensure it can be compiled correctly by the compiler. |
| 18 | +- Unit Test Execution: Execute the generated unit test cases to test the generated code, ensuring it can be compiled and |
| 19 | + executed correctly by the compiler. |
| 20 | +- SQL Syntax Validation: Generate SQL statements based on different model capabilities and handle any resulting errors. |
| 21 | +- SQL Schema Validation (TODO): Combine with the connected database to check the generated SQL statements, ensuring they |
| 22 | + comply with the database schema specifications. |
| 23 | +- Functional Code Generation Validation (TODO): Adopt a test-driven validation mechanism to check the generated code, |
| 24 | + ensuring it meets development requirements and can be compiled correctly by the compiler. |
| 25 | +- Frontend Code Generation Validation (TODO): Check the generated frontend code to ensure correctness in imports, |
| 26 | + syntax, etc. |
| 27 | + |
| 28 | +Considering that unit tests are directly executable, in AutoDev, we directly execute unit tests (`RunService`), and with |
| 29 | +a fast enough IDE, the validation process is generally rapid. Through the aforementioned validation mechanisms, we can |
| 30 | +effectively enhance the accuracy and executability of the generated code, ensuring that the generated code units meet |
| 31 | +expectations and can be effectively utilized. |
0 commit comments