Automated test script acceptance method, electronic equipment and storage medium
By accepting automated test scripts in multiple script execution environments and ensuring that the configuration files before and after execution in these environments are consistent, the problem of the quality of automated test scripts cannot be guaranteed and the efficiency of software system testing is improved.
Patent Information
- Application Number
- CN202311638546.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2025-06-03
AI Technical Summary
The quality of automated test scripts cannot be guaranteed, resulting in low testing efficiency of software systems.
By deploying the automated test scripts to be accepted in multiple script execution environments, conducting acceptance tests in each environment, obtaining the configuration files before and after the script is executed, ensuring that the script can be executed and passed in multiple environments and the configuration files are consistent, then the acceptance is confirmed to be passed.
It improves the quality of automated test scripts, reduces the time to analyze the causes of script failures, improves the efficiency of software system testing, and allows testers to locate software system failures faster.
Smart Images

Figure CN120086122A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of software testing, and particularly to an automated test script acceptance method, an electronic device, and a storage medium. Background Art
[0002] When testing a software system with an automated test script, the automated test script may execute fails. The reasons for failure include the reasons of the automated test script itself and the failure of the software system. Among them, the purpose of testing the software system with the automated test script is to determine whether there are problems in the software system. If there are problems, the location of the software system failure is carried out.
[0003] However, due to the uneven skills of the automated test script writers, the quality of the automated test scripts cannot be guaranteed. When the personnel responsible for centrally running the scripts use these automated test scripts to test the software system, most of their energy is spent on analyzing the reasons for the script failure rather than locating the software system failure, resulting in low software system test efficiency.
[0004] Therefore, in practical applications, a script acceptance scheme for improving the software system test efficiency and improving the quality of the scripts stored in the library is needed. Summary of the Invention
[0005] The main purpose of this application is to provide an automated test script acceptance method, an electronic device, and a storage medium, aiming to solve the technical problem that in the related technology, the quality of the automated test script cannot be guaranteed, resulting in low software system test efficiency.
[0006] To achieve the above purpose, an embodiment of this application provides an automated test script acceptance method, and the method includes:
[0007] Obtain an automated test script to be accepted;
[0008] Deploy the automated test script to multiple script execution environments, and perform acceptance tests on the automated test script in each of the script execution environments to obtain the configuration files before and after the execution of the automated test script;
[0009] When the automated test script passes the execution and the configuration files before and after the execution of the automated test script are consistent, determine that the automated test script passes the acceptance.
[0010] The present application further provides an automated test script acceptance device, which is an entity node device. The automated test script acceptance device includes: a memory, a processor, and a program of the automated test script acceptance method stored on the memory and executable on the processor. When the program of the automated test script acceptance method is executed by the processor, the steps of the automated test script acceptance method as described above can be implemented.
[0011] To achieve the above object, a storage medium is further provided. An automated test script acceptance program is stored on the storage medium. When the automated test script acceptance program is executed by a processor, the steps of any one of the above-described automated test script acceptance methods are implemented.
[0012] Before using an automated test script to test a software system in an embodiment of the present application, the automated test script is accepted. By deploying the automated test script to be accepted in multiple script execution environments and testing in multiple environments, the automated test script can pass in multiple execution environments, and when the configuration files before and after the execution of the automated test script are consistent, it is determined that the acceptance is passed, thereby ensuring that there is no configuration residue in the acceptance process of the script. Since the configuration residue may cause abnormal execution when the next execution script is tested, it is necessary to ensure that the configuration files before and after the execution of the automated test script are consistent, so that when testing the software system through the automated test script, the failure of the automated test script execution is not due to the possible execution failure situation during the operation of the automated test script, thereby avoiding the situation of the automated test script execution failure caused by the operation failure of the automated test script itself. It can be understood that in an embodiment of the present application, when the automated test script execution fails, it is not necessary for the personnel responsible for centrally running the script to spend most of their energy analyzing the reason for the script failure, but the energy can be directly spent on locating the software system failure, thereby improving the software system test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a schematic flowchart of the first embodiment of the automated test script acceptance method of the present application;
[0014] Figure 2 It is a schematic flowchart of the automated test script acceptance process involved in the automated test script acceptance method of the present application;
[0015] Figure 3 It is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application;
[0016] Figure 4 It is a schematic diagram of the application scenario involved in the automated test script acceptance method of the present application;
[0017] Figure 5 This is a schematic structural diagram of the device involved in the acceptance method of the automated test script of this application. Detailed implementation manners
[0018] It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.
[0019] An embodiment of this application provides an acceptance method for an automated test script. In the first embodiment of the acceptance method for the automated test script of this application, refer to Figure 1 , the method includes the following steps:
[0020] Step S10, obtain the automated test script to be accepted;
[0021] It should be noted that the acceptance method for the automated test script can be applied to an automated test script acceptance device. The automated test script acceptance device belongs to an automated test script acceptance system, and this automated test script acceptance system belongs to an automated test script acceptance device.
[0022] It should be noted that the execution subject of this method is an automated test script acceptance device. By receiving the scripts submitted by the user and deploying each script in multiple execution environments, and jointly executing and accepting through multiple execution environments, the corresponding execution results and configuration residue results are obtained. According to the execution results and configuration residue results, it is determined whether the automated test script meets the acceptance criteria. After determining that there are no quality problems with the script itself, the obtained scripts are summarized and input into the script database.
[0023] It should be noted that the automated test script can be an execution script for system testing, etc., and can be scripts written in various programming languages (such as C++, JAVA, etc.), and specific limitations are not made.
[0024] Step S20, deploy the automated test script in multiple script execution environments, and perform acceptance testing on the automated test script in each script execution environment to obtain the configuration files before and after the execution of the automated test script;
[0025] It should be noted that the script execution environment can be a test environment for executing scripts. When the current script is deployed in different execution environments, different problems may occur, so it is necessary to ensure that the script can pass the acceptance in multiple execution environments.
[0026] It should be noted that the configuration files before and after the execution of the automated test script are the initial configuration file and the environmental configuration accessory after execution respectively. Passing the script execution can determine that there will be no problems during the execution of the current script. Obtaining the configuration files before and after the execution of the automated test script is used to determine that there will be no configuration residue when the automated test script is executed. If there is configuration residue after the script is executed, it will still cause the next script to run. Therefore, to ensure that the execution of the current script will not affect the operation of other scripts and improve the script quality.
[0027] Among them, step S20 of obtaining the configuration files before and after the execution of the automated test script by performing an acceptance test on the automated test script in each script execution environment includes:
[0028] Step S21, initialize and configure the script execution environment;
[0029] It should be noted that the purpose of initializing the script execution environment is to clear other interfering factors in the current script execution environment, such as redundant data and irrelevant files, to avoid external factors affecting the operation of the script.
[0030] Step S22, modify the automated test script, and the modification is used to obtain the configuration files before and after the execution of the automated test script;
[0031] It should be noted that the way to modify the automated test script can be to insert keywords for extracting configuration files at the configuration and de-configuration locations of the script, so that after the script is executed, the initial configuration file before the script execution and the configuration file after the script execution can be extracted.
[0032] Step S23, in each script execution environment, execute the modified automated test script to obtain the script execution result;
[0033] It should be noted that after the automated test script is executed in each script execution environment, the script execution result is obtained. Among them, the script execution result includes whether the script execution passes and whether there is configuration residue in the current script, etc.
[0034] Step S24, based on the script execution result, extract the configuration files before and after the execution of the automated test script.
[0035] It should be noted that after the script is executed, all the configuration files of the device can be obtained before the script execution by inserting the keyword for obtaining device configuration at the upper configuration, and all the configuration files of the device can be obtained after the script execution by inserting the keyword for obtaining device configuration at the de-configuration.
[0036] Among them, the step S22 of modifying the automated test script includes:
[0037] Step S220, inserting configuration extraction fields at the configuration setting and de - configuration positions of the automated test script to obtain the modified automated test script. The extraction fields are used to obtain the first configuration file before the execution of the automated test script and the second configuration file after the execution of the automated test script.
[0038] It should be noted that in the script framework of the automated test script, there are both configuration setting and de - configuration positions. The configuration extraction field can be to obtain all device configuration keywords, and through these keywords, the configuration files before and after the script execution can be extracted.
[0039] It should be noted that the first configuration file is the initial configuration file before the script execution, and the second configuration file is all the environment configuration files in the device after the execution.
[0040] Among them, before the step S20 of deploying the automated test script to multiple script execution environments, it includes:
[0041] Step S100, obtaining at least one environment label corresponding to the automated test script;
[0042] It should be noted that the environment label is the label of the script execution environment corresponding to each automated test script. Each script execution environment corresponds to one environment label. Among them, the number of environment labels corresponding to one automated test script can be 2, 3, etc., which can be changed according to user needs and is not specifically limited.
[0043] Step S101, determining the script execution environment of the automated test script corresponding to each environment label.
[0044] It should be noted that after the environment label corresponding to the script is determined, according to this environment label, the script can be assigned to the corresponding script execution environment.
[0045] Among them, before the step S100 of obtaining at least one environment label corresponding to the automated test script, it includes:
[0046] Step S080, obtaining at least one script label of the automated test script;
[0047] It should be noted that the method for obtaining the script tags of the automated test script can be as follows: The gerrit repository where the user is located is hooked up with a jenkins static checker (a continuous integration tool developed based on Java). When the user submits the script through gerrit, the jenkins task is triggered, and the script static checker is started. The scripts that fail the static check are directly sent back to the user for modification; the scripts that pass the static check generate a temporary table for automatic script acceptance, and the temporary table for automatic script acceptance records information such as the gerrit commit-id, script path, and script tags of the submitted script.
[0048] Step S090, based on one or more of the script tags, add one or more environment tags to the automated test script.
[0049] It should be noted that the script tags are used as the identifier of the current script to identify the script. After determining the script tags of the currently submitted automated test script, multiple environment tags are added to the automated test script to determine the multiple script execution environments to be deployed.
[0050] Wherein, before step S20 of deploying the automated test script to multiple script execution environments, it further includes:
[0051] Step S110, in response to the submission of the automated test script, check the format of the automated test script;
[0052] It should be noted that after detecting the automated test script submitted by the user, the format of the script is checked through the static checker to determine that the format of the script meets the requirements.
[0053] Step S120, when the format meets the preset format requirements, execute the step of deploying the automated test script to multiple script execution environments.
[0054] It should be noted that after determining that the script format meets the preset format requirements, the automated test script is then deployed to each script execution environment. If it does not meet the requirements, it is sent back to the user to modify the format again.
[0055] Step S30, when the automated test script is executed successfully and the configuration files before and after the execution of the automated test script are consistent, determine that the automated test script passes the acceptance.
[0056] It should be noted that the successful execution of the automated test script indicates that there are no problems in the script execution process. In the current related technologies, most of them do not perform any redundant operations after determining that the script has been executed successfully. In this application, after determining that the configuration files before and after the script execution in multiple script execution environments are consistent, the script is determined to pass the acceptance, so as to ensure that there is no configuration residue after the automated test script is executed, thus not affecting the operation of other scripts and improving the quality of the script after passing the acceptance.
[0057] Specifically, the schematic diagram of the acceptance process of the automated test script is as Figure 2 shown. After the user submits the automated test script, Jenkins intercepts the static check. After the static check passes, an acceptance temporary table record is generated. Through the acceptance scan distribution program, multiple acceptance table records with environment tags are generated. In the acceptance table records, the script tag and environment tag of the script are included, etc. Before deploying to each execution environment, the script is modified and the acceptance keyword is inserted. When it is determined that all the acceptance program scripts have been executed successfully and there is no configuration residue, an interruption operation is performed on the script, and it is determined whether there is any configuration residue after the interruption operation. When both tests pass, the acceptance is considered to have passed; otherwise, the acceptance fails.
[0058] Before using the automated test script to test the software system in the embodiments of the present application, the automated test script is accepted. By deploying the automated test script to be accepted in multiple script execution environments and testing it in multiple environments, the automated test script can be executed successfully in multiple execution environments, and only when the configuration files before and after the execution of the automated test script are consistent, the acceptance is determined to have passed, thus ensuring that there is no configuration residue in the acceptance process of the script. Since configuration residue may cause abnormal execution when the next execution script is tested, it is necessary to ensure that the configuration files before and after the execution of the automated test script are consistent, so that when testing the software system with the automated test script, the failure of the automated test script execution is not due to possible execution failure situations that may occur during the operation of the automated test script, thus avoiding the situation where the execution of the automated test script fails due to its own operation failure. It can be understood that the embodiments of the present application achieve that when the automated test script fails to execute, the personnel responsible for centrally running the script do not need to spend most of their energy analyzing the reasons for the script failure, but can directly spend their energy on locating the software system failure, thereby improving the testing efficiency of the software system.
[0059] Furthermore, based on the first embodiment of the present application, another embodiment of the present application is provided. In this embodiment, after the automated test script has been executed successfully and the configuration files before and after the execution of the automated test script are consistent, the method further includes:
[0060] Step S301: For each of the script execution environments, execute the automated test script again.
[0061] It should be noted that in each script execution environment, after determining that the automated test script has passed, the script is executed again.
[0062] Step S302: During the running of the automated test script, perform an interruption operation and continue to execute the automated test script.
[0063] It should be noted that the purpose of the interruption operation is to test the stability of the script during execution. After performing the interruption operation, it is also necessary to obtain the configuration files before and after the script execution after the interruption operation. Furthermore, it is necessary to continue to execute the automated test script.
[0064] Step S303: After the automated test script is executed, obtain the configuration files of the automated test script before and after the interruption operation.
[0065] It should be noted that after the script is executed, obtain the configuration files before and after the interruption operation. When the script modification is completed, by assembling the command line parameters for the first run of the script, control the non - effectiveness of the forced interruption keyword for the first run, start a thread to execute the script, and wait for the script to complete execution. If the result of the script execution is a failure, do not perform a second interruption execution. Determine the residual configuration situation by comparing the device configuration files before and after the script execution.
[0066] Among them, after executing the automated test script again for each of the script execution environments, it further includes:
[0067] Step S221: Insert a forced interruption field into the latter - half fields of the automated test script. The forced interruption field is used to interrupt the running of the automated test script when the automated test script is run again to the forced interruption field after the first successful execution, and the forced interruption field does not take effect during the first execution of the automated test script.
[0068] It should be noted that the forced interruption field is a code field inserted into the latter - half fields of the automated test script. After inserting the forced interruption field into the latter - half fields, when the script is about to complete execution, it can interrupt the running of the script when running to the forced interruption field.
[0069] It should be noted that the purpose of performing an interruption operation on the script is to: test the stability of the script and improve the quality of the scripts that pass the acceptance.
[0070] It should be understood that the forced interruption field does not take effect when the script is executed for the first time. The script execution can be forced to interrupt anywhere in the script to verify the residual situation of the script configuration in the case of abnormal interruption. It can be controlled by command-line parameters not to take effect when the script is executed for the first time and to take effect when the script is interrupted for the second time. Since the interruption operation is performed after confirming that the script has been successfully executed for the first time, it is necessary to ensure that the forced interruption field is not triggered when the script is executed for the first time.
[0071] Among them, determining that the automated test script passes the acceptance also includes:
[0072] Step S310, when the configuration files before and after the interruption operation are the same, determine that the automated test script passes the acceptance.
[0073] It should be noted that when the configuration files before and after the interruption operation are the same and the script has been successfully executed for the first time, it can be determined that the automated test script passes the acceptance.
[0074] Among them, after obtaining the configuration files before and after the execution of the automated test script, it also includes:
[0075] Step S320, for any script execution environment, when the automated test script execution fails or the configuration files before and after the interruption operation are inconsistent, determine that the automated test script fails the acceptance.
[0076] It should be noted that for any script execution environment, the automated test script is determined to pass the acceptance only when the execution of the automated test script is successful, the configuration files before and after the execution are the same, and the configuration files before and after the interruption operation are the same. If any of the three conditions is not met, it is determined that the automated test script fails the acceptance.
[0077] Specifically, after the script execution is completed, collect the script execution results and the residual configuration situation. If the first execution result of the script fails, it is not allowed to be stored in the library; if there is residual configuration in the first execution of the script, it is not allowed to be stored in the library; if there is residual configuration in the interrupted execution of the script, it is not allowed to be stored in the library; when the first execution of the script is successful, there is no residual configuration in the first execution, and there is no residual configuration in the interrupted execution, then it is allowed to be stored in the library.
[0078] In this embodiment, by performing an interruption operation on the script and comparing the configuration files before and after the script is interrupted and executed, when it is determined that the configuration files before and after the interruption operation are the same, it is determined that the script passes the acceptance, ensuring the stability of the script stored in the library and preventing configuration residues from occurring in the case of being interrupted.
[0079] Further, based on the first and second embodiments of the present application, another embodiment of the present application is provided. In this embodiment, the acceptance test of the automated test script is performed in each of the script execution environments to obtain the configuration files before and after the execution of the automated test script, and it further includes:
[0080] Step S201: Obtain the total quantity of acceptance devices required for the acceptance test of the automated test script. The total quantity is the product of a first quantity and the number of script environments of the script execution environment, and the first quantity is the number of acceptance devices required to execute the automated test script in each of the script execution environments.
[0081] It should be noted that in each script execution environment, the number of acceptance devices required is not necessarily the same. For example, 3 devices are required in environment A and 4 devices are required in environment B. The devices can be routers, switches, etc. When determining the devices required for each script execution environment, the total quantity of acceptance devices can be obtained according to the product of the number of devices required for each environment and the number of each script environment.
[0082] Step S202: Extract acceptance devices with a quantity equal to the total quantity from a preset device resource pool.
[0083] Step S203: In each of the script execution environments, based on the corresponding acceptance devices, perform a parallel test on the automated test script to obtain the configuration files before and after the execution of the automated test script.
[0084] It should be noted that devices with the total quantity can be extracted from the preset device resource pool. In each script execution environment, a parallel test is performed on the script, and the configuration files before and after the execution of the automated test script are obtained, reducing the time required for script acceptance and improving the script acceptance efficiency.
[0085] It should be noted that for each acceptance environment label, a corresponding set of automatic acceptance procedures is built. Each set of automatic acceptance procedures can correspond to one script execution environment, or can correspond to multiple script execution environments and a large actual device environment resource pool for script execution, supporting parallel acceptance of multiple scripts simultaneously.
[0086] Specifically, the schematic diagram of the application scenario involved in the present application is as Figure 4As shown in the figure, after determining the environment tags of the automated test script, the corresponding automated acceptance procedure is determined. Among them, the script execution environment is the test environment of the automated acceptance procedure for testing the script, and the device resource pool environments of Environment A / B / C represent the device environments required for executing the script. After testing the script in each script execution environment, the corresponding execution results and configuration residue results are obtained. Furthermore, based on the execution results and configuration residue results, it is determined whether the current script passes the acceptance test, and the scripts that pass the acceptance are stored in the library, and the user is notified of the acceptance results.
[0087] In this embodiment, the automated test script is deployed in multiple script execution environments, and multiple devices are extracted from the preset device resource pool, and parallel testing is performed on multiple script execution environments simultaneously to improve the acceptance efficiency.
[0088] Specifically, specific embodiments of the automated test script acceptance method of the present application are provided for detailed elaboration. The embodiments are as follows:
[0089] 1. Script static access control check
[0090] Suppose user userA writes script ScriptA, and the script is tagged with tagA, tagB, and tagC, corresponding to three different device environments respectively. The user submits ScriptA for review on gerrit, and the submitted commit-id is abcd44442233. Jenkins senses this submission and starts the script static check access control program with commit-id abcd44442233 and the submitter userA as input parameters. The static check access control program checks that the format of ScriptA script does not meet the requirements, notifies the user that the static check fails, and attaches detailed failure information. User userA modifies the script according to the prompt and submits the script again with commit-id abcd44442233. Jenkins triggers the static check to pass, generates an automated acceptance temporary table, and notifies the user that the static check passes at the same time.
[0091] Acceptance temporary table:
[0092] Submission ID Submitter Script Tag abcd44442233 userA ScrpitA tagA, tagB, tagC
[0093] 2. The acceptance scan distribution program generates multiple acceptance table records
[0094] The acceptance scan distribution program scans the new record in the acceptance temporary table and generates multiple acceptance table records according to the project label policy and tags as follows:
[0095] Acceptance table:
[0096]
[0097] 3. Deploy multiple sets of acceptance program acceptance scripts
[0098] Deploy three sets of automatic acceptance programs for environment tags Env-tagA, Env-tagB, and Env-tagC respectively. Each set of automatic acceptance programs corresponds to an environment tag, multiple sets of script execution environments, and a set of device execution environment pools.
[0099]
[0100] Acceptance program A uses the environment tag "Env-tagA" to periodically query the acceptance table to check if there are scripts to be accepted. After querying ScriptA, obtain a set of local script execution environments from the script execution environment ScriptExecEnvA, and obtain a certain number of devices from the device execution environment pool DutExecEnvA according to the script to start accepting the script.
[0101] 4. Download the script and accept it
[0102] Acceptance program A downloads the corresponding script using the submission id "abcd44442233" of the script, finds the ScriptA file of the script for modification, inserts the acceptance keyword "Get all device configurations" (i.e., the configuration extraction field) at the configuration and de-configuration positions of the script, and inserts the keyword "Interrupt running" (i.e., the forced interruption field) at a position after half of the script.
[0103] According to the ScriptA path, do not start options such as the "Interrupt running" keyword for the first run, assemble the script execution parameter "pathen-robootScriptA-interuput False", and start a thread to execute the script. Wait for the script to complete the first execution, obtain the device configuration file A obtained before the configuration on the script, and obtain the device configuration file B obtained after the de-configuration of the script.
[0104] If ScriptA fails to execute, or there are residual configurations when comparing the device configuration file A and the device configuration file B, notify the user that the acceptance is not passed and do not perform secondary interruption execution.
[0105] If ScriptA is executed successfully and there are no residual configurations when comparing Device Configuration File A and Device Configuration File B, prepare to start the secondary interruption and execute the script. According to the script path and the "interrupted run" keyword option, assemble the script execution parameter "pathen-roboot ScriptA-interuput True" and start a thread to execute the script. Wait for the script to finish execution, obtain Device Configuration File C obtained before configuring the script, and obtain Device Configuration File D obtained after deconfiguring the script. Configuration File C and Configuration File D are the configuration files generated before and after the interruption operation on the script respectively, and compare Configuration File C and Configuration File D. If there are residual configurations, notify the user that the acceptance is not passed. If there are no residual configurations, it is necessary to judge in combination with the acceptance results of all acceptance procedures corresponding to the environment tags such as "Acceptance Procedure B" and "Acceptance Procedure C" in the script.
[0106] ScriptA performs acceptance on Acceptance Procedure B and Acceptance Procedure C according to the same rules. When the acceptance procedures on all environments are completed, calculate the centralized acceptance results. If the acceptance results on all environments are passed and there are no residual configurations, the user script acceptance is passed and it is allowed to be stored in the library; as long as the acceptance result on one environment is not passed or there are residual configurations, the user script acceptance is not passed and it is not allowed to be stored in the library.
[0107] Refer to Figure 3 , Figure 3 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
[0108] As Figure 3 shown, the automated test script acceptance device may include: a processor 1001, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005.
[0109] Optionally, the automated test script acceptance device may further include a user interface, a network interface, a camera, an RF (Radio Frequency) circuit, sensors, a WiFi module, etc. The user interface may include a display screen (Display) and an input sub-module such as a keyboard (Keyboard). Optionally, the user interface may further include a standard wired interface and a wireless interface. The network interface may include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0110] Those skilled in the art can understand that Figure 3 the structure of the automated test script acceptance device shown in
[0111] As shown Figure 3 in FIG. 1, the memory 1005 as a storage medium may include an operating system, a network communication module, and an automated test script acceptance program. The operating system is a program that manages and controls the hardware and software resources of the automated test script acceptance device, and supports the operation of the automated test script acceptance program and other software and / or programs. The network communication module is used to implement communication between components inside the memory 1005, and communication between other hardware and software in the automated test script acceptance system.
[0112] In Figure 3 the automated test script acceptance device shown in FIG. 2, the processor 1001 is used to execute the automated test script acceptance program stored in the memory 1005, and implement the steps of the automated test script acceptance method described in any one of the above.
[0113] The specific implementation manners of the automated test script acceptance device of the present application are basically the same as those of the above-described embodiments of the automated test script acceptance method, and will not be described herein again.
[0114] The present application further provides an automated test script acceptance device. Referring to Figure 5 FIG. 3, the automated test script acceptance device includes:
[0115] An acquisition module, configured to acquire an automated test script to be accepted;
[0116] A test module, configured to deploy the automated test script to a plurality of script execution environments, and perform acceptance testing on the automated test script in each of the script execution environments to obtain configuration files before and after the execution of the automated test script;
[0117] A first determination module, configured to determine that the acceptance of the automated test script is passed when the execution of the automated test script passes and the configuration files before and after the execution of the automated test script are consistent.
[0118] In a possible implementation manner of the present application, the test module includes:
[0119] An initialization unit, configured to initialize and configure the script execution environment;
[0120] A modification unit, configured to modify the automated test script, where the modification is used to obtain configuration files before and after the execution of the automated test script;
[0121] A first execution unit, configured to execute the modified automated test script in each of the script execution environments to obtain a script execution result;
[0122] The first extraction unit is configured to extract the configuration files before and after the execution of the automated test script based on the script execution result.
[0123] In a possible implementation manner of the present application, the modification unit includes:
[0124] An insertion subunit, configured to insert configuration extraction fields at the configuration setting and de-configuration points of the automated test script to obtain the modified automated test script, where the extraction fields are used to obtain the first configuration file before the execution of the automated test script and the second configuration file after the execution of the automated test script.
[0125] In a possible implementation manner of the present application, the determination module further includes:
[0126] A second execution unit, configured to execute the automated test script again for each of the script execution environments;
[0127] An interruption operation unit, configured to perform an interruption operation during the execution of the automated test script and continue to execute the automated test script;
[0128] A first acquisition unit, configured to acquire the configuration files of the automated test script before and after the interruption operation after the execution of the automated test script is completed.
[0129] In a possible implementation manner of the present application, the determination module further includes:
[0130] An insertion unit, configured to insert a forced interruption field in the latter half of the fields of the automated test script, where the forced interruption field is used to interrupt the execution of the automated test script when the automated test script is executed again to the forced interruption field after the first successful execution of the automated test script, and the forced interruption field does not take effect during the first execution of the automated test script.
[0131] In a possible implementation manner of the present application, the determination module further includes:
[0132] A determination unit, configured to determine that the automated test script passes the acceptance when the configuration files before and after the interruption operation are consistent.
[0133] In a possible implementation manner of the present application, the device further includes:
[0134] A second determination module, configured to determine that the automated test script fails to pass the acceptance for any of the script execution environments when the execution of the automated test script fails or the configuration files before and after the interruption operation are inconsistent.
[0135] In a possible implementation manner of the present application, the test module further includes:
[0136] A second acquisition unit, configured to acquire the total amount of acceptance devices required for acceptance testing of the automated test script, where the total amount is the product of a first quantity and the number of script execution environments of the script execution environment, and the first quantity is the number of acceptance devices required to execute the automated test script in each script execution environment;
[0137] A second extraction unit, configured to extract acceptance devices with a quantity equal to the total amount from a preset device resource pool;
[0138] A parallel test unit, configured to, in each script execution environment, perform parallel testing on the automated test script based on the corresponding acceptance devices to obtain configuration files before and after execution of the automated test script.
[0139] In a possible implementation manner of the present application, the device further includes:
[0140] A second acquisition module, configured to acquire at least one environment tag corresponding to the automated test script;
[0141] A third determination module, configured to determine the script execution environment of the automated test script corresponding to each environment tag.
[0142] In a possible implementation manner of the present application, the device further includes:
[0143] A third acquisition module, configured to acquire at least one script tag of the automated test script;
[0144] An addition module, configured to add one or more environment tags to the automated test script based on one or more of the script tags.
[0145] In a possible implementation manner of the present application, the device further includes:
[0146] An inspection module, configured to, in response to submission of the automated test script, inspect the format of the automated test script;
[0147] An execution module, configured to, when the format meets the preset format requirements, execute the step of deploying the automated test script to multiple script execution environments.
[0148] It should be noted that in this text, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or system including that element.
[0149] The serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.
[0150] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to enable a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present application.
[0151] The above are only the preferred embodiments of the present application, and do not limit the patent scope of the present application accordingly. Any equivalent structure or equivalent process transformation made by using the description of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present application.
Claims
1. An automated test script acceptance method, comprising: obtaining an automated test script to be accepted; deploying the automated test script to multiple script execution environments, and performing acceptance tests on the automated test script in each of the script execution environments to obtain configuration files before and after the execution of the automated test script; determining that the automated test script passes the acceptance when the automated test script passes the execution and the configuration files before and after the execution of the automated test script are consistent.
2. The automated test script acceptance method according to claim 1, wherein, the performing acceptance tests on the automated test script in each of the script execution environments to obtain configuration files before and after the execution of the automated test script includes: initializing and configuring the script execution environment; modifying the automated test script, where the modification is used to obtain configuration files before and after the execution of the automated test script; executing the modified automated test script in each of the script execution environments to obtain a script execution result; extracting configuration files before and after the execution of the automated test script based on the script execution result.
3. The automated test script acceptance method according to claim 2, wherein, the modifying the automated test script includes: inserting configuration extraction fields at the configuration setting and de-configuration positions of the automated test script to obtain the modified automated test script, where the extraction fields are used to obtain a first configuration file before the execution of the automated test script and a second configuration file after the execution of the automated test script.
4. The automated test script acceptance method according to claim 1, wherein, after the automated test script passes the execution and the configuration files before and after the execution of the automated test script are consistent, the method further includes: re-executing the automated test script for each of the script execution environments; performing an interruption operation during the running of the automated test script and continuing to execute the automated test script; after the execution of the automated test script is completed, obtaining configuration files of the automated test script before and after the interruption operation.
5. The automated test script acceptance method according to claim 4, wherein, before re-executing the automated test script for each of the script execution environments, it further includes: inserting a forced interruption field into the latter half fields of the automated test script, where the forced interruption field is used to interrupt the running of the automated test script when the automated test script is re-run to the forced interruption field after the first successful execution, and the forced interruption field does not take effect during the first execution of the automated test script.
6. The automated test script acceptance method according to claim 4, wherein, the determining that the automated test script passes the acceptance further includes: determining that the automated test script passes the acceptance when the configuration files before and after the interruption operation are consistent.
7. The automated test script acceptance method according to claim 6, wherein, after obtaining the configuration files before and after the execution of the automated test script, it further includes: For any one of the script execution environments, when the automated test script execution fails or the configuration files before and after the interruption operation are inconsistent, it is determined that the acceptance of the automated test script fails.
8. The automated test script acceptance method according to claim 1, wherein, when performing acceptance testing on the automated test script in each of the script execution environments to obtain the configuration files before and after the execution of the automated test script, it further includes: Obtaining the total number of acceptance devices required for performing acceptance testing on the automated test script, where the total is the product of a first quantity and the number of script execution environments, and the first quantity is the number of acceptance devices required to execute the automated test script in each of the script execution environments; Extracting acceptance devices with a quantity equal to the total from a preset device resource pool; In each of the script execution environments, based on the corresponding acceptance devices, performing parallel testing on the automated test script to obtain the configuration files before and after the execution of the automated test script.
9. The automated test script acceptance method according to claim 1, wherein, before deploying the automated test script to multiple script execution environments, it includes: Obtaining at least one environment label corresponding to the automated test script; Determining the script execution environment of the automated test script corresponding to each of the environment labels.
10. The automated test script acceptance method according to claim 9, wherein, before obtaining at least one environment label corresponding to the automated test script, it includes: Obtaining at least one script label of the automated test script; Based on one or more of the script labels, adding one or more environment labels to the automated test script.
11. The automated test script acceptance method according to claim 1, wherein, before deploying the automated test script to multiple script execution environments, it further includes: In response to the submission of the automated test script, checking the format of the automated test script; When the format meets the preset format requirements, performing the step of deploying the automated test script to multiple script execution environments.
12. An electronic device, wherein, the electronic device includes: a memory, a processor, and an automated test script acceptance program stored on the memory and executable on the processor, and the automated test script acceptance program is configured to implement the steps of the automated test script acceptance method according to any one of claims 1 to 11.
13. A computer storage medium, wherein, an automated test script acceptance program is stored on the computer storage medium, and when the automated test script acceptance program is executed by a processor, it implements the steps of the automated test script acceptance method according to any one of claims 1 to 11.