Method, apparatus, electronic device, and storage medium for data processing
By parsing the generated instructions to obtain text information, identifying process keywords to match the test case set, extracting the page function list, running the target test case and comparing the element sequence, updating the page elements to generate new test cases, the problem of cumbersome operation and low flexibility of traditional test case creation methods is solved, thus improving testing efficiency.
Patent Information
- Application Number
- CN202411936034.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2044-12-26
AI Technical Summary
Traditional methods for creating UI automated test cases are cumbersome and inflexible, resulting in low testing efficiency and an inability to flexibly respond to functional changes.
By parsing the generated instructions to obtain text information, identifying process keywords to match the test case set, extracting the page function list, running the target test case and comparing the element sequence, and updating the page elements to generate new test cases.
It improves the flexibility and efficiency of test case generation, enabling the generation of new test cases after the target test has been run, thus achieving both flexibility and efficiency in test case generation.
Smart Images

Figure CN119759782B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a data processing method and device, electronic equipment and storage medium. BACKGROUND
[0002] The creation of test cases is an important link in testing. In the traditional way, the UI automation test case creation method is that business personnel operates and runs on the tested system according to the test steps to form the assembly of the operation completed UI automation test case. However, this way is not only cumbersome, but also has low flexibility when the case is executed. The created UI automation case can only be played back for stable functions, and when new functions appear, manual operation is required to test the process to assemble the corresponding UI automation case, thereby leading to low test efficiency. SUMMARY
[0003] Therefore, the embodiments of the present application provide a data processing method and device, electronic equipment and storage medium, which can solve the problem of low flexibility of test case creation method and low test efficiency.
[0004] To achieve the above object, according to one aspect of the embodiments of the present application, a data processing method is provided.
[0005] The data processing method of the embodiments of the present application comprises: in response to a generation instruction of a test case, acquiring instruction information corresponding to the generation instruction, calling a preset analysis model to analyze the instruction information to obtain corresponding text information; identifying a process keyword in the text information, querying a matching test case set from a data dictionary based on the keyword; for each test case in the test case set, extracting a page function list of the test case to match the text information, to determine a target test case according to the matching result; based on the element sequence of each page extracted in the text information, running the target test case to compare each page element in the target test case with the element sequence according to the running order of the target test case, to obtain a comparison result; in response to the comparison result being different, updating the element of the page in the target test case to the corresponding element in the element sequence.
[0006] In response to the end of the running of the target test case, a new test case is generated based on the test case that has ended running.
[0007] In one embodiment, updating the element of the page in the target test case to the corresponding element in the element sequence comprises: acquiring a function sub-element set corresponding to the page element in the element sequence, acquiring component information associated with each function sub-element, and updating the component information to the element of the page in the target test case.
[0008] In yet another embodiment, the component information associated with each of the functional sub-elements is acquired to update the element of the page in the target test case, including: acquiring the component type associated with each of the functional sub-elements to match the element of the corresponding page in the target test case; in response to a successful match, acquiring the component attribute value associated with the functional sub-element to update the element of the corresponding page in the target test case based on the attribute value; and in response to an unsuccessful match, acquiring the component associated with the functional sub-element to update the element of the corresponding page in the target test case based on the component.
[0009] In yet another embodiment, the elements of each page in the target test case are compared with the element sequence to obtain a comparison result, including: in response to the corresponding program of the page element being called, acquiring the element identifier and input data of the program, querying the corresponding target element from the element sequence based on the element identifier, and acquiring the configuration parameters of the target element to compare the input data and the configuration parameters to obtain a comparison result.
[0010] In yet another embodiment, the page function list of the test case is extracted to match the text information to determine the target test case according to the matching result, including: extracting the page function list of the test case, acquiring the corresponding function description feature, and identifying the function description feature from the text information to obtain an identification result; and in response to the identification result satisfying a preset condition, determining the test case as the target test case.
[0011] In yet another embodiment, a preset analysis model is called to analyze the instruction information to obtain corresponding text information, including: calling a preset analysis model to convert the instruction information into a text format, splitting the instruction information in the text format based on a preset identifier to obtain each text segment; generating a text sequence based on the splitting order and the each text segment to determine the text information corresponding to the instruction information.
[0012] To achieve the above object, according to another aspect of the embodiments of the present application, a data processing apparatus is provided.
[0013] The data processing apparatus of the embodiment of the application comprises: an analysis unit configured to, in response to a generation instruction of a test case, acquire instruction information corresponding to the generation instruction, and call a preset analysis model to analyze the instruction information to obtain corresponding text information; a matching unit configured to identify a flow keyword in the text information, and query a matching test case set from a data dictionary based on the keyword; a determination unit configured to, for each test case in the test case set, extract a page function list of the test case to match with the text information, and determine a target test case according to a matching result; a comparison unit configured to, based on an element sequence of each page extracted from the text information, run the target test case, and compare each page element in the target test case with the element sequence according to a running order of the target test case to obtain a comparison result; and an update unit configured to, in response to the comparison result being different, update an element of a page in the target test case to a corresponding element in the element sequence; and the determination unit is configured to, in response to the target test case running ending, generate a new test case based on the test case running ending.
[0014] In one embodiment, the update unit is specifically configured to: acquire a function sub-element set corresponding to a page element in the element sequence, and acquire component information associated with each function sub-element to update the component information to the element of the page in the target test case.
[0015] In another embodiment, the update unit is specifically configured to: acquire a component type associated with each function sub-element to match with the element of the corresponding page in the target test case; in response to a successful match, acquire a component attribute value associated with the function sub-element to update the element of the corresponding page in the target test case based on the attribute value; and in response to an unsuccessful match, acquire a component associated with the function sub-element to update the element of the corresponding page in the target test case based on the component.
[0016] In another embodiment, the comparison unit is specifically configured to: in response to a program corresponding to the page element being called, acquire an element identifier and input data of the program, query a target element corresponding to the element identifier from the element sequence, and acquire a configuration parameter of the target element to compare the input data and the configuration parameter to obtain a comparison result.
[0017] In another embodiment, the matching unit is specifically configured to: extract a page function list of the test case, acquire a function description feature corresponding to the page function list, identify the function description feature from the text information to obtain an identification result, and in response to the identification result satisfying a preset condition, determine the test case as the target test case.
[0018] In yet another embodiment, the parsing unit is specifically configured to: invoke a preset parsing model to convert the instruction information into a text format; split the instruction information in the text format based on a preset identifier to obtain each text segment; and generate a text sequence based on a splitting order and the each text segment to determine text information corresponding to the instruction information.
[0019] To achieve the above object, according to a further aspect of embodiments of the present application, an electronic device is provided.
[0020] The electronic device of an embodiment of the present application comprises one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method for data processing provided by the embodiments of the present application.
[0021] To achieve the above object, according to a further aspect of embodiments of the present application, a computer readable medium is provided.
[0022] The computer readable medium of an embodiment of the present application has a computer program stored thereon, when the program is executed by a processor, the method for data processing provided by the embodiments of the present application is implemented.
[0023] To achieve the above object, according to a further aspect of embodiments of the present application, a computer program product is provided.
[0024] The computer program product of an embodiment of the present application comprises a computer program, when the program is executed by a processor, the method for data processing provided by the embodiments of the present application is implemented.
[0025] An embodiment of the above application has the following advantages or beneficial effects:
[0026] In the embodiment of the present application, in response to the generation instruction of the test case, the instruction information corresponding to the generation instruction can be acquired first, a preset analysis model is called to analyze the instruction information, and corresponding text information is obtained. Then, the process keywords in the text information are recognized, and the matching test case set is queried from the data dictionary based on the keywords, that is, the stored test case close to the generation instruction is queried. For each test case in the test case set, the page function list of the test case can be extracted to match the text information, and the target test case, that is, the test case most matching the generation instruction, is determined according to the matching result. Thus, based on the element sequence of each page extracted from the text information, the target test case is run to compare each page element in the target test case with the element sequence in turn according to the running order of the target test case, and the comparison result is obtained. In response to the comparison result being different, the element of the page in the target test case is updated to the corresponding element in the element sequence. When the target test case is run, the test case run is determined as the target test case. In this way, in the embodiment of the present application, the target test case can be determined from the generated test case according to the generation instruction, the difference between the test case required by the generation instruction can be determined through the running of the target test case, and then the update can be performed in time, so that the test case to be generated can be obtained after the target test case is run, and the generation efficiency and the test efficiency of the test case can be improved.
[0027] The further effects of the above-described non-conventional optional mode will be described in the following in conjunction with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0028] The accompanying drawings are used to better understand the present application and do not constitute an improper limitation on the present application. Among them:
[0029] Figure 1 is a schematic diagram of a main flow of a data processing method according to an embodiment of the present application;
[0030] Figure 2 is a schematic diagram of another main flow of a data processing method according to an embodiment of the present application;
[0031] Figure 3 is a schematic diagram of another main flow of a data processing method according to an embodiment of the present application;
[0032] Figure 4 is a schematic diagram of main units of a data processing device according to an embodiment of the present application;
[0033] Figure 5 is an exemplary system architecture diagram to which the embodiment of the present application can be applied;
[0034] Figure 6is a structural schematic diagram of a computer system suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION
[0035] Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding them. These should be considered as merely exemplary. Therefore, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the application. Also, for the sake of brevity and clarity, descriptions of well-known functions and constructions are omitted from the following description.
[0036] It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict. The acquisition, transmission, storage, use, processing, etc. of data in the technical solutions of the present application comply with relevant provisions of national laws and regulations. In the embodiments of the present application, some industry existing solutions, components, models, etc. may be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility of the implementation of the technical solutions of the present application, but it does not mean that the applicant has or will necessarily use the solutions.
[0037] The embodiments of the present application provide a data processing system, which can be used for testing case generation scenarios.
[0038] The embodiments of the present application provide a data processing method, which can be executed by a data processing system, as shown in Figure 1 The method comprises the following steps.
[0039] S101: In response to a generation instruction of a test case, acquiring instruction information corresponding to the generation instruction, calling a preset analysis model to analyze the instruction information, and obtaining corresponding text information.
[0040] The test case represents a case to be generated, and the generation instruction can be sent by an external system, which includes the requirements of the test case to be generated, so that the test case can be generated based on the requirements. The instruction information represents the specific requirements of the test case to be generated, which can be embodied by various information such as voice, text, etc. In the embodiments of the present application, the instruction information can be acquired from the generation instruction, so as to be converted into text information by analyzing the instruction information. The analysis model can be set and trained according to requirements, for example, it can include a machine learning model, which analyzes the instruction information and converts the requirements of the test case to be generated into text information.
[0041] Specifically, in the embodiments of the present application, the instruction information is extracted by the analysis model, such as extracting keywords or key words, so as to obtain key text information representing the test case to be generated.
[0042] In an implementation, the step can be specifically performed as: calling a preset analysis model to convert the instruction information into a text format, splitting the instruction information in the text format based on a preset identifier, and waiting for each text segment; and generating a text sequence based on the splitting order and each text segment to determine text information corresponding to the instruction information.
[0043] The analysis model can first convert the instruction information into a text format, then split the instruction information in the text format through analysis of the text content to obtain each text segment, further extract key information from each text segment to obtain text information corresponding to each text segment, and arrange the text information corresponding to each text segment in the splitting order to obtain a text sequence.
[0044] For example, the generated instruction can be specifically a voice instruction, such as "I want to test whether the process of generating a business reply is normal, where the saleable product is domestic factoring, the business nature is general business, and the declaration process mode is a green channel mode". In this case, the instruction information can include "process of generating a business reply, saleable product is domestic factoring, business nature is general business, and declaration process mode is a green channel mode". After analysis by the analysis model, the text information can include "process of generating a business reply, domestic factoring, general business, and green channel mode".
[0045] It should be noted that, in the embodiment of the application, in order to make the generated test case more accurate, the related requirement information of the test case can be input when the generation instruction is input, so that the text information can include more information of the test case, thereby improving the accuracy of generating the test case. In this step, the text information can store the required information in the form of key-value pairs, such as key is process, and corresponding value is business reply, key is saleable product, and corresponding value is domestic factoring, so as to facilitate subsequent processing.
[0046] In the embodiment of the application, in order to facilitate subsequent test case generation, the generation instruction can also include a description of the test function requirement, so the text information can also include the features corresponding to the test function, such as a description feature of the test function, which can be specifically a function number, a function identifier, or a function text description, and the like. Further, the generation instruction can also include detailed information of a page corresponding to the function to be tested, such as element information in the corresponding page, so the text information can also include detailed information of the page corresponding to the function to be tested.
[0047] S102: Identify the process keyword in the text information, and query the matching test case set from the data dictionary based on the keyword.
[0048] The text information includes information of a test case to be generated, from which a process keyword is identified, the process keyword indicating key information of a business process to which the test case to be generated belongs, and is used to match a test case of the corresponding business process. The data dictionary can be pre-established, and can be established according to attribute information of each generated test case. The attribute information can include the process keyword, and therefore can be used for test case matching. The test case set can include at least one generated test case.
[0049] It should be noted that the process keyword in the embodiment of the present application can include one or more, and can be set according to requirements. For example, the process keyword can include a value corresponding to the process in the text information, that is, a business reply, or can include the process and a sellable product in the text information, that is, a business reply and domestic factoring. If the test case set obtained in this step does not include the generated test case, it indicates that the test case matching is unsuccessful, and at this time, the required test case can be directly created.
[0050] S103: For each test case in the test case set, a page function list of the test case is extracted to match the text information, so as to determine a target test case according to a matching result.
[0051] The page function list can include a list of functions implemented by each page in the test case, and can represent the functions of each tested page in the test case. The page function list and the text information are matched to determine whether the generated test case includes the function page required this time, and then the target test case can be determined therefrom. The matching result can include a matching degree, that is, a matching degree between the page function list in the test case and the text information.
[0052] Specifically, the target test case can be determined in this step by extracting the page function list of the test case, obtaining corresponding function description features, identifying the function description features from the text information to obtain an identification result, and determining the test case as the target test case in response to the identification result satisfying a preset condition.
[0053] For each page in the test case, the page function can be described by the description information, so in this step, each function description feature corresponding to the page function list can be obtained, and then the function description feature is identified from the text information. The identification result is equivalent to the matching result between the page function list and the text information. Generally, the higher the identification result is, the more the function description feature meets the requirements of the test case to be generated, that is, the higher the matching degree is. The preset condition can be set according to requirements, for example, the identification result can be greater than a preset threshold, and the preset threshold is pre-set.
[0054] It should be noted that in the embodiments of the present application, if multiple target test cases are determined in the test case set, the test case with the optimal matching result can be selected as the target test case.
[0055] S104: Based on the element sequence of each page extracted from the text information, the target test case is run to compare each page element in the target test case with the element sequence in sequence according to the running order of the target test case, and a comparison result is obtained.
[0056] After the target test case is determined, the target test case can be run. The target test case will call the elements of the corresponding page in sequence according to the arrangement order and display the update process of the page through the element call of the page, so as to show the test process of the target test case. In the embodiments of the present application, the element sequence of the test case to be generated can be extracted in advance, and then in the running process of the target test case, the called page elements are compared with the element sequence according to the running order to determine whether they are consistent, so as to obtain a comparison result.
[0057] It should be noted that the element sequence of each page can be extracted from the text information or obtained according to the text information. For example, in the embodiments of the present application, the element sequence of each page can be extracted from the test function script corresponding to the test case to be generated. The test function script can be pre-set, so the calling elements and the calling order of each page can be directly determined according to the test function, that is, the corresponding element sequence can be determined. Alternatively, the text information can include detailed information of the page corresponding to the test function to be tested to generate the corresponding element sequence.
[0058] In another embodiment, the comparison result obtained in this step can be specifically executed as follows: in response to the corresponding program of the page element being called, the element identifier and the input data of the program are obtained, the corresponding target element is queried from the element sequence based on the element identifier, and the configuration parameters of the target element are obtained to compare the input data and the configuration parameters, and the comparison result is obtained.
[0059] When the element in the page is called, the element identifier and input data are usually used, the element identifier indicates which element is called, and the input data indicates the data required for the element to be displayed in the page, and the input data can be determined according to the scene, and when no input data is required, the obtained input data can be empty. Therefore, in this step, after the element identifier is obtained, the corresponding target element in the element sequence can be queried, that is, the target element consistent with the called element, and then the configuration parameters of the target element are obtained, that is, the input parameters of the target element, and the input data and the configuration parameters are compared. If the comparison result is consistent, it can be explained that the called element is consistent with the corresponding element in the element sequence, and no change is required, and then the subsequent operation can be continued; if the comparison result is inconsistent, it can be explained that the called element is inconsistent with the corresponding element in the element sequence, and the change is required to meet the requirements of the test case to be generated.
[0060] S105: In response to the comparison result being different, updating the element of the page in the target test case to the corresponding element in the element sequence.
[0061] The comparison result is different, and the called element needs to be updated to the target element, so in this step, the element of the page in the target test case is updated to the corresponding element in the element sequence.
[0062] Specifically, this step can be executed as follows: obtaining a function sub-element set corresponding to the page element in the element sequence, obtaining component information associated with each function sub-element, and updating the component information to the element of the page in the target test case.
[0063] Since the element in the page is usually implemented by a component, in this step, the function sub-element set corresponding to the page element can be obtained, that is, the element set corresponding to each sub-function included in the page element, and then the component information associated with each function sub-element can be determined, and the components are sequentially updated to the corresponding page element in the target test case.
[0064] For example, a certain page element called in the target test case running does not exist in the element sequence, then this page element can be directly deleted; when a certain page element is called in the target test case running, an element function is added in the element sequence, such as an added single selection box “whether to add quota”, then the element list corresponding to the single selection box can be obtained, the element corresponding to the “whether to add quota” text can be found, and the sub-element corresponding to the “yes” element, that is, the single selection box (radio-button), can be found, and then the element corresponding to the single selection box with the text “yes” that can be clicked can be found, and then the “click” action is combined, and the component information of the added element can be determined, and then the component information can be updated to the corresponding page element in the target test case.
[0065] It should be noted that since it is found in step S104 that the corresponding page element in the target test case needs to be updated by comparison, the associated component information corresponding to the page element can be obtained in this step to directly update the corresponding page element in the target test case, so that the test function of the test case to be tested in the embodiment of the application can be realized when the target test case is run again.
[0066] In yet another embodiment, the component type associated with each functional sub-element can be obtained in this step to match the element of the corresponding page in the target test case; in response to successful matching, the component attribute value associated with the functional sub-element is obtained to update the element of the corresponding page in the target test case based on the attribute value; in response to unsuccessful matching, the component associated with the functional sub-element is obtained to update the element of the corresponding page in the target test case based on the component.
[0067] The component type associated with each functional sub-element is matched with the element of the corresponding page in the target test case to determine whether they are consistent; if they are consistent, it means that the component types are the same, and in this case the attribute value of the component can be directly updated; if they are not consistent, it means that the component types are not the same, and in this case the content of the component needs to be updated, that is, the component associated with the functional sub-element is obtained to update the element of the corresponding page in the target test case based on the component.
[0068] It should be noted that after this step is executed, the updated target test case can be run, and since the element in the page has been updated, the updated function can be displayed after running, thereby meeting the demand of the test case to be generated.
[0069] S106: In response to the end of the running of the target test case, a new test case is generated based on the test case that has ended running.
[0070] After the target test case ends running, it means that the running of the test case has been completed based on the demand of the generation instruction, and this running process is a running process after updating based on the target test case, so the test case that has ended running is the new test case to be generated.
[0071] In the embodiment of the application, the target test case can be determined from the generated test case according to the generation instruction, the difference between the test case required by the generation instruction can be determined through the running of the target test case, and then the update can be performed in a timely manner, so that the test case to be generated can be obtained after the running of the target test case ends, thereby improving the generation efficiency and test efficiency of the test case.
[0072] The method for processing data in the embodiment of the application will be specifically described below with reference to the embodiments shown in the drawings. Figure 1 The method for processing data in the embodiment of the application will be specifically described below with reference to the embodiments shown in the drawings.Figure 2 As shown in the method comprises the following steps.
[0073] S201: In response to the generation instruction of the test case, obtain the instruction information corresponding to the generation instruction.
[0074] S202: Call the preset analysis model to convert the instruction information into a text format, split the instruction information in the text format based on a preset identifier, and obtain each text segment.
[0075] S203: Based on the splitting order and each text segment, generate a text sequence to determine the text information corresponding to the instruction information.
[0076] S204: Identify the process keyword in the text information, and query the matching test case set from the data dictionary based on the keyword.
[0077] S205: For each test case in the test case set, extract the page function list of the test case, obtain the corresponding function description feature, identify the function description feature from the text information, and obtain the identification result.
[0078] S206: In response to the identification result satisfying a preset condition, determine the test case as a target test case.
[0079] S207: Based on the element sequence of each page extracted from the text information, run the target test case, and compare each page element in the target test case with the element sequence in sequence according to the running order of the target test case to obtain a comparison result.
[0080] S208: In response to the comparison result being different, update the element of the page in the target test case to the corresponding element in the element sequence.
[0081] S209: In response to the end of the running of the target test case, generate a new test case based on the test case that has ended running.
[0082] It should be noted that the data processing principle in the embodiment of the application is the same as the corresponding data processing principle in the embodiment shown in Figure 1 , which will not be repeated here.
[0083] The method of data processing in the embodiment of the application will be specifically described below in combination with the embodiment shown in Figure 1 , which comprises the following steps. Figure 3
[0084] S301: In response to the generation instruction of the test case, obtain the instruction information corresponding to the generation instruction, and call the preset analysis model to analyze the instruction information to obtain the corresponding text information.
[0085] S302: Identify process keywords in text information and query a set of matching test cases from the data dictionary based on the keywords.
[0086] S303: For each test case in the test case set, extract the list of page functions of the test case and match it with the text information to determine the target test case based on the matching results.
[0087] S304: Extract the element sequence of each page based on the text information and run the target test case.
[0088] S305: In response to the program corresponding to the page element being called, obtain the element identifier and input data of the program, query the corresponding target element from the element sequence based on the element identifier, and obtain the configuration parameters of the target element, so as to compare the input data and the configuration parameters and obtain the comparison result.
[0089] S306: In response to a difference in the comparison result, update the elements of the page in the target test case to the corresponding elements in the element sequence.
[0090] S307: In response to the completion of the target test case, generate a new test case based on the completed test case.
[0091] It should be noted that the data processing principle in the embodiments of the present invention is the same as... Figure 1 The data processing principles in the illustrated embodiments are the same and will not be repeated here.
[0092] To address the problems existing in the prior art, embodiments of the present invention provide a data processing apparatus 400, such as... Figure 4 As shown, the device 400 includes: a parsing unit 401, configured to, in response to a test case generation instruction, acquire instruction information corresponding to the generation instruction, call a preset parsing model to parse the instruction information, and obtain corresponding text information; a matching unit 402, configured to identify process keywords in the text information, and query a set of matching test cases from a data dictionary based on the keywords; a determining unit 403, configured to, for each test case in the test case set, extract the page function list of the test case to match it with the text information, and determine a target test case based on the matching result; a comparison unit 404, configured to, based on the text information, extract the element sequence of each page, run the target test case, and compare each page element in the target test case with the element sequence according to the running order of the target test case to obtain a comparison result; an updating unit 405, configured to, in response to the comparison result being different, update the elements of the pages in the target test case to the corresponding elements in the element sequence; the determining unit 403 is also configured to, in response to the end of the running of the target test case, generate a new test case based on the run-finished test case.
[0093] It should be understood that the manner of implementing the embodiments of the present application is the same as that of implementing the embodiments of the application as shown in Figure 1 It should be understood that the manner of implementing the embodiments of the present application is the same as that of implementing the embodiments of the application as shown in
[0094] In one embodiment, the updating unit is specifically configured to: acquire a function sub-element set corresponding to a page element in the element sequence, and acquire component information associated with each function sub-element, so as to update the component information to an element of a page in the target test case.
[0095] In another embodiment, the updating unit is specifically configured to: acquire a component type associated with each function sub-element, so as to match the component type with an element of a corresponding page in the target test case; in response to a successful match, acquire a component attribute value associated with the function sub-element, so as to update the component attribute value to the element of the corresponding page in the target test case; and in response to an unsuccessful match, acquire a component associated with the function sub-element, so as to update the component to the element of the corresponding page in the target test case.
[0096] In another embodiment, the comparing unit is specifically configured to: in response to a program corresponding to the page element being invoked, acquire an element identifier and input data of the program, query a target element corresponding to the element identifier from the element sequence, and acquire a configuration parameter of the target element, so as to compare the input data and the configuration parameter, and obtain a comparison result.
[0097] It should be understood that the manner of implementing the embodiments of the present application is the same as that of implementing the embodiments of the application as shown in Figure 1 、 2 , 3, and will not be repeated here.
[0098] In the embodiments of the present application, the target test case can be determined from the generated test cases according to the generation instruction, the difference between the target test case and the test case required by the generation instruction can be determined through the running of the target test case, and then the update can be performed in time, so that the test case to be generated can be obtained after the running of the target test case ends, and the generation efficiency and the test efficiency of the test case can be improved.
[0099] According to the embodiments of the present application, the embodiments of the present application further provide an electronic device and a readable storage medium.
[0100] The electronic device of the embodiments of the present application comprises: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of data processing provided by the embodiments of the present application.
[0101] Figure 5 An exemplary system architecture 500 of a method of data processing or a device of data processing to which embodiments of the present application can be applied is shown.
[0102] As shown in Figure 5 The system architecture 500 can include terminal devices 501, 502, 503, a network 504 and a server 505. The network 504 is a medium for providing communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 can include various connection types, such as wired, wireless communication links or fiber optic cables, etc.
[0103] A user can use the terminal devices 501, 502, 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various client applications can be installed on the terminal devices 501, 502, 503.
[0104] The terminal devices 501, 502, 503 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers and desktop computers, etc.
[0105] The server 505 can be a server providing various services, which can analyze and process received product information query requests and other data, and feed back the processing results (such as product information - just an example) to the terminal devices.
[0106] It should be noted that the method of data processing provided by the embodiments of the present application is generally executed by the server 505, and accordingly, the device of data processing is generally provided in the server 505.
[0107] It should be understood that Figure 5 The number of terminal devices, networks and servers in
[0108] Reference is made to Figure 6 which shows a structural diagram of a computer system 600 suitable for implementing the embodiments of the present application. Figure 6 The computer system shown is only an example and should not bring any limitation to the functions and use range of the embodiments of the present application.
[0109] As shown in Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601 which can perform various appropriate actions and processes in accordance with programs stored in a read only memory (ROM) 602 or loaded from the storage section 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0110] Connected to the I / O interface 605 are an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as necessary. A removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 610 as necessary, so that a computer program read therefrom is installed into the storage section 608 as necessary.
[0111] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program in accordance with the embodiments disclosed herein. For example, the embodiments disclosed herein include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable media 611. When the computer program is executed by the central processing unit (CPU) 601, the above-described functions defined in the system of the present invention are performed.
[0112] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0113] The flow diagrams and block diagrams in the drawings are schematic representations for purposes of illustration and are not necessarily drawn to scale, nor are the diagrams necessarily precise representations of the processes, systems and / or apparatuses they depict. Specifically, the flow diagrams and block diagrams illustrate the possible architectures, functional and operational processes and steps that can be taken by a system, method or computer program product according to various embodiments of the present application. In this regard, each block in the flow diagrams and block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions ("instructions"). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
[0114] The units described in the embodiments of the present application can be implemented by software, or by hardware. The units described can also be implemented in a processor, for example, a processor can be described as including the parsing unit, the matching unit, the determining unit, the comparing unit and the updating unit. In some cases, the names of the units do not constitute a limitation on the units themselves, for example, the parsing unit can also be described as a unit having the function of the parsing unit.
[0115] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist separately without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to perform the data processing method provided by the present application.
[0116] As another aspect, the present application also provides a computer program product, which includes a computer program, and the program, when executed by a processor, implements the data processing method provided by the embodiments of the present application.
[0117] The specific embodiments described above do not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made depending on design requirements and other factors. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method of data processing, characterized by, The method comprises the following steps: In response to the generation instruction of the test case, obtain the instruction information corresponding to the generation instruction, call the preset analysis model to analyze the instruction information, and obtain the corresponding text information; Identify the process keyword in the text information, and query the matching test case set from the data dictionary based on the keyword; For each test case in the test case set, extract the page function list of the test case to match the text information, and determine the target test case according to the matching result; Based on the element sequence of each page extracted from the text information, run the target test case, compare each page element in the target test case with the element sequence according to the running order of the target test case, and obtain the comparison result; In response to the comparison result being different, update the elements of the page in the target test case to the corresponding elements in the element sequence; In response to the end of the running of the test case, generate a new test case based on the running end.
2. The method of claim 1, wherein, Updating the elements of the page in the target test case to the corresponding elements in the element sequence comprises: Obtain the function sub-element set corresponding to the page element in the element sequence, obtain the component information associated with each function sub-element, and update the component information to the elements of the page in the target test case.
3. The method of claim 2, wherein, Obtaining the component information associated with each function sub-element to update the component information to the elements of the page in the target test case comprises: Obtain the component type associated with each function sub-element to match the elements of the corresponding page in the target test case; In response to a successful match, obtain the component attribute value associated with the function sub-element to update the corresponding page element in the target test case based on the attribute value; in response to an unsuccessful match, obtain the component associated with the function sub-element to update the corresponding page element in the target test case based on the component.
4. The method of claim 1, wherein, Comparing each page element in the target test case with the element sequence to obtain the comparison result comprises: In response to the page element corresponding program being called, obtain the element identifier and input data of the program, query the corresponding target element from the element sequence based on the element identifier, obtain the configuration parameters of the target element, and compare the input data and the configuration parameters to obtain the comparison result.
5. The method of claim 1, wherein, Extracting the page function list of the test case to match the text information to determine the target test case according to the matching result comprises: Extract the page function list of the test case, obtain the function description feature corresponding to the function description feature, and identify the function description feature from the text information to obtain the identification result; In response to the identification result meeting the preset condition, the test case is determined as the target test case.
6. The method of claim 1, wherein, Calling the preset analysis model to analyze the instruction information to obtain the corresponding text information comprises: Calling the preset analysis model to convert the instruction information into a text format, splitting the instruction information in the text format based on a preset identifier, and obtaining each text segment; generate a text sequence based on the split order and the text segments to determine text information corresponding to the instruction information.
7. An apparatus for data processing, characterized by The method comprises the steps of: The analysis unit is configured to, in response to a generation instruction of a test case, acquire instruction information corresponding to the generation instruction, and invoke a preset analysis model to analyze the instruction information to obtain corresponding text information. The matching unit is configured to identify a process keyword in the text information, and query a matching test case set from a data dictionary based on the keyword. The determination unit is configured to extract a page function list of each test case in the test case set to match the text information, and determine a target test case according to a matching result. The comparison unit is configured to run the target test case based on an element sequence of each page extracted from the text information, and compare each page element in the target test case with the element sequence according to a running order of the target test case to obtain a comparison result. The update unit is configured to, in response to the comparison result being different, update an element of a page in the target test case to a corresponding element in the element sequence. The determination unit is configured to, in response to the target test case being run, generate a new test case based on the test case being run.
8. The apparatus of claim 7, wherein, The update unit is specifically configured to: Acquire a function sub-element set corresponding to a page element in the element sequence, acquire component information associated with each function sub-element, and update the component information to the element of the page in the target test case.
9. The apparatus of claim 8, wherein, The update unit is specifically configured to: Acquire a component type associated with each function sub-element to match the component type with the element of the corresponding page in the target test case. In response to a successful match, acquire a component attribute value associated with the function sub-element to update the attribute value to the element of the corresponding page in the target test case. In response to an unsuccessful match, acquire a component associated with the function sub-element to update the component to the element of the corresponding page in the target test case.
10. An electronic device, comprising: The method comprises the steps of: One or more processors; A storage device configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-6.
11. A computer readable medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the method of any one of claims 1-6.
12. A computer program product comprising a computer program, characterized in that, The program is executed by the processor to implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Method and device for generating automatic test codes
CN108710571A
Automatic case testing method, automatic case testing device and storage medium
CN115658532A