Test method and device based on table operation, equipment and storage medium
By obtaining the user's table operation instructions and converting them into target code, running against preset table files and determining the execution status and effect, the problem of inefficient testing in the existing technology is solved, and an efficient and universal testing process is achieved.
Patent Information
- Application Number
- CN202411917216.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-15
AI Technical Summary
The prior art is inefficient after the test user's table operation instructions are converted into code, and cannot meet the diverse natural language input and uncontrollable code generation requirements, resulting in inefficient testing.
By obtaining the user's table operation instructions, converting them into target code, and running the code against the preset table file, determining the execution status and accuracy of the execution effect, and determining the test results based on this information.
Improve testing efficiency, realize universal testing, save labor costs, and be able to automatically judge the execution effect of multiple correct situations.
Smart Images

Figure CN119829447A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of table testing technology, and in particular to a table operation-based testing method, apparatus, device, and storage medium. Background Art
[0002] Currently, when operating a table, the natural language input by the user (table operation instructions) can be converted into code for operating the table through a large language model. By running the code, the purpose of operating the table through dialogue instructions can be achieved.
[0003] However, due to the uncontrollability of large language models, the converted code often cannot meet the actual needs of users, so the converted code needs to be tested. The current practice is to manually verify it with the naked eye, or to manually write test cases for automatic verification. However, due to the diversity of natural languages input by users and the uncontrollability of the converted code, developers cannot write universal test cases for testing. Moreover, which natural language corresponds to which test cases still needs to be determined manually, which leads to the problem of unsatisfactory test efficiency. Summary of the invention
[0004] The embodiments of the present application provide a test method, apparatus, device and storage medium based on table operation, which can improve test efficiency and save time.
[0005] In a first aspect, the present application provides a test method based on table operation, comprising:
[0006] Obtaining a table operation instruction from a user, and converting the table operation instruction into a target code for executing the table operation;
[0007] Running the target code for a preset table file, wherein the target code is used to operate the table file;
[0008] Determining an execution state of the object code;
[0009] In the case where it is determined that the execution status is successfully executed, determining the accuracy of the execution effect after the table file successfully executes the target code;
[0010] Based on the accuracy of the execution state and / or the execution effect, a test result of converting the table operation instruction into the target code is determined.
[0011] In a second aspect, an embodiment of the present application provides a test device based on table operation, including:
[0012] An acquisition module, used for acquiring a table operation instruction from a user, and converting the table operation instruction into a target code for executing the table operation;
[0013] A code running module, used for running the target code for a preset table file, wherein the target code is used for operating the table file;
[0014] A code execution status determination module, used to determine the execution status of the target code;
[0015] An execution effect accuracy determination module, for determining the accuracy of the execution effect after the table file successfully executes the target code, when the execution status is determined to be successful;
[0016] A test result determination module is used to determine a test result of converting the table operation instruction into the target code based on the accuracy of the execution state and / or the execution effect.
[0017] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0018] Memory for storing computer programs;
[0019] The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method provided in the embodiment of the present application is implemented.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method provided in the embodiment of the present application is implemented.
[0021] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the technical scheme provided by the embodiment of the present application, by obtaining the table operation instructions of the user and converting them into target code, runs the target code for a preset table file, determines the execution status of the target code, and when the execution status is successful, determines the accuracy of the execution effect of executing the target code, and determines the test result of converting the table operation instructions into the target code based on the execution status and / or the accuracy of the execution effect; that is, by first determining the execution status of the target code, and when the execution is successful, then determining the accuracy of the execution effect of the target code, thereby obtaining the test result, this method can improve the test efficiency, has universality, and can save labor costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0024] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0025] Figure 1 It is a flow chart of a test method based on table operation provided in an embodiment of the present application;
[0026] Figure 2 It is a category diagram of table operation instructions;
[0027] Figure 3 It is a flow chart of a test method based on table operation provided in an embodiment of the present application;
[0028] Figure 4 It is a screenshot of the macro editor without a pop-up window;
[0029] Figure 5 This is a screenshot of the macro editor with a pop-up window;
[0030] Figure 6 It is a screenshot of the table execution effect;
[0031] Figure 7 A flowchart of an embodiment of the present application is provided for calculating similarity between a screenshot of a table execution effect as the table data and a screenshot of a table execution effect as the reference data, and determining the accuracy of the execution effect based on the similarity;
[0032] Figure 8 It is a schematic diagram of the calculation results of structural similarity;
[0033] Fig. 9 It is a flow chart of a test method based on table operation provided in an embodiment of the present application;
[0034] Fig.10 It is a schematic diagram of the structure of a test device based on table operation provided in an embodiment of the present application;
[0035] Fig.11 It is a structural diagram of an electronic device. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0037] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0038] In order to solve the problem of test efficiency in the prior art, the embodiments of the present application provide a test method, apparatus, device and storage medium based on table operation, which can improve test efficiency, have universal applicability, and save labor costs.
[0039] Figure 1 It is a flow chart of a test method based on table operation provided in an embodiment of the present application. The method can be executed by a test device based on table operation. The device can be configured in a test tool, and the test tool is configured in an electronic device such as a computer.
[0040] like Figure 1 As shown, the technical solution provided in the embodiment of the present application includes the following steps:
[0041] S110: Acquire a table operation instruction from a user, and convert the table operation instruction into a target code for executing the table operation.
[0042] In the embodiment of the present application, the operation on the table can be understood as applying the table operation instruction to the entire table. Each table operation instruction can be converted into a corresponding target code, which can be a JS code or a code in other formats, and the table operation instruction and the table on which it is applied can be used as a use case.
[0043] In the embodiment of the present application, the user's table operation instructions can be classified into Figure 2 One of the instructions shown. Among them, the table operation instruction may include questions for table operation raised in natural language, directive expressions, etc.
[0044] In an embodiment of the present application, there are multiple ways to convert table operation instructions into target codes. It can be implemented through a large language model, or it can be implemented by combining preset rules with table information, or it can be implemented by querying a preset relationship table, or it can be implemented in other ways.
[0045] S120: Running the target code for a preset table file, where the target code is used to operate the table file.
[0046] In this embodiment, for a preset table file, the target code can be run in an operating environment, which can be a terminal that runs the target code, or a code editor that can edit and run the target code, such as a table macro editor, a python code editor, a JS code editor, or a command terminal (CommandTerminal) that can run the target code, wherein the terminal can be a software terminal. Thus, the execution (running) state of the target code can be determined by running the target code.
[0047] S130: Determine the execution status of the target code.
[0048] In this embodiment, the execution status of the target code may be execution success or execution failure. The execution status of the target code may be determined by display features in the running environment of the target code. These display features may include a pop-up window indicating an error, or display information of the running environment console, etc. The execution status of the target code is judged by these display features to determine whether the target code is executed successfully.
[0049] S140: When it is determined that the execution status is successfully executed, determine the accuracy of the execution effect after the table file successfully executes the target code.
[0050] In this embodiment, even if the target code is executed successfully, it is still not possible to determine whether the execution effect of the target code is correct. Therefore, it is necessary to determine whether the execution effect of the target code is executed accurately, so as to determine whether the target code is accurate.
[0051] Specifically, the table data after the table file successfully executes the target code can be similarly calculated with the reference data in the preset correct data set, and the accuracy of the target code execution effect can be determined by the similarity. The reference data is: in the historical test, the table data corresponding to the table file after the successful and correct execution of any code. The table data can be the file data corresponding to the changed part of the table file generated by the target code operation or a screenshot of the table execution effect.
[0052] S150: Determine a test result of converting the table operation instruction into the target code based on the accuracy of the execution state and / or the execution effect.
[0053] Specifically, the test result of converting the table operation instruction into the target code is obtained by summarizing the cases where the target code execution status is execution failure, the table file successfully executes the target code with accurate execution effect, and the execution effect is inaccurate, wherein the target code execution status is execution failure, indicating that the target code is inaccurate; if the execution effect after the table file executes the target code is inaccurate, it indicates that the target code is inaccurate. If the execution status of the target code is execution success, and the execution effect after the table file executes the target code is accurate, it indicates that the target code is accurate. Through the above summary, the test result of the target code accuracy can be obtained. For the case where no test result can be obtained, manual judgment can be performed.
[0054] The technical solution provided by the embodiment of the present application obtains the user's table operation instructions and converts them into target code, runs the target code for a preset table file, determines the execution status of the target code, and when the execution status is successful, determines the accuracy of the execution effect of executing the target code, and determines the test result of converting the table operation instructions into the target code based on the execution status and / or the accuracy of the execution effect; that is, by first determining the execution status of the target code, and when the execution is successful, then determining the accuracy of the execution effect after the table file executes the target code, thereby obtaining the test result. This method can improve test efficiency, has universal applicability, and can save labor costs.
[0055] Specifically, the failure of the target code to execute, the execution status of the target code to execute successfully, and the accurate execution effect after the table file executes the target code can all be directly determined through the above-mentioned similarity calculation without human intervention.
[0056] Figure 3 This is a test method flow based on table operation provided in an embodiment of the present application. In this embodiment, the above steps S130 and S140 are refined, such as Figure 3 As shown, the method comprises the following steps:
[0057] S210: Acquire a table operation instruction from a user, and convert the table operation instruction into a target code for executing the table operation.
[0058] In this embodiment, optionally, converting the table operation instruction into a target code for executing the table operation includes: constructing a prompt word based on the table operation instruction, inputting the prompt word into a large language model, and obtaining a corresponding target code.
[0059] In this embodiment, the table operation can be realized by communicating with the large language model. Specifically, the table operation instruction expressed by the user in natural language is obtained, a prompt word (for example, a prompt word) is constructed based on the table operation instruction, the prompt word is input into the large language model, the target code is obtained, and the target code is run in the macro editor of the table to realize the table operation. Among them, the prompt word is mainly used to communicate with the large language model, transmit the user's intention and instructions to the machine, and thus generate results that meet the user's expectations.
[0060] S220: Running the target code for a preset table file, where the target code is used to operate the table file.
[0061] S230: In the running environment of the target code, detecting a preset display feature, and determining the execution state of the target code based on the display feature.
[0062] In this embodiment, the display feature may include a pop-up window for execution error, or display information of the console in the running environment. The display information may be displayed text, such as: end of operation, completion of operation, termination of operation, operation error, syntax error, object not found, etc. Therefore, the execution status can be determined based on the display information.
[0063] In one implementation of the embodiment of the present application, optionally, the preset display feature is a pop-up window indicating an execution error, and the determination of the execution status of the target code based on the display feature includes: when any type of the pop-up window is detected, the execution status of the target code is execution failure; or, when the pop-up window is detected as not existing, the execution status of the target code is execution success. Specifically, when the target code is running, if any type of pop-up window is detected, the execution status of the target code is execution failure, indicating that the target code is also incorrect. If any type of pop-up window is detected as not existing, the execution status of the target code is execution success, but the accuracy of the target code cannot be determined.
[0064] In addition, due to the variety of pop-up windows, the uncertainty of the position and size of the pop-up windows, in some cases (such as the web side), it is difficult to determine the pop-up windows by means of handles, etc., and the identification is cumbersome and not very convenient. Therefore, the interface containing the pop-up window can be screenshotted and input into the trained neural network model. The neural network model is used to classify whether there is a pop-up window, which is simple and accurate. Specifically, the screenshot of the interface containing the pop-up window is input into the trained neural network model to classify whether there is a pop-up window, and the classification result of whether there is a pop-up window is output, and the execution status of the target code is determined based on the classification result. If the classification result is that there is a pop-up window, it indicates that the target code execution failed. If the classification result is that there is no pop-up window, it indicates that the target code execution is successful. Therefore, by using the neural network model to classify whether there is a pop-up window, a variety of pop-up windows can be identified, which is simple and accurate, and the recognition efficiency can be improved. Optionally, the keyword may be recognized by optical character recognition (OCR) technology, and if the recognized keyword belongs to the keyword in the pop-up window, it is determined that the pop-up window is detected; if the keyword in the pop-up window is not recognized, it is determined that the pop-up window is not detected.
[0065] In this embodiment, when the target code is run in the macro editor of the table, the display features in the macro editor screenshot can be detected to determine the execution status of the target code. Specifically, the execution status of the target code is determined by detecting whether there is a pop-up window in the macro editor screenshot. For example, when the macro editor screenshot is detected to have a pop-up window, the execution status of the target code is determined to be execution failure; when the macro editor screenshot is detected to have no pop-up window, the execution status of the target code is determined to be execution success. Among them, the macro editor screenshot without a pop-up window can be referred to. Figure 4 , the screenshot of the macro editor with pop-up window can be referenced Figure 5 It should be noted that the reference Figure 4 and Figure 5 , you can see the difference between a pop-up window and no pop-up window. Figure 4 and Figure 5 The specific content of the code and Figure 5 The content displayed in the pop-up window is not clearly displayed, and the unclear parts can be ignored.
[0066] S240: When it is determined that the execution status is successful, the table data of the table file after successfully executing the target code is calculated similarity with the reference data in the preset correct data set, and the accuracy of the execution effect is determined based on the similarity; the reference data is: in historical tests, the table data corresponding to the table file generated after successfully and correctly executing any code.
[0067] In this embodiment, since "the reference data is: in historical tests, the table data corresponding to the table file generated after successfully and correctly executing any code", for the situation where the table operation instructions are converted into different target codes, but the different target codes represent the execution of the same table operation, the technical solution provided by the present application can quickly and automatically determine the new converted target code that has not appeared before by matching with the reference data. If the same execution effect can be found, the correctness of the target code can be considered. Compared with the manual determination method in the prior art, the efficiency is improved and better results are achieved.
[0068] In one implementation of an embodiment of the present application, optionally, the table data includes at least file data corresponding to the changed part generated by the target code operating the table file, and the reference data is: in historical tests, the file data corresponding to the table file generated after the successful and correct execution of any code.
[0069] Accordingly, the table data after the target code is successfully executed in the table file is similarly calculated with reference data in a preset correct data set, and the accuracy of the execution effect is determined based on the similarity, including: performing similarity calculation on the content and / or attributes of the table data and the reference data on the file data, and determining the accuracy of the execution effect based on the similarity. The file data may be extensible markup language (xml) data.
[0070] Specifically, for table data and reference data, performing similarity calculation on content on file data can be specifically implemented by calculating the similarity between the content of the file data as table data and the content of the file data as reference data, specifically by calculating the similarity of data such as characters and images in the same cells of the two.
[0071] Specifically, for the table data and the reference data, the similarity calculation on the attributes of the file data can be specifically implemented as follows: the attributes of the file data as the table data are compared with the attributes of the file data as the reference data to determine the attribute similarity. If the attributes are the same, the similarity is the greatest. If the attributes are the same, it is determined that the execution effect after the table file executes the target code is accurate.
[0072] In another implementation of the embodiment of the present application, optionally, the table data includes at least a screenshot of the table execution effect corresponding to the changed part generated by the target code operating the table file, and the reference data is: in historical tests, the screenshot of the table execution effect generated after the table file successfully executes and correctly executes any code.
[0073] After executing any code, the table jumps to the area in the table where the execution result is located, and a screenshot of at least the position including the area is taken to obtain a screenshot of the table execution effect.
[0074] The table data after the table file successfully executes the target code is matched with the reference data in the preset correct data set, and the accuracy of the execution effect is determined based on the matching degree of the matching, including: performing similarity calculation on the table execution effect screenshot as the table data and the table execution effect screenshot as the reference data, and determining the accuracy of the execution effect based on the similarity.
[0075] Specifically, to calculate the similarity between the screenshot of the table execution effect as the table data and the screenshot of the table execution effect as the reference data, the evaluation index of structural similarity index (SSIM) can be considered. Among them, SSIM is a number between 0 and 1. The larger the SSIM is, the smaller the difference between the two images is. Alternatively, the Peak Signal-to-Noise Ratio (PSNR) can be considered as an evaluation index. The larger the PSNR is, the smaller the difference between the two images is. Alternatively, the Learned Perceptual Image Patch Similarity (LPIPS) evaluation index can be considered. The lower the LPIPS value is, the more similar the two images are. Conversely, the greater the difference is. Alternatively, other image evaluation indicators can be used.
[0076] Among them, the preset correct data set includes table execution effect screenshots as reference data. The table execution effect screenshots with execution effect labels in historical tests can be imported into the correct data set to become reference data, and each table execution effect screenshot has a label with correct execution effect or a label with incorrect execution effect, wherein the table execution effect screenshots in historical tests are judged by script or manually to determine whether the execution effect is correct. Among them, script judgment can be understood as judgment through a test tool, and the test tool can be a test tool provided in an embodiment of the present application, or it can also be other tools that realize the judgment function. As the data in the preset correct data set becomes larger and larger, subsequent test results can gradually be determined only by similarity judgment, without the need to introduce manual script writing or content viewing and judgment.
[0077] In this embodiment, the similarity between the table execution effect screenshot as table data and the table execution effect screenshot as reference data belonging to the same use case is calculated, and the similarity is used to determine whether the execution effect of the table file successfully executing the target code is correct. Specifically, each table execution effect screenshot of this test is traversed, and for each table execution effect screenshot, the table execution effect screenshot is compared with the table execution effect screenshot with the same number as the reference data in the correct data set (guaranteed to be the same use case), and the similarity is calculated for each picture pair. Among them, the table operation instruction corresponds to the table file, the corresponding target code and the corresponding table execution effect screenshot. Among them, the table operation instruction and the table file of the action can be used as a use case, and the table execution effect screenshots corresponding to different use cases can be distinguished by numbers. For example, if there are 500 use cases, that is, 500 test data, there are 500 table execution effect screenshots corresponding to the change part of the target code operation table file, and these table execution effect screenshots can also be distinguished by corresponding numbers. Among them, after the table file executes the target code, it will jump to the interface where the change part of the table file is located, so that it is easy to understand the table execution effect. Among them, the form of the screenshot of the execution effect can be referred to Figure 6 ,like Figure 6 As shown, the table execution effect screenshot is a screenshot of the table execution effect corresponding to the filtering operation.
[0078] Figure 7 The present invention provides a flowchart of calculating the similarity between a screenshot of a table execution effect as the table data and a screenshot of a table execution effect as the reference data, and determining the accuracy of the execution effect based on the similarity, as shown in FIG. Figure 7 As shown, the method comprises the following steps:
[0079] S310: For each use case, among the table execution effect screenshots serving as parameter data, select a table execution effect screenshot that belongs to the same use case as the table execution effect screenshot serving as table data as the target table execution effect screenshot; wherein the table execution effect screenshot serving as parameter data is provided with an execution effect label; wherein the execution effect label includes a label indicating a correct execution effect or a label indicating an incorrect execution.
[0080] S320: Calculate the similarity between the form execution effect screenshot as the form data and each selected target form execution effect screenshot.
[0081] S330: If the maximum similarity value is greater than a preset threshold, the execution effect label of the target table execution effect screenshot corresponding to the maximum similarity value is determined as the label of the table execution effect screenshot as the table data.
[0082] A unified introduction is given to S310-S330. For each use case, each test generates a table execution effect screenshot. If the correct data set also contains table execution effect screenshots of n historical tests, if the correct data set contains n table execution effect screenshots that belong to the same use case as the table execution effect screenshot of this test, it contains n target table execution effect screenshots. For each use case, calculate the structural similarity (SSIM) between the table execution effect screenshot of this test and each target table execution effect screenshot. The results of the structural similarity calculation can be referred to Figure 8 , where column A represents the use case number, and the first column of every two columns thereafter represents the label assigned during this test (1 represents correct effect, 2 represents incorrect effect); the second column represents the SSIM comparison result between the execution effect screenshot of the table in this test and the execution effect screenshot of the table belonging to the same use case in the historical test in the correct data set.
[0083] For each use case, if the maximum value of SSIM is greater than the preset threshold, select the target table execution effect screenshot corresponding to the maximum value of SSIM, and use the execution effect label of the target table execution effect screenshot as the label of the table execution effect screenshot of this test. That is to say, the target table execution effect screenshot corresponding to the maximum value of SSIM is basically the same as the table execution effect screenshot of this test, so if the target table execution effect screenshot is correct or incorrect, the table execution effect screenshot of this test is also correct or incorrect accordingly. The preset threshold can be 0.99. The preset threshold can be an empirical value.
[0084] In the above-mentioned test of the execution effect of the code by performing the technical solution of calculating the similarity of the content on the file data for the table data and the reference data, specifically, an XML tool is developed to obtain the table execution effect by executing the preset code, and then save it as file data, and the table execution effect after the code execution and the execution result of the preset code are converted into XML source code to compare the fields of interest, so as to test whether the table execution effect of the code is correct. However, it is aimed at the execution effect of a single correct situation, and the test is realized by comparing the execution effect of a single correct situation by presetting it, but there may be multiple correct execution effects for the user's table operation instructions.
[0085] Specifically, for the user's unified table operation instructions, since the large language model may output different results each time, multiple codes (or instructions) may be generated. After the code is executed, the execution effects of the code are different, but they are all correct, which means that the generated multiple codes are all correct, that is, the code is executable and the execution effect is correct. For example, the user's operation instruction is to mark a certain data in red, and the execution effect is to mark the data in red with different shades of red, and there are multiple correct execution effects. For another example, the copy, paste, and selection of the table will affect one or more attributes in the xml file, which may lead to different copy and paste operations. Although the corresponding displayed content is consistent, the attribute value or attribute number of the attribute corresponding to the content is different. However, if the attributes of the fields are compared on the file data, it is easy to conclude that the attributes are different, that is, to further determine that the target code is executed inaccurately. But in fact, the result of executing different target codes corresponding to the copy and paste operation is that the displayed content is consistent, which means that the target code is executed accurately.
[0086] Therefore, if only one correct execution effect is set, and then the test result of this test is compared with the execution effect of the correct situation in file data to determine whether the test result of this test is correct, but in the case of the execution effects of the above-mentioned multiple correct situations, it is difficult to test or verify through the traditional test mode. The technical solution provided by the embodiment of the present application converts the user's table operation instructions into target code through a large language model, determines the execution state of the target code, and calculates the similarity by comparing the table execution effect screenshot as table data with the table execution effect screenshot as reference data. If the maximum similarity is greater than the preset threshold, the execution effect label of the target table execution effect screenshot corresponding to the maximum similarity is used as the label of the table execution effect screenshot of this test. In the case where there are multiple correct execution effects for the user's table operation instructions, multiple correct situations can be distinguished, there is no need to set a single correct situation, subjective judgment methods can be avoided, subjective judgment can be avoided, test efficiency can be improved, and the execution effects of multiple correct situations can be matched at the same time, and the boundary between the execution effect of the correct situation and the execution effect of the wrong situation is expanded to ensure the accuracy of the test tool. It has strong scalability and can be applied to any test business with subjective judgment.
[0087] On the basis of the above-mentioned embodiments, the technical solution provided by the embodiments of the present application may also include importing the screenshots of the execution effects of the table with execution effect labels and as table data into the correct data set, so as to facilitate the matching of the next test. Among them, the correct data set is continuously supplemented in the form of snowballing in each test. In the seventh iterative test, after verification, the part of manual review has been reduced to 6%, which greatly saves the test manpower and makes the test more efficient. Among them, since the correct data set contains the screenshots of the execution effects of the table with execution effect labels in the historical tests, multiple correct screenshots of the execution effects of the table in the correct data set may correspond to a table operation instruction of the user. Therefore, by matching the execution effect of the table in this test with the screenshots of the execution effects of the table with execution effect labels of the historical tests in the correct data set, there is no single correct situation set, and the execution effects of multiple correct situations can be matched.
[0088] On the basis of the above-mentioned embodiment, the large language model may be trained before it is used, wherein, during the large language model training process, the technical solution provided by the embodiment of the present application may also include: obtaining training data, wherein the training data includes prompt words constructed based on various table operation instructions; if the large language model is trained using the training data, if it corresponds to the target table operation instruction, and the correctness of the target code obtained by the large language model does not meet the preset conditions, the large language model is trained for the target table operation instruction, or the corresponding prompt words are adjusted. Specifically, if the correctness of the target code is poor, there may be a problem with the large language model or a problem with the construction of the prompt words. Therefore, the large language model may be adjusted to retrain the large language model using the target table operation instruction, thereby optimizing the large language model; or the prompt words may be adjusted, and the correctness of the target code may be tested to provide feedback on whether the prompt word adjustment is reasonable.
[0089] For example, if during the training of the large language model, if the accuracy of the target code corresponding to the table operation instruction of category A is less than the preset accuracy threshold, the table operation instruction of category A can be used to retrain the large language model, thereby optimizing the conversion of the table operation instruction of this category by the large language model. If the problem of low accuracy of the target code still cannot be solved through the training of the large language model, the prompt words can be adjusted, mainly the construction method of the prompt words can be adjusted, so as to achieve the purpose of adjusting the prompt words. Therefore, during the training process of the large model, when the correctness of the target code does not meet the preset conditions, the large language model is trained through the corresponding target table operation instruction, or the corresponding prompt words are adjusted, the accuracy of the target code can be improved.
[0090] Based on the above embodiments, the technology provided by the embodiments of the present application may also include: recommending corresponding table operation instructions to the user according to the level of code correctness in the test result set formed by the historical test results of the target code and the test results of the target code.
[0091] In the embodiment of the present application, since the table operation instruction of the user may include questions for table operation raised by the user in natural language, specifically, the corresponding questions may be recommended to the user according to the correctness of the target code. The corresponding questions may be recommended to the user according to the correctness of the target code. For example, if the correctness of the target code is high, the corresponding questions may be recommended first, and if the correctness of the target code is low, the recommendation of the corresponding questions may be reduced; or the corresponding questions may be sorted based on the correctness of the target code, and the sorted questions may be recommended to the user. Therefore, by recommending the corresponding table operation instruction to the user according to the correctness of the target code, the user experience, satisfaction and user stickiness may be improved, and the user operation may be facilitated.
[0092] Fig. 9 is a flow chart of a test method based on table operation provided in an embodiment of the present application, such as Fig. 9 As shown, the method comprises the following steps:
[0093] S410: Obtain a table operation instruction from the user, construct a prompt word based on the table operation instruction, input the prompt word into a large language model, and obtain a corresponding JS code.
[0094] S420: For a preset table file, run the JS code in a macro editor, and obtain a screenshot of the macro editor and a screenshot of the table execution effect.
[0095] S430: Input the macro editor screenshot into the trained neural network model to classify whether there is a pop-up window to determine the execution status of the JS code.
[0096] S440: Import the execution effect screenshot of the table with the execution effect label of the historical test into the correct data set.
[0097] S450: When the JS code is successfully executed, for each use case, among the table execution effect screenshots as parameter data, a table execution effect screenshot belonging to the same use case as the table execution effect screenshot as the table data is selected as the target table execution effect screenshot; wherein the table execution effect screenshot as the parameter data has an execution effect label; wherein the execution effect label includes a label indicating a correct execution effect or a label indicating an incorrect execution;
[0098] S460: Calculating the similarity between the form execution effect screenshot as the form data and each selected target form execution effect screenshot;
[0099] S470: If the maximum similarity value is greater than a preset threshold, the execution effect label of the target table execution effect screenshot corresponding to the maximum similarity value is determined as the label of the table execution effect screenshot as the table data.
[0100] S480: Based on the execution state of the JS code and / or the accuracy of the execution effect, determine the test result of converting the table operation instruction into the target code.
[0101] S490: If the maximum similarity value is less than a preset threshold, the table execution effect screenshot as the table data is manually judged and a label is marked to indicate whether it is correct.
[0102] S491: Import the table execution effect screenshot with the execution effect label corresponding to this test into the correct data set.
[0103] In order to more clearly describe the technical solution provided by the embodiment of the present application, the technical solution provided by the present application may also include the following steps:
[0104] 1. Ask a question to the large language model and get the JavaScript (JS) code corresponding to the question.
[0105] 2. Execute the code in the macro editor and save a screenshot of the macro editor and the table effect after execution.
[0106] 3. Use a collection of historical manually annotated macro editor screenshots (experiments have shown that about 600 are sufficient) to train a resnet network to perform a binary classification task on the macro editor screenshots based on whether they contain pop-up windows, so as to distinguish JS cases into successful execution and failed execution.
[0107] 4. Summarize the data of historical iterations and import the correct data (ground-truth, gt, representing the labeled value of data in supervised learning) library, which contains screenshots of the table execution effects of JS code execution determined by script judgment or manual judgment in historical iterations. Each picture is labeled with correct or incorrect execution effect.
[0108] 5. Count the screenshots of the table execution effect of this iteration, traverse each screenshot image, compare the screenshot image with the screenshot image with the same number in the historical iteration (to ensure that it is the same use case), and calculate the SSIM similarity for each image pair.
[0109] 6. Visualize the results as tabular data, such as Figure 8 shown.
[0110] Column A represents the use case number. The first column of every two columns thereafter represents the label assigned to the use case in this iteration (1 represents correct effect, 2 represents incorrect effect). The second column represents the SSIM comparison result between the execution effect screenshot of the table in this iteration and the execution effect screenshot of the table belonging to the same use case in the historical iteration in the database.
[0111] 7. For each use case, find the iteration data corresponding to the maximum value of SSIM (indicating that the image is most similar to the table execution effect screenshot of the local iteration), set the threshold to 0.99, and if SSIM (max)>0.99, assign the label corresponding to the use case to the table execution effect screenshot of this iteration.
[0112] 8. Combine the execution failure cases obtained in step 3 with the correct and incorrect execution results cases obtained in step 7 to summarize the test results of the local iteration.
[0113] 9. If no test results are obtained in step 8, manual intervention is required to label the results.
[0114] 10. Summarize the screenshots of the execution effects of the labeled tables in this iteration and add them to the gt library.
[0115] The technical solution provided in this embodiment determines whether the JS code is executable by taking a screenshot of the macro editor. When the JS code is executed successfully, whether the execution effect of the JS code is correct is determined by taking a screenshot of the table execution effect, which can improve the test efficiency and save time. The user's table operation instructions are converted into JS code through a large language model, and the similarity is calculated by matching the table execution effect screenshot with the table execution effect screenshot of the historical test in the correct data set. If the maximum similarity value is greater than the preset threshold, the execution effect label of the target table execution effect screenshot corresponding to the maximum similarity value is used as the label of the table execution effect screenshot of this iteration. For the user's table operation instructions, the gt library contains multiple correct table execution effect screenshots. Therefore, multiple correct situations can be judged without setting a single correct situation. The subjective judgment method can be avoided, and subjective judgment can be avoided, which can improve the test efficiency.
[0116] Fig.10 is a structural block diagram of a test device based on table operation in an embodiment of the present application, such as Fig.10 As shown, the device includes: an acquisition module 710, a code running module 720, a code execution state determination module 730, an execution effect accuracy determination module 740 and a test result determination module 750.
[0117] The acquisition module 710 is used to acquire a table operation instruction from a user and convert the table operation instruction into a target code for executing the table operation;
[0118] A code running module 720, used to run the target code for a preset table file, wherein the target code is used to operate the table file;
[0119] A code execution state determination module 730, used to determine the execution state of the target code;
[0120] An execution effect accuracy determination module 740 is used to determine the accuracy of the execution effect after the table file successfully executes the target code when the execution status is determined to be successful;
[0121] The test result determination module 750 is used to determine the test result of converting the table operation instruction into the target code based on the accuracy of the execution state and / or the execution effect.
[0122] In a possible embodiment, determining the execution status of the target code includes:
[0123] In an operating environment in which the target code is executed, detecting a preset display feature;
[0124] An execution status of the object code is determined based on the display characteristics.
[0125] In a possible embodiment, the preset display feature is a pop-up window indicating an execution error, and determining the execution state of the target code based on the display feature includes:
[0126] When any type of pop-up window is detected, the execution status of the target code is execution failure; or,
[0127] When it is detected that the pop-up window does not exist, the execution status of the target code is successful execution.
[0128] In a possible embodiment, determining the accuracy of the execution effect after the table file successfully executes the target code includes:
[0129] Calculate the similarity between the table data after the table file successfully executes the target code and the reference data in the preset correct data set, and determine the accuracy of the execution effect based on the similarity;
[0130] The reference data is: in historical tests, the table data corresponding to the table file generated after any code is successfully and correctly executed.
[0131] In a possible embodiment, the table data at least includes file data corresponding to the changed part generated by the target code operating the table file, and the reference data is: in the historical test, the file data corresponding to the table file generated after any code is successfully and correctly executed;
[0132] The calculating the similarity between the table data after the target code is successfully executed in the table file and the reference data in the preset correct data set, and determining the accuracy of the execution effect based on the similarity, includes:
[0133] For the table data and the reference data, similarity calculation is performed on the file data regarding content and / or attributes, and the accuracy of the execution effect is determined based on the similarity.
[0134] In a possible embodiment, the table data at least includes a screenshot of the table execution effect corresponding to the changed part generated by the target code operating the table file, and the reference data is: in the historical test, a screenshot of the table execution effect corresponding to the successful and correct execution of any code of the table file;
[0135] The step of matching the table data of the table file after the target code is successfully executed with reference data in a preset correct data set, and determining the accuracy of the execution effect based on the matching degree of the matching includes:
[0136] A similarity calculation is performed on the table execution effect screenshot as the table data and the table execution effect screenshot as the reference data, and the accuracy of the execution effect is determined based on the similarity.
[0137] In a possible embodiment, performing similarity calculation on the table execution effect screenshot as the table data and the table execution effect screenshot as the reference data, and determining the accuracy of the execution effect based on the similarity includes:
[0138] For each use case, in the table execution effect screenshots that serve as parameter data, select the table execution effect screenshot that belongs to the same use case as the table execution effect screenshot that serves as table data.
[0139] A screenshot of the execution effect of the target table; wherein the screenshot of the execution effect of the table as parameter data has a label of the execution effect; wherein the execution effect label includes a label of a correct execution effect or a label of an incorrect execution;
[0140] Calculating the similarity between the form execution effect screenshot as the form data and each selected target form execution effect screenshot;
[0141] If the maximum similarity value is greater than a preset threshold, the execution effect label of the target table execution effect screenshot corresponding to the maximum similarity value is determined as the label of the table execution effect screenshot as the table data.
[0142] In a possible embodiment, converting the table operation instruction into a target code for executing the table operation includes:
[0143] A prompt word is constructed based on the table operation instruction, and the prompt word is input into a large language model to obtain a corresponding target code.
[0144] In a possible embodiment, the device further includes an import module for storing the form execution effect screenshot with an execution effect tag as form data into the correct data set.
[0145] In a possible embodiment, the device further includes a training module, which is used to:
[0146] Acquire training data, wherein the training data includes prompt words constructed based on various table operation instructions;
[0147] If the training data is used to train the large language model, if it corresponds to the target table operation instruction and the correctness of the code obtained by the large language model does not meet the preset conditions, the large language model is trained for the target table operation instruction, or the corresponding prompt word is adjusted.
[0148] In a possible embodiment, the device further includes a recommendation module for recommending corresponding table operation instructions to a user according to the level of code correctness in a test result set formed by historical test results of the target code and the test results of the target code.
[0149] The technical solution provided by the embodiment of the present application obtains the user's table operation instructions and converts them into target code, runs the target code for a preset table file, determines the execution status of the target code, and when the execution status is successful, determines the accuracy of the execution effect of executing the target code, and determines the test result of converting the table operation instructions into the target code based on the execution status and / or the accuracy of the execution effect; that is, by first determining the execution status of the target code, and when the execution is successful, then determining the accuracy of the execution effect of the target code, thereby obtaining the test result. This method can improve test efficiency, has universal applicability, and can save labor costs.
[0150] like Fig.11As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0151] Memory 113, used for storing computer programs;
[0152] In one embodiment of the present application, the processor 111 is used to implement a table operation-based testing method provided by any one of the aforementioned method embodiments when executing a program stored in the memory 113, including:
[0153] Obtaining a table operation instruction from a user, and converting the table operation instruction into a target code for executing the table operation;
[0154] Running the target code for a preset table file, wherein the target code is used to operate the table file;
[0155] Determining an execution state of the object code;
[0156] In the case where it is determined that the execution status is successfully executed, determining the accuracy of the execution effect after the table file successfully executes the target code;
[0157] Based on the accuracy of the execution state and / or the execution effect, a test result of converting the table operation instruction into the target code is determined.
[0158] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of a test method based on table operations as provided in any of the aforementioned method embodiments are implemented.
[0159] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0161] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0162] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A test method based on table operation, characterized in that: include: Obtaining a table operation instruction from a user, and converting the table operation instruction into a target code for executing the table operation; Running the target code for a preset table file, wherein the target code is used to operate the table file; determining an execution state of the object code; In the case where it is determined that the execution status is successfully executed, determining the accuracy of the execution effect after the table file successfully executes the target code; Based on the accuracy of the execution state and / or the execution effect, a test result of converting the table operation instruction into the target code is determined.
2. The method according to claim 1, characterized in that The determining the execution status of the target code comprises: In an operating environment in which the target code is executed, detecting a preset display feature; An execution status of the object code is determined based on the display characteristics.
3. The method according to claim 2, characterized in that The preset display feature is a pop-up window indicating an execution error, and determining the execution state of the target code based on the display feature includes: When any type of pop-up window is detected, the execution status of the target code is execution failure; or, When it is detected that the pop-up window does not exist, the execution status of the target code is successful execution.
4. The method according to claim 1, characterized in that: Determining the accuracy of the execution effect after the table file successfully executes the target code includes: Calculate the similarity between the table data after the table file successfully executes the target code and the reference data in the preset correct data set, and determine the accuracy of the execution effect based on the similarity; The reference data is: in historical tests, the table data corresponding to the table file generated after any code is successfully and correctly executed.
5. The method according to claim 4, characterized in that The table data at least includes file data corresponding to the changed part generated by the target code operating the table file, and the reference data is: in the historical test, the file data corresponding to the table file generated after any code is successfully and correctly executed; The calculating the similarity between the table data after the target code is successfully executed in the table file and the reference data in the preset correct data set, and determining the accuracy of the execution effect based on the similarity, includes: For the table data and the reference data, similarity calculation is performed on the file data regarding content and / or attributes, and the accuracy of the execution effect is determined based on the similarity.
6. The method according to claim 4, characterized in that The table data at least includes a screenshot of the table execution effect corresponding to the changed part of the table file generated by the target code operating the table file, and the reference data is: in the historical test, a screenshot of the table execution effect corresponding to the successful and correct execution of any code of the table file; The step of matching the table data of the table file after the target code is successfully executed with reference data in a preset correct data set, and determining the accuracy of the execution effect based on the matching degree of the matching includes: A similarity calculation is performed on the table execution effect screenshot as the table data and the table execution effect screenshot as the reference data, and the accuracy of the execution effect is determined based on the similarity.
7. The method according to claim 6, characterized in that The calculating the similarity between the table execution effect screenshot as the table data and the table execution effect screenshot as the reference data, and determining the accuracy of the execution effect based on the similarity, includes: For each use case, among the table execution effect screenshots serving as parameter data, a table execution effect screenshot belonging to the same use case as the table execution effect screenshot serving as the table data is selected as the target table execution effect screenshot; wherein the table execution effect screenshot serving as the parameter data has an execution effect label; wherein the execution effect label includes a label indicating a correct execution effect or a label indicating an incorrect execution; Calculating the similarity between the form execution effect screenshot as the form data and each selected target form execution effect screenshot; If the maximum similarity value is greater than a preset threshold, the execution effect label of the target table execution effect screenshot corresponding to the maximum similarity value is determined as the label of the table execution effect screenshot as the table data.
8. The method according to claim 1, characterized in that: The step of converting the table operation instruction into a target code for executing the table operation comprises: A prompt word is constructed based on the table operation instruction, and the prompt word is input into a large language model to obtain a corresponding target code.
9. The method according to claim 7, characterized in that: Also includes: The form execution effect screenshot with the execution effect tag and as form data is stored in the correct data set.
10. The method according to claim 8, characterized in that Also includes: Acquire training data, wherein the training data includes prompt words constructed based on various table operation instructions; If the training data is used to train the large language model, if it corresponds to the target table operation instruction and the correctness of the code obtained by the large language model does not meet the preset conditions, the large language model is trained for the target table operation instruction, or the corresponding prompt word is adjusted.
11. The method according to claim 1, characterized in that Also includes: According to the historical test results of the target code and the level of code correctness in the test result set formed by the test results of the target code, the corresponding table operation instructions are recommended to the user.
12. A test device based on table operation, characterized in that: include: An acquisition module, used for acquiring a table operation instruction from a user, and converting the table operation instruction into a target code for executing the table operation; A code running module, used for running the target code for a preset table file, wherein the target code is used for operating the table file; A code execution status determination module, used to determine the execution status of the target code; An execution effect accuracy determination module, for determining the accuracy of the execution effect after the table file successfully executes the target code, when the execution status is determined to be successful; A test result determination module is used to determine a test result of converting the table operation instruction into the target code based on the accuracy of the execution state and / or the execution effect.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute a computer program stored in the memory, and when the computer program is executed, implement the method described in any one of claims 1 to 11.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 11 is implemented.