Automated test script processing method, system, equipment and medium
By using metadata to automatically parse and generate UI automated test scripts without manual scripting code, the problem of difficult test script modification and limited framework support in the existing technology is solved, and the efficiency and accuracy of test script generation is improved.
Patent Information
- Application Number
- CN202510367837.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-06-13
AI Technical Summary
Existing UI automation testing technology is prone to omissions or errors when modifying test scripts, and the framework has limited support for linkage checksum multi-attributes, resulting in inaccuracy and inefficiency of tests.
The first operation panel sets the business operation process, and the second operation panel sets up automatic testing function points to form a script without manually writing script code, and uses metadata to automatically parse and generate test scripts.
It improves the efficiency and accuracy of test script generation, ensures the consistency of test results, reduces the time and workload of manual script writing, and supports high-priority operations and sequential execution.
Smart Images

Figure CN120144477A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of automated testing, and particularly relates to a method, system, device and medium for processing automated testing scripts. Background Art
[0002] UI automated testing, also known as User Interface Automation Testing, is a testing method that simulates user operations by writing automated testing scripts to verify the functions and test the performance of software interfaces. Currently, it is based on identifying interface elements and simulating user operations, which can accurately identify buttons, input boxes, lists, etc. on the software interface, simulate user operations according to preset test cases, and finally determine whether the actual result is consistent with the expected result through assertions.
[0003] Before performing UI automated testing in related technologies, if the business logic, interface elements, or data rules of the test change, the test scripts often need to be extensively modified. Since the scripts are fixed and the code structure and logic are a complete set of solutions, it is easy to miss or make mistakes during modification, resulting in the inconsistency between the test scripts and the actual situation of the system, affecting the accuracy of the test. Moreover, the related technology frameworks have limited support for linkage verification and multi-attribute dependencies, and a large amount of customized code needs to be written. Some scripts lack an exception handling mechanism, resulting in a single point of failure blocking the overall test process. Summary of the Invention
[0004] The present invention provides a method for processing automated testing scripts. Through the first operation panel, the business operation process can be set, and then the automated testing function points can be set on the second operation panel to form a script, eliminating the need to manually write script code and improving development efficiency.
[0005] The method includes: Analyze the test status in the metadata; In response to enabling the test status, determine whether there is a function verification type attribute; If it exists and there is a verification test process for the data internal code control, parse out the verification type value corresponding to the verification type attribute; Based on the parsed verification type value, determine the specific verification type; If the verification type value belongs to a preset verification type set, perform a verification operation according to the processing logic corresponding to the verification type set; The processing logic in the verification type set includes, but is not limited to: automatic filling and read-only.
[0006] Furthermore, it should be noted that the manner of performing the verification operation according to the processing logic corresponding to the verification type set in the steps includes: Locate the functional verification type attribute from the metadata and obtain the value of the sub-attribute corresponding to the functional verification type attribute; Generate an automated script for automatic filling verification based on the metadata code and the value of the sub-attribute.
[0007] Furthermore, it should be noted that when the method executes a read-only process, the data internal code control is set to the read-only attribute; Generate a read-only verification automated script based on the metadata code; The read-only verification automated script locates the data internal code control, obtains and checks whether it contains the attribute value, and forms a record log according to the check result.
[0008] Furthermore, it should be noted that the method also includes: checking the value of the attribute number corresponding to enabling automated testing; If the value is yes, save the generated automated test script and name the generated automated test script file with the form name; Verify the generated automated test script.
[0009] Furthermore, it should be noted that after the step of determining whether there is a functional verification type attribute, it also includes: If it exists and the attribute value is to perform a business operation test on the data internal code control, obtain the business operation sequence attribute from the metadata and determine the operation sequence of the data internal code control; Execute the corresponding business operations on the data internal code control in sequence according to the operation sequence; During the operation process, perform specific actions according to the business operation type attribute.
[0010] Furthermore, it should be noted that after each operation is executed, intermediate state verification is performed; Verify whether the expected intermediate state information appears. At the same time, detect whether there is an exception prompt or error message; If an exception occurs, record the exception information and terminate the test process.
[0011] Furthermore, it should be noted that result verification is performed after the business operation is completed; If the result verification passes, generate an automated test script and record the execution situation and verification result of the operation; Check the value of the attribute for enabling automated testing: If the value is yes, save the generated automated test script and name the generated automated test script file with the form name.
[0012] This application also provides an automated test script processing system, which includes: A status parsing module for parsing the test status in the metadata; An attribute judgment module, configured to determine whether there is a function verification type attribute in response to enabling the test status; If it exists and has a verification test process for the data internal code control, parse out the verification type value corresponding to the verification type attribute; A type judgment module, configured to determine the specific verification type according to the parsed verification type value; A verification operation module, configured to perform a verification operation according to the processing logic corresponding to the preset verification type set when the verification type value belongs to the preset verification type set.
[0013] According to another embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the automated test script processing method are implemented.
[0014] According to still another embodiment of the present application, a storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the automated test script processing method are implemented.
[0015] From the above technical solutions, it can be seen that the present invention has the following advantages: The automated test script processing method provided by the present application improves the efficiency of test script generation through automated parsing of metadata and generation of test scripts. The entire process, from test status judgment to final script generation and verification, ensures the accuracy of the logic and operations of the test script by generating scripts based on metadata and a preset set of verification types. At the same time, the same metadata will generate the same test script, making the test results more consistent. Moreover, metadata-driven script generation allows for only adjusting the attribute values when the business logic changes, without modifying the script code.
[0016] When the business logic or interface of the system changes, only the relevant information in the metadata needs to be updated, and the script generator can automatically generate new test scripts. Moreover, the present application can also automatically generate test logic based on control attributes without hard coding. By parsing the conditions in uiCheckValue, boundary values and abnormal scenarios are ensured to be covered. The present application supports high-priority operations and sequential execution to meet business process dependencies. The consistency of UI automated test script behavior is ensured through unified attributes. Description of the Drawings
[0017] In order to more clearly illustrate the technical solutions of the present invention, the drawings required for description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0018] Figure 1 It is a flowchart of an automated test script processing method; Figure 2 It is a flowchart of an embodiment of an automated test script processing method; Figure 3 It is a flowchart of another embodiment of an automated test script processing method; Figure 4 It is a schematic diagram of an electronic device. Detailed implementation manners
[0019] The automated test script processing method provided by this application mainly aims at the problems in the prior art that automated testing based on manually writing UI test scripts results in a long development cycle, high maintenance costs, and poor stability. By automatically parsing metadata and generating test scripts, the time and workload of manually writing scripts are reduced. From test status judgment to final script generation and verification, this application is automatically completed based on metadata, avoiding a large number of repetitive manual operations and improving the speed of test script generation.
[0020] The following will describe in detail the specific process of the automated test script processing method. For the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are proposed to thoroughly understand the embodiments of this application. However, those skilled in the art should clearly understand that this application can also be implemented in other embodiments without these specific details.
[0021] It should be understood that when used in the specification of this application, the term "including" indicates the existence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations. The terms "including", "comprising", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0022] Statements such as "in one embodiment" or "in some embodiments" described in this application mean that the specific features, structures, or characteristics described in the embodiment are included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" and the like that appear in different places in this application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0023] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0024] Please refer to Figure 1 The following is a flowchart of an automated test script processing method in a specific embodiment. The method includes: S101: Parse the test status in the metadata.
[0025] In some embodiments, first scan the metadata, traverse the metadata attributes of the form controls, and locate the configuration nodes related to automated testing.
[0026] It should be noted that in this embodiment, the corresponding attribute number uiTest for enabling UI automated testing is enabled, and the attribute value is set to yes to generate a UI automated test script file in the preset directory, named after the form MobileIntegrationLY.py. If the attribute value is set to no, no automated test script will be generated.
[0027] As an example of the present application, find the file storing the test-related metadata in the system. This file can be in formats such as JSON or XML.
[0028] After reading the metadata file in this embodiment, the content of the metadata file is loaded and stored. In the metadata content, search for specific fields or identifiers representing the test status, such as the isTestEnabled field. Obtain the value corresponding to this field. Here, the value can be of boolean type, such as true or false. Of course, it can also be of text type, such as enabled or disabled, and convert it into test status information recognizable by the program. In this way, it can be determined whether to perform automated testing.
[0029] By parsing the test status in the metadata, the script generator can know whether the current test environment allows testing, avoid wasting resources to generate test scripts when testing is not required, and improve the efficiency and pertinence of testing.
[0030] S102: In response to enabling the test status, determine whether there is a functional verification type attribute.
[0031] In this embodiment, the functionalVerificationType attribute can be searched in the metadata. If the attribute exists, verify whether its value belongs to uiCheck or operationAndCheck.
[0032] It should be noted that in this embodiment, the property number corresponding to the functional verification type is functionalVerificationType, and its types include verification test and business operation test, corresponding to the property values uiCheck and operationAndCheck respectively. If the property value is uiCheck, it means that only the verification test is performed on the control. If the property value is operationAndCheck, it means that the business operation test is performed on the control.
[0033] Of course, if the property does not exist or the value is illegal, mark the control as not requiring functional verification and skip the subsequent verification steps. This can screen out the controls that need to perform functional verification and distinguish between verification tests and business operation tests.
[0034] S103: If it exists and there is a verification test process for the data internal code control, parse out the verification type value corresponding to the verification type property.
[0035] This embodiment can obtain the specific value from the functionalVerificationType property, convert the property value into an internally defined enumeration type, and bind the verification type value to the relevant metadata information of the control. Here, the uiCheck sub-property or the operationAndCheck sub-property can be associated.
[0036] It should be noted that the property number corresponding to the functional verification type is functionalVerificationType, and its types include verification test and business operation test, corresponding to the property values uiCheck and operationAndCheck respectively. If the property value is uiCheck, it means that only the verification test is performed on the control. If the property value is operationAndCheck, it means that the business operation test is performed on the control.
[0037] The verification type value corresponding to this embodiment has the property number uiCheckValue. Generate the corresponding verification type value according to the set verification type. For example, if the verification type is set to auto-fill, generate the verification type value property autoFillValue, and the property value is the auto-fill content. If the verification type is set to read-only, generate the verification type value property readonlyClass, and the property value is fm-readonly. This property value is used to determine whether the control is read-only. For the specific setting effect, please refer to the following description of UI automation operation property settings.
[0038] Exemplarily, in this embodiment, it can be first confirmed that the functional verification type attribute exists. Based on the judgment result of step S102, ensure that the functionalVerificationType attribute actually exists in the metadata. Search for information related to the verification test of the data internal code control in the metadata to confirm whether there is a verification test requirement for this control. Find the uiCheckType field related to the verification type in the metadata. Finally, obtain the value corresponding to this attribute, which can include various verification types, such as autofill, read-only, required, custom verification rules, visible, disabled, etc., and extract and parse it. In this way, the specific verification type can be clarified. By parsing the verification type value, the script generator can know which specific verifications need to be performed on the data internal code control, and thus generate corresponding test scripts.
[0039] S104: Determine the specific verification type according to the parsed verification type value.
[0040] In this embodiment, the verification type value can be matched with autofill or read-only in the preset verification type set. If the match is successful, enter the processing logic corresponding to the verification type. If the match fails, trigger the error handling process and record the unknown verification type status. The loading of sub-attributes can be implemented by loading the associated autofill according to the verification type and reading uiCheckValue.autoFillValue. It should be noted that the control involved in this embodiment is the data internal code control.
[0041] In some specific embodiments, obtain the parsed verification type value. It can be based on the verification type value corresponding to the verification type attribute obtained from step S103. Define common verification types in advance in the script. Compare the parsed verification type value with the preset verification type list to determine which specific verification type or types it belongs to. Step S104 can convert the abstract verification type value into a specific and operable verification type, which is convenient for subsequent execution of corresponding processing logics according to different verification types. By determining the verification type, the script generator can generate targeted test scripts for each verification type, improving the accuracy of the test.
[0042] S105: If the verification type value belongs to the preset verification type set, perform verification operations according to the processing logic corresponding to the verification type set; the processing logics in the verification type set include, but are not limited to, autofill and read-only.
[0043] It should be noted that to check whether the verification type value is in the preset set, the specific verification type obtained by the judgment in step S104 can be compared with the preset verification type set to confirm whether it belongs to this set, and the corresponding processing logic is executed according to the verification type.
[0044] In this embodiment, when positioning the attributes related to automatic filling, the attributes related to automatic filling can be found in the metadata, such as the autoFillValue sub-attribute in uiCheckValue. The values required for automatic filling can be extracted from the relevant attributes, and YWFT200028 can be used. Simulate the automatic filling process, fill the extracted values into the data internal code control, and check whether the filling result meets the expectations.
[0045] If the verification type is read-only, the read-only attribute of the control can be checked. Here, it is determined whether the control is set to read-only by checking whether the class attribute of the control contains fm-readonly.
[0046] If it is read-only, a read-only verification operation can be performed. Try to perform a write operation on the control to verify that writing is not possible to confirm its read-only state.
[0047] In this embodiment, through hierarchical parsing, from metadata, verification type to sub-attributes, as well as property mapping, code snippets, and template integration, the automated conversion from metadata configuration to a complete test script is achieved. The script generation is controlled by the uiTest attribute to adapt to the requirements of different test environments. Also, by combining and executing the corresponding processing logics according to different verification types, specific verification operations on the data internal code control are realized. Ensure that the data internal code control can work properly under different verification rules.
[0048] In an embodiment of the present invention, based on step S104, as Figure 2 shown, a possible embodiment will be given below to non-restrictively elaborate on its specific implementation scheme.
[0049] S1041: Determine the specific verification type according to the parsed verification type value; S1042, if the attribute value is operationAndCheck, it means to perform a business operation test on the control.
[0050] For the business operations of this embodiment, the business operation order can be set. The business operation order corresponds to the attribute number operationNumber. According to the order of the controls added by dragging, the development platform will automatically mark the business operation order for the controls and automatically generate a sequence number. If, according to business requirements, the attributes of the controls in the visual designer are adjusted, the sequence number corresponding to this attribute will be automatically updated according to the control order without manual adjustment.
[0051] When performing business operations, the type of business operation can be set, specifically corresponding to the attribute number uiOperationType. The types of business operations include clicking, entering text, swiping the page, etc., corresponding to the attribute values click, send_keys, swipe_up, swipe_down, etc. Among them, swipe_up and swipe_down are custom encapsulated methods built into the development platform, which can be used to swipe up or down to a control with the specified text.
[0052] The specific sub-steps for testing the business operations of the control in this embodiment can be performed as follows: S1042-1: Obtain the business operation sequence operationNumber, and determine the order of control operations according to the business operation sequence. If there are high-priority business operations, the high-priority operations are processed first.
[0053] In this embodiment, the high-priority business operation corresponds to the attribute number callOperationNumber. After performing business operations on some controls, it is necessary to first call the control with the specified sequence number, and then perform operations according to the control layout sequence number in the visual designer. By configuring this attribute, the control with the specified sequence number can be called first, and after completing the business operation and verification, the operations can be performed according to the sequence number. The type of business operation corresponds to the attribute number callOperationType, and the types of business operations include clicking, entering text, swiping the page, etc.
[0054] In this embodiment, the operationNumber attribute can be found in the metadata, and the operationNumber attribute stores the operation sequence of each control in the form of a list.
[0055] According to the value of operationNumber, sort the controls to be operated to determine the order of operations. Finally, search for the callOperationNumber attribute in the metadata. If this attribute exists, insert the operation of the specified control in front of the operation sequence for priority processing.
[0056] S1042-2: For each control to be operated, obtain its business operation type uiOperationType, and determine the specific operation action according to the operation type. The specific operation method can be clicking, entering text, etc.
[0057] In this embodiment, each control is processed in sequence according to the operation sequence determined in step S1042-1. For each control, find the uiOperationType attribute in the metadata and obtain its corresponding value. According to the value of uiOperationType, such as click corresponding to the click operation, send_keys corresponding to the input text operation, etc., determine the specific action to be performed on the control. In this way, for the specific operation method of each control, the test can accurately simulate the user's operation behavior according to the business requirements, improving the effectiveness of the test.
[0058] S1042-3: If it involves calling the operation of the control with the specified sequence number callOperationNumber, obtain its corresponding business operation type callOperationType and perform the corresponding operation.
[0059] In this embodiment, it is possible to check whether there is a callOperationNumber attribute in the metadata. According to the value of callOperationNumber, find the corresponding control. Here, the value of the callOperationType attribute corresponding to this control can be found based on the metadata. According to the value of callOperationType, perform the corresponding operation on the control with the specified sequence number. This can ensure that special operations can be correctly executed and guarantee the integrity of the business process.
[0060] S1042-4: Perform the corresponding business operations on the controls in sequence according to the operation sequence.
[0061] During execution, in combination with the operation sequence determined in step S1042-1, each control can be taken out in sequence. According to the operation action determined in step S1042-2, perform the corresponding business operation on the current control. Repeat step S1042-1 and step S1042-2 until the operations of all controls are completed.
[0062] On the basis of the above embodiment, in order to further improve the reliability of the automated test script processing method provided in the above embodiment, the following is a further implementable manner. In one embodiment, this embodiment also performs intermediate state verification during the business operation process. The way of intermediate state verification can be: S201: Check whether intermediate state information such as expected loading prompts and data processing prompts appears on the page during the operation process.
[0063] In this embodiment, after each control operation is executed, wait for a certain period of time to allow the page enough time to display intermediate state information. According to the business requirements, check whether expected loading prompts, data processing prompts and other information appear on the page. If the expected intermediate state information is found, record it as verification passed; otherwise, record it as verification failed.
[0064] This embodiment verifies whether the intermediate state of the page during the business operation meets the expectations, ensures that the business operation can normally feedback the processing progress during the execution, and promptly discovers possible anomalies during the operation.
[0065] S202: Verify whether there are any abnormal prompts or error messages during the operation.
[0066] In this embodiment, after each control operation is executed, it is determined whether there are any abnormal prompts or error messages. It can be determined by searching for error prompts, the status code of the page, etc. If no abnormal prompt or error message is found, it is recorded as verification passed; otherwise, it is recorded as verification failed, and the specific error message is recorded. This can promptly discover anomalies that occur during the business operation and ensure the accuracy and reliability of the test.
[0067] As a way of this embodiment, result verification is also performed after the business operation. Specifically, it can be checked whether the state change of the control meets the expectations, such as whether the button becomes unavailable, etc. This embodiment clarifies the changes that should occur to the relevant data in the database after the operation according to the requirements of the business operation, such as data insertion, update, deletion, etc. Query the database to obtain the actual data. Compare the actual data with the expected data. If the actual data is consistent with the expected data, it is recorded as verification passed; otherwise, it is recorded as verification failed. Ensure the accuracy and integrity of the business data and ensure the correct data processing logic of the system.
[0068] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0069] The following are embodiments of an automated test script processing system provided by the embodiments of the present disclosure. This system and the automated test script processing methods of the above embodiments belong to the same inventive concept. For the details not described in detail in the embodiments of the automated test script processing system, reference can be made to the embodiments of the above automated test script processing methods.
[0070] The system includes: a status parsing module for parsing the test status in the metadata.
[0071] An attribute judgment module for determining whether there is a function verification type attribute in response to enabling the test status.
[0072] If it exists and there is a verification test process for the data internal code control, the verification type value corresponding to the verification type attribute is parsed.
[0073] A type judgment module, configured to judge a specific verification type according to the parsed verification type value.
[0074] A verification operation module, configured to perform a verification operation according to the processing logic corresponding to the preset verification type set when the verification type value belongs to the preset verification type set.
[0075] In this application, from the test status judgment to the final script generation and verification, all are automatically completed based on metadata, avoiding a large number of repetitive manual operations and improving the speed of test script generation. This application generates scripts based on metadata and a preset verification type set, ensuring the accuracy of the logic and operations of the test scripts. At the same time, the same metadata will generate the same test scripts, avoiding differences in test scripts caused by human factors.
[0076] As an implementation manner of an automated test script processing system, according to the above-mentioned logic and verification steps of business operation testing, a corresponding UI automated test script is generated. Check the uiTest value of the test attributes of the UI automated test script. If the verification is passed, the generated automated test script is saved to a preset directory.
[0077] Further, taking the reimbursement form internal code control as an example to illustrate the specific implementation manner of the above-mentioned embodiment of the automated test script processing system. In order to completely illustrate the specific implementation process in this embodiment, the method includes the following steps: Obtain the reimbursement form internal code control, and set the test attributes through the UI automated operation property panel.
[0078] In this embodiment, the UI automated test attributes can be enabled and set to be, and then the function verification type is set.
[0079] In this embodiment, the function verification type of the reimbursement form internal code control is set to verification test, indicating that only this control is subjected to verification test. After the setting is completed, switch to the code editor to automatically generate the following attributes: "uiTest": true, "functionalVerificationType": "uiCheck".
[0080] In this embodiment, the verification type attribute of the control is set to auto-fill and read-only, and switch to the code editor to automatically generate the following attributes: uiCheckType represents the verification type attribute number, the sub-attribute autoFill represents the auto-fill verification, and the sub-attribute readonly represents the read-only verification.
[0081] This embodiment is based on the development platform parser and makes judgments according to the sub - attributes in the verification type uiCheckType attribute. If the value of the autoFill attribute is true, it will obtain the auto - fill content YWFT200028 in the business operation attribute settings, automatically generate the verification type value attribute uiCheckValue, and the sub - attribute "autoFillValue": "YWFT200028". If the value of the readonly attribute is true, it will automatically generate the sub - attribute "readonlyClass": "fm - readonly".
[0082] For this embodiment, controls can be added by dragging in the development platform toolbox. After adding the controls, the control layout can be seen in real - time in the visual designer. According to the order of adding the controls, the development platform will mark them as the business operation order and automatically generate attributes when switching to the code editor.
[0083] During the execution process, through the UI automation operation property panel settings, first set the enable UI automation test property to yes, and set the function verification type. The function verification type of the reimbursement form internal code control is set to business operation test, the business operation type is set to input text, and the input text value is the mobile phone expense reimbursement within the preset time period.
[0084] Then set the business high - priority operation. Set the operation call specified sequence number control callOperationNumber to N, where N corresponds to the business operation sequence number of the save control. Set the operation type of the call specified sequence number control to click, indicating that the reimbursement description control needs to first call the click operation of the save control and then execute according to the control layout order. Set the verification type to required and custom verification rule verification. The development platform generator will automatically generate the verification value - related attributes and automatically generate attributes when switching to the code editor.
[0085] As an implementation of this automated test script processing system, as Figure 3 shown, it can specifically involve the following steps: Step S501: Parse the test status in the metadata code.
[0086] Step S502: In response to the enabled test status, determine whether there is a functional verification type attribute functionalVerificationType. If the test status is enabled, search for the functionalVerificationType attribute in the metadata code and determine whether it exists.
[0087] Step S503: If it exists and there is a verification test process for the data internal code control, parse out the verification type value corresponding to the verification type attribute uiCheckType.
[0088] Step S504: Determine the specific verification type according to the parsed verification type value.
[0089] In this embodiment, it can be set that the parsed verification type value is V, and the preset verification type set is S = {s1, s2, ⋯, sn}. If V ∈ S, then determine the corresponding verification type as V.
[0090] Step S505: If the attribute value is operationAndCheck, it means to perform a business operation test on the control.
[0091] In this embodiment, the business operation sequence number can be read and the operation is executed starting from sequence number 1. If the business high-priority operation attribute callOperationNumber is not empty, read its sequence number and the value of the callOperationType attribute, directly call the preset control first and execute the corresponding event, and then perform the verification test.
[0092] Judge whether the attribute value of the verification type value uiCheckType is empty.
[0093] If it is empty, it indicates that the control only performs operations without verification; if it is not empty, it means that verification is required after the operation.
[0094] For the scenario that requires verification, parse the sub-attributes in uiCheckValue. Exemplarily speaking, for this control, the length L of the verification output value needs to satisfy 10 ≤ L ≤ 20.
[0095] Optionally, set the business operation sequence number set as O = {o 1 , o 2 , ⋯, o m}, and this embodiment can start executing the operation from o 1 .
[0096] If the sequence number corresponding to callOperationNumber is k, first execute the operation with sequence number k.
[0097] Set the attribute value of uiCheckType as U. If U = null, the operation is not verified; if U!= null, the operation is verified after execution. Set the length of the output value as L, and it needs to satisfy 10 ≤ L ≤ 20.
[0098] Step S506: Generate corresponding UI automation test scripts for different verification types.
[0099] It should be noted that in this embodiment, the verification type is defined as automatic filling, that is, the value of the autoFill attribute is true. The value corresponding to the autoFillValue sub - attribute is obtained from the uiCheckValue attribute, and a UI automation script for automatic filling verification is generated according to the metadata code of the form.
[0100] If the verification type is read - only, the value of the readonly attribute is true. The internal code control of the reimbursement form is set to read - only. Using a code generator, the class attribute of this control in the Dom structure at runtime is added with fm - readonly, and a UI automation script for read - only verification is generated according to the metadata code of the form.
[0101] Step S507: Save the generated automated test script. Generating the test script according to the preset rules and metadata ensures the accuracy of the logic and operations of the test script. No matter which tester executes the test, the same script is used, improving the consistency of the test results.
[0102] As Figure 4 shown, the present application also provides an electronic device, including a display module 103, a memory 102, a processor 101, and a computer program stored on the memory and executable on the processor 101. When the processor 101 executes the program, it implements the steps of the automated test script processing method.
[0103] In the embodiments of the present invention, the electronic device includes, but is not limited to, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described herein and / or claimed.
[0104] In the embodiments of the present application, the processor 101 may be implemented by using at least one of an application specific integrated circuit (ASIC), a programmable logic device (PLD), a field programmable gate array (FPGA), a processor, a controller, a microcontroller, a microprocessor, and an electronic unit designed to execute the functions described herein. In some cases, such an implementation may be implemented in the controller. For a software implementation, an implementation such as a process or a function may be implemented with a separate software module that allows execution of at least one function or operation. The software code may be implemented by a software application (or program) written in any appropriate programming language. The software code may be stored in the memory and executed by the controller.
[0105] The display module 103 is used to display information input by the user or information provided to the user. The display module 103 may include a display panel, and the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0106] The memory 102 may be used to store software programs and various data. The memory 102 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0107] The present application also provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the automated test script processing method are implemented.
[0108] The storage medium may be any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, 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.
[0109] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. 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 invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing automated test scripts, characterized in that: Methods include: Parse the test status in metadata; In response to the test state being enabled, determining whether a function verification type attribute exists; If it exists and there is a verification test process for the data internal code control, the verification type value corresponding to the verification type attribute is parsed; Determine the specific verification type based on the parsed verification type value; If the verification type value belongs to the preset verification type set, the verification operation is performed according to the processing logic corresponding to the verification type set; The processing logic in the verification type set includes but is not limited to: automatic filling and read-only.
2. The automated test script processing method according to claim 1, characterized in that: The step of performing the verification operation according to the processing logic corresponding to the verification type set includes: locating the function verification type attribute from the metadata, and obtaining the value of the sub-attribute corresponding to the function verification type attribute; Generates an automated script for auto-fill verification based on the metadata code and sub-attribute values.
3. The automated test script processing method according to claim 1, characterized in that: When executing a read-only process, the method sets the data internal code control to a read-only attribute; Generate read-only verification automation script based on metadata code; The read-only verification automation script locates the data internal code control, obtains and checks whether the attribute value is contained, and forms a record log based on the inspection result.
4. The automated test script processing method according to claim 1, characterized in that: The method also includes: checking the value of the property number corresponding to enabling the automated test; If the value is yes, the generated automated test script will be saved and the generated automated test script file will be named with the form name; Verify the generated automated test scripts.
5. The automated test script processing method according to claim 1, characterized in that: The step of determining whether the function verification type attribute exists also includes: If it exists, and the attribute value is to perform business operation test on the data internal code control, then obtain the business operation sequence attribute from the metadata to determine the data internal code control operation sequence; Execute business operations on the data internal code controls in sequence according to the operation order; During the operation process, the business operation is executed according to the business operation type attributes.
6. The automated test script processing method according to claim 5, characterized in that: After each operation is executed, the intermediate state verification is performed; Verify whether the expected intermediate status information appears, and detect whether there are any abnormal prompts or error messages; If an exception occurs, the exception information is recorded and the test process is terminated.
7. The automated test script processing method according to claim 5, characterized in that: After the business operation is completed, the result verification is performed; If the result is verified, an automated test script is generated and the execution of the operation and the verification result are recorded; Check the value of the Enable automated testing property: If the value is yes, the generated automated test script will be saved and the generated automated test script file will be named with the form name.
8. An automated test script processing system, characterized in that: The system is used to implement the automated test script processing method according to any one of claims 1 to 7; the system comprises: The status parsing module is used to parse the test status in the metadata; an attribute determination module, for determining whether a function verification type attribute exists in response to the test enabling state; If it exists and there is a verification test process for the data internal code control, the verification type value corresponding to the verification type attribute is parsed; The type judgment module is used to judge the specific verification type according to the parsed verification type value; The verification operation module is used to perform a verification operation according to the processing logic corresponding to the verification type set when the verification type value belongs to a preset verification type set.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the automated test script processing method according to any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the automated test script processing method according to any one of claims 1 to 7 are implemented.