A front-end and back-end code generation and deployment system based on text AI model
Through the front-end code generation and deployment system based on text AI model, the front-end code is automatically generated and optimized, which solves the problem of time-consuming and labor-intensive and difficult to guarantee the quality of traditional manual coding, and realizes efficient and reliable code generation and deployment, and improves the The performance and maintainability of software products.
Patent Information
- Application Number
- CN202411361102.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-09-27
AI Technical Summary
In the rapidly developing Internet and mobile applications, it is difficult to generate front-end and back-end codes quickly and with high quality. As software complexity increases, code quality and system stability are difficult to ensure, and traditional manual coding is time-consuming and labor-intensive. It is easy to introduce human errors.
Using front-end code generation and deployment system based on text AI model, the front-end code generation and deployment system is automatically generated and optimized by using artificial intelligence text big models, and ensuring the reliability of the code through automated testing. and performance, and finally deploy the code to the production environment.
Significantly reduces the need for manual programming, improves development efficiency, reduces human errors, ensures that the code functions and performance comply with preset standards, improves the reliability and stability of software products, and improves the code comments generated by AI models. Readability and maintainability.
Smart Images

Figure CN118885162B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of information processing systems, and specifically relates to a front-end and back-end code generation and deployment system based on a text AI model. Background Art
[0002] In the modern software development process, fast and high-quality front-end and back-end code generation has increasingly become a goal pursued by the industry. Traditional software development processes often involve a lot of manual coding and testing, which is not only time-consuming and labor-intensive, but also prone to human errors. Especially in the rapidly developing Internet and mobile application fields, shortening the development cycle is crucial to improving competitiveness. In addition, as complexity increases, it is becoming increasingly difficult to ensure code quality and system stability. Therefore, how to improve the code generation and testing process through automation technology, reduce manual intervention, and improve development efficiency and product quality has become an urgent technical challenge.
[0003] In recent years, artificial intelligence (AI) technology, especially text processing models based on deep learning, has made significant progress in the field of natural language processing (NLP). These advances provide new possibilities for automated code generation. AI models can learn and simulate human coding habits and logic. Through training, they can generate grammatically correct and logically accurate code, while also predicting and optimizing code quality. In addition, by integrating the automation of test case generation and execution, AI technology can significantly improve the coverage and efficiency of software testing, thereby ensuring the reliability of generated code.
[0004] After consulting relevant public technologies, the technical solution with announcement number CN110941427B proposes a code generation method and a code generator, which obtains the description of the code and trains the artificial intelligence AI model, so that the artificial intelligence AI model can generate code that conforms to the description; the technical solution with publication number WO2019156706A1 proposes an automatic code generation method, and the user can generate specific code by operating the graphics of the interface GUI; the technical solution with publication number CA3099575A1 proposes an automatic API code generation method, through the preset API function, the API code can be automatically modified according to the working conditions of each interface during the actual working process to meet the new working conditions.
[0005] The above technical solutions all propose various automated solutions for code generation and deployment. However, with the demand for larger and more complex software engineering applications, more intelligent technical solutions for code generation and deployment are still needed.
[0006] The foregoing discussion of the background art is intended only to facilitate an understanding of the present invention. This discussion does not acknowledge or admit that any of the material referred to is part of the common general knowledge. Summary of the invention
[0007] The purpose of the present invention is to provide a front-end and back-end code generation and deployment system based on a text AI model; the system includes a data acquisition module, which is responsible for collecting user demand descriptions, reference front-end codes, reference back-end codes and corresponding test cases; a data embedding module embeds the collected information and generates a reference test combination; a generation module automatically generates a predicted front-end code and its test cases based on the reference test combination; an evaluation module uses the generated test cases to perform an accuracy test on the generated front-end code, and compares the performance with the reference code, and selects the code with excellent performance as the output candidate. Finally, the output module annotates the predicted front-end code to be output through the artificial intelligence text model to enhance the readability and maintainability of the code, outputs the annotated front-end code, and the deployment module is responsible for deploying it to the production environment.
[0008] The present invention adopts the following technical solution: a front-end and back-end code generation and deployment system based on a text AI model, the generation and deployment system comprising:
[0009] A data acquisition module is configured to acquire a user requirement description, at least one section of reference front-end code, at least one section of reference back-end code, and at least one test case for testing the reference front-end code;
[0010] A data embedding module is configured to embed the acquired user requirement description, reference front-end code, reference back-end code and test case, generate corresponding user requirement description embedding, reference front-end code embedding, reference back-end code embedding and test case embedding, and package the above embeddings to generate a reference test combination;
[0011] A generation module, configured to generate one or more prediction front-end codes and one or more prediction test cases according to the reference test combination;
[0012] An evaluation module, configured to evaluate the prediction front-end code and output the prediction front-end code to be output;
[0013] An output module is configured to input the predicted front-end code to be output into the artificial intelligence text big model to obtain one or more code comments of the predicted front-end code to be output, attach the code comments to the code segment, and output one or more final front-end codes with comments;
[0014] The code generation and deployment system further includes a computing module, which is based on an artificial intelligence text big model and is coupled to the data embedding module, the generation module, and the output module, so as to use the artificial intelligence text big model to assist in completing the work of the above two modules;
[0015] Preferably, the evaluation module comprises executing:
[0016] Using one or more of the prediction test cases, the prediction front-end code is subjected to an accuracy test, and at least the reference back-end code is used for the accuracy test;
[0017] Selecting at least one of the prediction front-end codes and the reference front-end code that meet the requirements of the accuracy test to perform performance testing;
[0018] According to the result of the performance test, one or more predicted front-end codes having performance better than the reference front-end code are selected as the predicted front-end code to be output;
[0019] Preferably, when generating one or more prediction test cases, the generating module includes:
[0020] generating an output sequence of prediction test cases, each output of the output sequence comprising a corresponding probability distribution; and
[0021] generating the prediction test case according to the highest probability in the corresponding probability distribution of the output sequence;
[0022] Preferably, the generation and deployment system further comprises deploying the final front-end code;
[0023] Furthermore, a method for generating and deploying front-end and back-end codes based on a text AI model is proposed, and the method for generating and deploying the front-end and back-end codes based on a text AI model is applied to the system for generating and deploying the front-end and back-end codes based on the text AI model; the method for generating and deploying the front-end and back-end codes comprises the following steps:
[0024] S100: Obtain a user requirement description, at least one reference front-end code, at least one reference back-end code, and at least one test case for testing the reference front-end code;
[0025] S200: embedding the obtained user requirement description, reference front-end code, reference back-end code and test case to generate corresponding user requirement description embedding, reference front-end code embedding, reference back-end code embedding and test case embedding;
[0026] S300: Generate one or more prediction front-end codes and one or more prediction test cases according to the reference test combination;
[0027] S400: For each of the prediction front-end codes, use one or more of the prediction test cases to perform an accuracy test, and at least use the reference back-end code for the accuracy test;
[0028] S500: Select at least one of the prediction front-end codes and the reference front-end code that meet the requirements of the accuracy test for performance verification; and select one or more prediction front-end codes with better performance than the reference front-end code as the prediction front-end code to be output according to the result of the performance verification;
[0029] S600: Input the predicted front-end code to be output into the artificial intelligence text big model to obtain one or more code comments of the predicted front-end code to be output, and attach the code comments to the code segment, and output one or more final front-end codes with comments;
[0030] Preferably, in step S300, after generating one or more prediction test cases, a coverage breadth test is performed on the one or more prediction test cases to evaluate the test coverage breadth that can be achieved when the front-end code is tested using the one or more prediction test cases generated.
[0031] The beneficial effects achieved by the present invention are:
[0032] The generation and deployment system of this technical solution uses artificial intelligence text big models to automate the generation and testing of front-end code, significantly reducing the need for manual programming, which not only speeds up the development process, but also reduces defects caused by human errors; the automatically generated code is combined with automated testing to ensure that the function and performance of the code meet the preset standards, and also improve the reliability and stability of the software product;
[0033] The generation module and evaluation module in the generation and deployment system of the technical solution adopt deep learning technology, which can not only generate code, but also perform intelligent performance evaluation; by comparing the performance with the reference code, the system can select the code version with better performance for deployment. The above iterative optimization process based on performance feedback optimizes the final software product in terms of operating efficiency and resource consumption, which better meets the requirements of modern software for high performance;
[0034] The design of the output module of the generation and deployment system of this technical solution takes into account the long-term needs of software maintenance. The code comments automatically generated by the AI model enhance the readability and maintainability of the code; these comments explain the functions and working principles of the code in detail, making it easier for the development team to understand and maintain these automatically generated codes;
[0035] The software and hardware parts of the generation and deployment system of this technical solution adopt a modular design. The various working modules and components of the hardware part of the system, as well as the instructions, parameters, and algorithms of the software part can be easily replaced and / or upgraded later, thereby reducing the construction cost and maintenance cost of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The present invention can be further understood from the following description in conjunction with the accompanying drawings. The components in the figures are not necessarily drawn to scale, but the emphasis is placed on illustrating the principles of the embodiments. In different views, the same reference numerals designate corresponding parts.
[0037] Description of the accompanying drawings: 10-data acquisition module; 20-data embedding module; 30-generation module; 40-evaluation module; 50-output module; 60-operation module; 202-user demand description; 204-reference front-end code; 206-reference back-end code; 208-test case; 212-user demand description embedding; 214-reference front-end code embedding; 216-reference back-end code embedding; 218-test case embedding; 224-prediction front-end code; 228-prediction test case; 234-prediction front-end code to be output; 244-final front-end code; 500-computer device; 502-bus; 504-processor; 506-main memory; 508-read-only memory; 510-storage device; 512-display; 514-input device; 516-cursor control device; 518-network device;
[0038] Figure 1 It is a schematic diagram of the architecture of the generation and deployment system described in an embodiment of the present invention;
[0039] Figure 2 is a schematic diagram of the workflow of the evaluation module described in an embodiment of the present invention;
[0040] Figure 3 A step diagram of the generation and deployment method described in an embodiment of the present invention;
[0041] Figure 4 A schematic diagram of the workflow of each module within the generation and deployment system described in an embodiment of the present invention;
[0042] Figure 5 It is a schematic diagram of the framework of a computer device used in the generation and deployment system in an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with its embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. For those skilled in the art, after reviewing the following detailed description, other systems, methods and / or features of the present embodiment will become apparent. It is intended that all such additional systems, methods, features and advantages are included in this specification. Included within the scope of the present invention and protected by the appended claims. Additional features of the disclosed embodiments are described in the following detailed description, and these features will be apparent from the following detailed description.
[0044] The same or similar reference numerals in the drawings of the embodiments of the present invention correspond to the same or similar components; in the description of the present invention, it should be understood that if there are terms such as "upper", "lower", "left", "right" and the like indicating the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, it is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or component referred to must have a specific orientation. The invention is constructed and operated in a specific orientation, so the terms describing the positional relationship in the drawings are only used for exemplary description and cannot be understood as a limitation of this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.
[0045] Example 1: For example, a front-end and back-end code generation and deployment system based on a text AI model is proposed, as shown in the attached Figure 1 As shown, the generation and deployment system includes:
[0046] The data acquisition module 10 is configured to acquire a user requirement description, at least one section of reference front-end code, at least one section of reference back-end code, and at least one test case for testing the reference front-end code;
[0047] The data embedding module 20 is configured to embed the obtained user requirement description, reference front-end code, reference back-end code and test case, generate corresponding user requirement description embedding, reference front-end code embedding, reference back-end code embedding and test case embedding, and package the above embeddings to generate a reference test combination;
[0048] A generating module 30 is configured to generate one or more prediction front-end codes and one or more prediction test cases according to the reference test combination;
[0049] An evaluation module 40 is configured to evaluate the prediction front-end code and output the prediction front-end code to be output;
[0050] The output module 50 is configured to input the predicted front-end code to be output into the artificial intelligence text big model to obtain one or more code comments of the predicted front-end code to be output, attach the code comments to the code segment, and output one or more final front-end codes with comments;
[0051] The code generation and deployment system further includes a computing module 60, which is based on an artificial intelligence text big model and is coupled to the data embedding module 20, the generation module 30 and the output module 50, so as to use the artificial intelligence text big model to assist in completing the work of the above two modules;
[0052] Preferably, as attached Figure 2 As shown, the evaluation module 40 includes executing:
[0053] Using one or more of the prediction test cases, the prediction front-end code is subjected to an accuracy test, and at least the reference back-end code is used for the accuracy test;
[0054] Selecting at least one of the prediction front-end codes and the reference front-end code that meet the requirements of the accuracy test to perform performance testing;
[0055] According to the result of the performance test, one or more predicted front-end codes having performance better than the reference front-end code are selected as the predicted front-end code to be output;
[0056] Preferably, when generating one or more prediction test cases, the generating module 30 includes:
[0057] generating an output sequence of prediction test cases, each output of the output sequence comprising a corresponding probability distribution; and
[0058] generating the prediction test case according to the highest probability in the corresponding probability distribution of the output sequence;
[0059] Preferably, the generation and deployment system further comprises deploying the final front-end code;
[0060] Furthermore, a method for generating and deploying front-end and back-end codes based on a text AI model is proposed, and the method for generating and deploying front-end and back-end codes based on a text AI model is applied to the system for generating and deploying front-end and back-end codes based on a text AI model; as shown in the attached Figure 3 As shown, the generation and deployment method includes the following steps:
[0061] S100: Obtain a user requirement description, at least one reference front-end code, at least one reference back-end code, and at least one test case for testing the reference front-end code;
[0062] S200: embedding the obtained user requirement description, reference front-end code, reference back-end code and test case to generate corresponding user requirement description embedding, reference front-end code embedding, reference back-end code embedding and test case embedding;
[0063] S300: Generate one or more prediction front-end codes and one or more prediction test cases according to the reference test combination;
[0064] S400: For each of the prediction front-end codes, use one or more of the prediction test cases to perform an accuracy test, and at least use the reference back-end code for the accuracy test;
[0065] S500: Select at least one of the prediction front-end codes and the reference front-end code that meet the requirements of the accuracy test for performance verification; and select one or more prediction front-end codes with better performance than the reference front-end code as the prediction front-end code to be output according to the result of the performance verification;
[0066] S600: Input the predicted front-end code to be output into the artificial intelligence text big model to obtain one or more code comments of the predicted front-end code to be output, and attach the code comments to the code segment, and output one or more final front-end codes with comments;
[0067] Preferably, in step S300, after generating one or more prediction test cases, a coverage breadth test is performed on the one or more prediction test cases to evaluate the test coverage breadth that can be achieved when the front-end code is tested using the one or more prediction test cases generated;
[0068] As attached Figure 4 As shown, the interaction process of each module when generating the prediction front-end code and the test case is exemplarily described;
[0069] Preferably, the components involved, including the data embedding module 20, the generation module 30 and the evaluation module 40, are all pre-trained;
[0070] In an exemplary embodiment, the data embedding module 20 processes the user requirement description 202, the reference front-end code 204, the reference back-end code 206, and the test case 208, and converts these data into embedded data using the operation module 60 based on the artificial intelligence text big model;
[0071] Preferably, the data embedding module 20 performs data preprocessing on the data, including standardizing the user requirement description, formatting the reference front-end code and the reference back-end code, and performing similar processing on the test case; the preprocessing step ensures the consistency and cleanliness of the input data, which helps to improve the efficiency and accuracy of the subsequent embedding and learning process;
[0072] Further, the data embedding module 20 performs the generation of embedding vectors;
[0073] Preferably, the data embedding module 20 is communicatively coupled to the computing module 60, and calls the artificial intelligence model in the computing module 60 to generate the embedding vector;
[0074] Preferably, the operation module 60 includes using one or more combinations of a code2vec model, a CodeBERT model, and a graph neural network (GNN) model to generate an embedding vector;
[0075] Preferably, the operation module 60 includes converting the data of the user requirement description 202, the reference front-end code 204, the reference back-end code 206 and the test case 208 processed by the data embedding module 20 to be processed into a corresponding graph structure, and using the GNN model to process the graph structure; for example, the front-end code and the back-end code may be referenced to generate an abstract syntax tree (AST), and the GNN may be used to process the AST;
[0076] Further, the data embedding module 20 can be trained to process the user requirement description 202, the reference front-end code 204, the reference back-end code 206, and the test case 208, and generate a lower-dimensional embedding vector representation thereof; this method ensures that, in the latent space, the embeddings of functionally or semantically similar codes and test cases will be closer to each other, while the embeddings of codes and test cases with large differences will be farther apart; this helps subsequent modules to more accurately generate front-end codes that meet user requirements and provide effective test cases;
[0077] Preferably, for the user requirement description, the data embedding module 20 uses natural language processing technology to parse the user requirement description, extract keywords and phrases, such as functional requirements, performance requirements, etc., and convert them into embedding vectors; these embeddings capture the core content of the requirements, so that the model can understand the specific needs of the user;
[0078] Preferably, for the reference front-end code, the data embedding module 20 converts the reference front-end code into embedding vectors through code analysis techniques, such as syntax analysis and semantic analysis; these vectors contain the structural and behavioral characteristics of the code, so that the model can understand how the code responds to user needs;
[0079] Preferably, for the reference backend code, the backend code is also converted into an embedding vector after syntax and semantic analysis, which reveals the backend logic and data processing methods and provides necessary backend support information for the generation of the frontend code;
[0080] Preferably, for the test case, after the test case is converted into an embedded vector, the test logic and target of the test case for the reference front-end code are expressed, and subsequently, based on the same or similar test logic and target, a plurality of predefined prediction test cases can be used to verify the function and performance of the prediction front-end code;
[0081] Furthermore, the generation of embedding vectors can help the operation module 60 to deeply understand and match user requirements, reference codes, and test cases; by comparing the similarity between the user requirement embedding and the reference code embedding, the operation module 60 can identify what kind of front-end code matches the user requirement; this matching is based on the distance or similarity measurement between the embedding vectors, ensuring that the generated code is highly consistent with the user requirement;
[0082] Furthermore, the operation module 60 can also determine what kind of test case can effectively test the reference front-end code by analyzing the relationship between the reference front-end code embedding and the test case embedding; this not only improves the test coverage, but also ensures the pertinence and efficiency of the test;
[0083] Furthermore, embedded vectors are not only used for internal model training and code generation, but can also be used for external applications, such as quickly retrieving code solutions that meet specific requirements through vector search engines, or automatically recommending code and testing strategies that can solve similar problems;
[0084] Through the above operations, the data embedding module 20 not only provides an in-depth understanding of user requirements and reference codes, but also ensures that the generated front-end code and test cases can accurately correspond to and meet these requirements; this method based on deep learning and natural language processing technology greatly improves the automation level of software development, reduces manual intervention, and improves development efficiency and code quality;
[0085] In an exemplary preferred embodiment, the artificial intelligence model used to generate the prediction front-end code and / or the prediction test case may be a transformer neural network model, an encoder-decoder neural network model and / or other neural network models;
[0086] Furthermore, in the process of generating the front-end code, the content and elements of the back-end code need to be considered, because the collaborative work of the front-end and the back-end has a direct impact on the functionality, performance and user experience of the entire application; preferably;
[0087] More specifically, the relevant key backend content and elements include:
[0088] API interface definition: The front end needs to know which API interfaces are provided by the back end, including the API URL, request method (such as GET, POST, PUT, DELETE, etc.), required parameters, and returned data format; as well as the API interface data format, that is, the data type and structure (such as JSON, XML, etc.) returned by the back end API. The front end needs to parse and process these data formats;
[0089] Authentication and authorization security mechanisms, including front-end components usually need to implement authentication and authorization functions such as login and registration, so it is necessary to understand how the back-end handles authentication and authorization, including the authentication methods used, such as OAuth, JWT, etc.; also includes back-end session management: understand how the back-end manages user sessions, for example, what methods are used to save user status, such as cookies, session storage, etc.;
[0090] Error handling response and verification: The front-end component needs to perform appropriate error handling and user prompts based on the error codes returned by the back-end component, such as 404, 500, etc., as well as the error information; and, it also includes an understanding of data validation logic. The front-end may need to perform corresponding pre-validation to reduce invalid requests and improve user experience;
[0091] Business logic and data processing logic of backend components;
[0092] Furthermore, it also includes data persistence of backend components, such as database interaction; multi-language support of backend components; real-time data processing, such as WebSocket or long polling, etc.
[0093] Taking these backend contents and elements into account in the frontend code generation process can not only ensure the seamless cooperation between the frontend and backend, but also greatly improve the quality, performance and user experience of the final application;
[0094] Based on the above requirements, after receiving the user requirement description embedding 212, the reference front-end code embedding 214, the reference back-end code embedding 216 and the test case 218 embedding, the generation module 30 uses the text model in the operation module 60, such as a neural network model based on a Transformer or encoder-decoder architecture, to generate a predicted front-end code; the operation module 60 integrates and parses the embedded data from different sources to fully understand the interaction between the functional requirements and the existing system; then, the model synthesizes the front-end code according to the parsed requirements and the programming mode of the reference code;
[0095] In addition, the model will also consider test case embedding during the generation process to ensure that the generated code not only meets the functional requirements but also passes the predetermined test cases; this test-driven development strategy helps to identify and solve potential problems in advance and enhance the robustness of the code; the generated code may need further adjustment or optimization after the initial internal test, and the generation module 30 will adjust the model based on the feedback and optimize the code generation process; finally, the front-end code output by the operation module 60 will be formatted and annotated to improve its readability and maintainability, ensuring that the generated prediction front-end code meets the functional requirements;
[0096] Furthermore, the evaluation module 40 needs to evaluate the generated prediction front-end code, and the evaluation includes accuracy testing and performance testing;
[0097] Among them, the goal of accuracy testing is to verify whether the generated prediction front-end code can achieve the predetermined functions and seamlessly connect with the back-end system; in the test execution phase, the newly generated front-end code will be integrated with the reference back-end code to test whether the interaction between the two parts of the code is as expected; integration testing can be performed in a simulation environment or on the actual back-end service to verify whether the front-end code handles the back-end request correctly and whether the data exchange is accurate; accuracy testing can be performed by an automated testing framework, such as a CI / CD framework, which can efficiently run a large number of test cases and record detailed test results;
[0098] The prediction front-end code that has passed the accuracy test is further subjected to performance testing. The main purpose of performance testing is to evaluate the specific performance of the prediction front-end code in the actual deployment environment, such as response speed, resource utilization efficiency, and user experience, and also includes comparing whether the prediction front-end code has higher performance than the reference front-end code. Performance testing simulates user interaction scenarios in the real world as accurately as possible and measures various performance indicators to evaluate the operating efficiency of the code.
[0099] Preferably, before starting performance testing, you first need to define a series of performance indicators, which usually include page loading time, response time, memory usage, CPU occupancy, etc.
[0100] Performance testing can be performed using specialized automation tools, such as LoadRunner, JMeter, or WebPageTest. These automation tools can simulate a large number of concurrent user accesses to test the performance of the front-end code under high load conditions. During the test, the test tool will measure all defined performance indicators and collect data such as page loading time, server response time, and resource consumption of the front-end application.
[0101] Preferably, multiple prediction test cases can be used to test the same prediction front-end code or reference front-end code to statistically analyze the performance of the front-end code under different test cases; preferably, the same prediction test case can be used to test multiple prediction front-end codes and reference front-end codes to statistically analyze the performance of different front-end codes under the same test case;
[0102] Finally, based on the results of the performance test, one or more predicted front-end codes having better performance than the reference front-end code are selected as the predicted front-end code 234 to be output.
[0103] Embodiment 2: This embodiment should be understood to include at least all the features of any of the above embodiments, and further improve upon them;
[0104] In a preferred exemplary embodiment, after generating a plurality of the prediction test cases, the test coverage breadth of the generated plurality of prediction test cases is evaluated to evaluate whether the prediction front-end code can be tested by using the generated prediction test cases to examine the possible test scenarios involved;
[0105] The concept of vector can be used to describe and quantify the breadth of test case coverage; in this case, we can regard each test case as a vector, and the functions and conditions of the entire code base can be regarded as a vector space; by calculating the relationship between the test case vector and the code feature vector, we can quantify the breadth of test case coverage;
[0106] Preferably, the specific steps include:
[0107] Define a vector space, and define each function or condition in the code base as a dimension in the vector space; for example, if there are n independent function points or condition judgments in the code base, you can construct an n-dimensional vector space, where each dimension represents the coverage of a function point;
[0108] Construct a test case embedding vector, and embed each test case as a vector, where the value of each dimension can be 0 or 1, 0 means that the corresponding function point or condition is not covered by the test case, and 1 means that it is completely covered; for example, if a test case embedding covers the 1st, 10th and 15th function points, then the vector of the test case has a value of 1 in the 1st, 10th and 15th dimensions, and a value of 0 in the remaining dimensions; in more exemplary embodiments, the value of each dimension can be a value between 0 and 1, which is used to express that the coverage performance in this dimension may be vague or incomplete;
[0109] Calculate the test coverage breadth that can be achieved by a test set consisting of one or more of the above-mentioned prediction test cases; optionally, one or more of the following calculation methods may be used for calculation:
[0110] Optionally, calculate the norm of the vector, such as the L1 norm, to measure the breadth of coverage; the L1 norm is the sum of the absolute values of all elements in the vector. For a test case vector, it is equivalent to the number of function points covered by the test:
[0111] For a given vector, its L1 norm is:
[0112] ;
[0113] In the above formula, x i is the value of the i-th element of the vector;
[0114] A complete test set may contain multiple predictive test cases. The vectors of all predictive test cases can be synthesized element by element with the maximum value to obtain a new vector. Each element of this vector indicates that at least one test case covers the corresponding function point. By calculating the L1 norm of this synthesized vector, the number of function points covered by the entire test set can be obtained.
[0115] Embodiment 3: This embodiment should be understood to include at least all the features of any of the above embodiments, and further improve upon them;
[0116] For example, as shown in the attached Figure 5 As shown, an implementation of a computer device 500 used in the generation and deployment system is described; the computer device 500 can be applied to the data storage, calculation and result output process of each working module in the system;
[0117] Illustratively, the computer device 500 includes a bus 502 or other communication mechanism for communicating information, one or more processors 504 coupled to the bus 502 for processing information; the processor 504 may be, for example, one or more general-purpose microprocessors;
[0118] The computer apparatus 500 also includes a main memory 506, such as a random access memory (RAM), a cache, and / or other dynamic storage device, coupled to the bus 502 for storing information and instructions to be executed by the processor 504; the main memory 506 may also be used to store temporary variables or other intermediate information during the execution of instructions to be executed by the processor 504; these instructions, when stored in a storage medium accessible to the processor 504, present the computer apparatus 500 as a special-purpose machine customized to perform the operations specified in the instructions;
[0119] The computer device 500 may also include a read-only memory (ROM) 508 or other static storage device coupled to the bus 502 for storing static information and instructions for the processor 504; a storage device 510 such as a disk, an optical disk, or a USB drive (flash drive) will be coupled to the bus 502 for storing information and instructions;
[0120] And further, coupled to the bus 502 may also include a display 512 for displaying various information, data, media, etc., an input device 514 for allowing a user of the computer device 500 to control, manipulate, and / or interact with the computer device 500;
[0121] A preferred way to interact with the management system may be through a cursor control device 516, such as a computer mouse or similar control / navigation mechanism;
[0122] Furthermore, the computer device 500 may also include a network device 518 coupled to the bus 502; wherein the network device 518 may include, for example, a wired network card, a wireless network card, a switching chip, a router, a switch, and other components;
[0123] In general, the terms "engine", "component", "system", "database", etc., as used herein, may refer to logic embodied in hardware or firmware, or to a collection of software instructions, possibly with entry and exit points, written in a programming language such as Java, C, or C++; software components may be compiled and linked into executable programs, installed in a dynamic link library, or may be written in an interpreted programming language (e.g., BASIC, Perl, or Python); it should be understood that software components may be called from other components or from themselves, and / or may be called in response to detected events or interrupts;
[0124] Software components configured to execute on a computing device may be provided on a computer-readable medium, such as a compact disc, digital video disc, flash drive, diskette, or any other tangible medium, or as a digital download (and may be initially stored) in a compressed or installable format that requires installation, decompression, or decryption prior to execution); such software code may be stored in part or in whole on a memory device of the executing computing device for execution by the computing device; software instructions may be embedded in firmware, such as an EPROM; it is also understood that hardware components may be composed of connected logic units (such as gates and flip-flops), and / or may be composed of programmable units (such as programmable gate arrays or processors);
[0125] The computer apparatus 500 includes a computer system that can implement the techniques described herein using custom hard-wired logic, one or more ASICs or FPGAs, firmware, and / or program logic that, in combination with a computer system, renders the computer apparatus 500 a special-purpose computing device;
[0126] According to one or more embodiments, the techniques herein may be performed by computer apparatus 500 in response to processor 504 executing one or more sequences of one or more instructions contained in main memory 506; such instructions may be read into main memory 506 from another storage medium, such as storage device 510; execution of the sequences of instructions contained in main memory 506 causes processor 504 to perform the process steps described herein; in alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions;
[0127] As used herein, the term "non-transitory media" and similar terms refer to any media that store data and / or instructions that cause a machine to operate in a specific manner; such non-transitory media may include non-volatile media and / or volatile media; non-volatile media include, for example, optical or magnetic disks, such as storage device 510; volatile media include dynamic memory, such as main memory 506;
[0128] Among them, common forms of non-transitory media include, for example, floppy disks, diskettes, hard disks, solid-state drives, magnetic tapes or any other magnetic data storage medium, CD-ROMs, any other optical data storage medium, any physical medium having a pattern of holes, RAM, PROM and EPROM, FLASH-EPROM, NVRAM, any other memory chip or cartridge, and networked versions thereof;
[0129] Non-transient media are distinct from transmission media but may be used in conjunction with transmission media; transmission media participate in the transmission of information between non-transient media; for example, transmission media include coaxial cables, copper wires, and optical fibers, including the wires that make up bus 502; transmission media may also take the form of sound waves or light waves, such as radio waves and infrared data communications.
[0130] Although the present invention has been described above with reference to various embodiments, it should be understood that many changes and modifications may be made without departing from the scope of the present invention. That is, the methods, systems and devices discussed above are examples. Various configurations may appropriately omit, replace or add various processes or components. For example, in alternative configurations, the method may be performed in an order different from the order described, and / or various components may be added, omitted and / or combined. Moreover, the features described with respect to certain configurations may be combined in various other configurations, such as different aspects and elements of the configurations may be combined in a similar manner. In addition, the elements therein may be updated as the technology develops, i.e., many elements are examples and do not limit the scope of the present disclosure or claims.
[0131] Specific details are given in the specification to provide a thorough understanding of the exemplary configurations including implementations. However, the configurations may be practiced without these specific details. For example, well-known circuits, processes, algorithms, structures, and techniques have been shown without unnecessary details to avoid obscuring the configurations. This description provides only example configurations and does not limit the scope, applicability, or configurations of the claims. On the contrary, the foregoing description of the configurations will provide those skilled in the art with an enabling description for implementing the described techniques. Various changes may be made to the functions and arrangements of the elements without departing from the spirit or scope of the present disclosure.
[0132] In summary, it is intended that the above detailed description is considered to be illustrative rather than restrictive, and it should be understood that the above embodiments should be understood to be only used to illustrate the present invention and not to limit the scope of protection of the present invention. After reading the contents of the present invention, the technician can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A front-end and back-end code generation and deployment system based on a text AI model, characterized in that: The generation and deployment system includes: A data acquisition module is configured to acquire a user requirement description, at least one section of reference front-end code, at least one section of reference back-end code, and at least one test case for testing the reference front-end code; A data embedding module is configured to embed the acquired user requirement description, reference front-end code, reference back-end code and test case, generate corresponding user requirement description embedding, reference front-end code embedding, reference back-end code embedding and test case embedding, and package the above embeddings to generate a reference test combination; A generation module, configured to generate one or more prediction front-end codes and one or more prediction test cases according to the reference test combination; An evaluation module, configured to evaluate the prediction front-end code and output the prediction front-end code to be output; An output module is configured to input the predicted front-end code to be output into the artificial intelligence text big model to obtain one or more code comments of the predicted front-end code to be output, attach the code comments to the code segment, and output one or more final front-end codes with comments; The code generation and deployment system further includes a computing module, which is based on the artificial intelligence text big model and is coupled to the data embedding module, the generation module and the output module to use the artificial intelligence text big model to assist in completing the work of the above two modules. The assessment module includes the execution of: Using one or more of the prediction test cases, the prediction front-end code is subjected to an accuracy test, and at least the reference back-end code is used for the accuracy test; Selecting at least one of the prediction front-end codes and the reference front-end code that meet the requirements of the accuracy test to perform performance testing; According to the result of the performance test, one or more predicted front-end codes having performance better than the reference front-end code are selected as the predicted front-end code to be output; When generating one or more prediction test cases, the generating module includes: generating an output sequence of prediction test cases, each output of the output sequence comprising a corresponding probability distribution; and The prediction test case is generated according to the highest probability in the corresponding probability distribution of the output sequence.
2. The generation and deployment system as claimed in claim 1, characterized in that: The generation and deployment system also includes deploying the final front-end code.
3. A front-end and back-end code generation and deployment method based on a text AI model for a generation and deployment system as claimed in any one of claims 1 to 2, characterized in that: The generation and deployment method comprises the following steps: S100: Obtain a user requirement description, at least one reference front-end code, at least one reference back-end code, and at least one test case for testing the reference front-end code; S200: embedding the obtained user requirement description, reference front-end code, reference back-end code and test case to generate corresponding user requirement description embedding, reference front-end code embedding, reference back-end code embedding and test case embedding; S300: Generate one or more prediction front-end codes and one or more prediction test cases according to the reference test combination; S400: For each of the prediction front-end codes, use one or more of the prediction test cases to perform an accuracy test, and at least use the reference back-end code for the accuracy test; S500: Select at least one of the prediction front-end codes and the reference front-end code that meet the requirements of the accuracy test for performance verification; and select one or more prediction front-end codes with better performance than the reference front-end code as the prediction front-end code to be output according to the result of the performance verification; S600: Input the predicted front-end code to be output into the artificial intelligence text big model to obtain one or more code comments of the predicted front-end code to be output, and attach the code comments to the code segment, and output one or more final front-end codes with comments.
4. The generation and deployment method according to claim 3, characterized in that: In step S300, after generating one or more prediction test cases, a coverage breadth test is performed on the one or more prediction test cases to evaluate the test coverage breadth that can be achieved when the front-end code is tested using the one or more prediction test cases generated.
5. An electronic device, characterized in that: The electronic device includes: a processor, a memory and a bus, the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the generation and deployment method as described in claim 4 are performed.
