Script calling methods, devices, electronic devices, and storage media
By acquiring business requirement information, matching and encapsulating target scripts, and combining this with execution rule configuration, the problem of low versatility of test scripts is solved, enabling the scripts to be widely used in different environments.
Patent Information
- Application Number
- CN202111163461.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2041-09-30
AI Technical Summary
The low versatility of existing test scripts means that scripts written by different testers cannot be widely used, and there is a lack of unified management methods.
By acquiring business function requirements information, matching target scripts in the database and encapsulating them, and configuring them in conjunction with script execution rules, scripts suitable for different environments can be generated for invocation.
It improves the versatility of test scripts, enabling their application in more software testing and solving the problem of scripts not being widely usable.
Smart Images

Figure CN113900937B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing, and in particular to script invocation methods, apparatus, electronic devices, and storage media. Background Technology
[0002] With the development of computer technology, the number of software programs on various platforms is gradually increasing. Regarding software development, after the relevant technical personnel have completed the software development, in order to verify the software's own functions and whether it can achieve the expected results, it is necessary to conduct a systematic test on the software's functions. In other words, it is necessary for technical personnel to conduct software testing on the completed software.
[0003] Software testing is a process of running or measuring software using manual or automated methods. Its purpose is to verify whether the current software meets the specified requirements or to obtain the difference between expected and actual results. During the software testing process, testers will output relevant test scripts. Because each tester has different skills and ideas, the technical content that their output scripts can achieve also varies. Furthermore, there is no unified management method, which makes the test scripts output by each tester difficult to use widely. Therefore, there is currently a problem of low versatility of test scripts.
[0004] There is currently no effective solution to the problem of low versatility of test scripts in related technologies. Summary of the Invention
[0005] This embodiment provides a script invocation method, apparatus, electronic device, and storage medium to address the problem of low versatility of test scripts in related technologies.
[0006] Firstly, this embodiment provides a script invocation method, including:
[0007] Obtain business function requirement information; based on the business function requirement information, match the target script and corresponding script execution rules in the database that meet the business function requirement information. The target script is obtained by encapsulating the initial script. The script execution rules include rules that enable the target script to execute normally in different environments; configure the target script based on the script execution rules to obtain the script to be called.
[0008] In one embodiment, before matching the target script in the database that meets the business function requirement information based on the business function requirement information, the method further includes: obtaining an initial script; obtaining the corresponding script business function based on the initial script; performing script encapsulation processing on the initial script to obtain a target script; and sending the correspondence between the target script and the script business function to the database.
[0009] In another embodiment, before performing script encapsulation processing on the initial script, the process includes: obtaining script information of the initial script and the target script in the database, the script information including script name, script business function, and script update time; verifying whether the script information of the initial script is duplicated with the script information of the target script in the database, and if duplicated, generating a script duplication report and / or alarm.
[0010] In one embodiment, the script encapsulation process for the initial script includes: performing script format verification on the initial script to obtain the script format of the initial script; matching the script encapsulation rules corresponding to the script format in the database, wherein the script encapsulation rules include processing rules that can perform compatibility processing or parameter replacement processing on the script parameters of the initial script; and encapsulating the initial script based on the script encapsulation rules to obtain the target script.
[0011] In another embodiment, before encapsulating the initial script, the method further includes: matching the script format with preset script parameter verification rules in the database that satisfy the script format, wherein the preset script parameter verification rules include rules that can verify whether the parameters in the initial script can be executed normally; performing script parameter verification on the initial script based on the preset script parameter verification rules, and verifying whether there are any empty or incorrect parameters, and if so, generating a parameter error report and / or alarm.
[0012] In one embodiment, the step of encapsulating the initial script based on the script encapsulation rules to obtain the target script includes: matching script parameters in the initial script that satisfy the script encapsulation rules based on the script encapsulation rules, and performing parameter compatibility processing on the script parameters to obtain the target script.
[0013] In another embodiment, after configuring the target script based on the script execution rules to obtain the script to be called, the method further includes: performing script execution verification on the script to be called based on the script execution rules, verifying whether the relevant parameters of the script to be called after running are within a preset threshold range, and if the verification fails, generating a script configuration error report and / or alarm.
[0014] Secondly, this embodiment provides a script invocation device, including: a business requirement information acquisition module for acquiring business function requirement information; a target script acquisition module for matching target scripts that satisfy the business function requirement information and corresponding script execution rules in a database based on the business function requirement information, wherein the target script is obtained by encapsulating an initial script, and the script execution rules include rules that enable the target script to execute normally under different environments; and a script to be invoked acquisition module for configuring the target script based on the script execution rules to obtain the script to be invoked.
[0015] Thirdly, this embodiment provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the script invocation method described in the first aspect above.
[0016] Fourthly, this embodiment provides a storage medium on which a computer program is stored, which, when executed by a processor, implements the script invocation method described in the first aspect above.
[0017] Compared with related technologies, the script invocation method provided in this embodiment obtains business function requirement information; based on the business function requirement information, it matches target scripts that meet the business function requirement information and corresponding script execution rules in the database. The target script is obtained by encapsulating an initial script, and the script execution rules include rules that enable the target script to execute normally in different environments; based on the script execution rules, the target script is configured to obtain the script to be invoked. This solves the problem of low versatility of test scripts in related technologies, improves the versatility of test scripts, and can be used for testing more software.
[0018] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0020] Figure 1 This is a hardware structure block diagram of the terminal for the script calling method in this embodiment;
[0021] Figure 2 This is a flowchart of the script invocation method in this embodiment;
[0022] Figure 3This is a structural block diagram of the script calling device in this embodiment. Detailed Implementation
[0023] To better understand the purpose, technical solution, and advantages of this application, the application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0024] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning as understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these,” used in this application, do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to such processes, methods, products, or devices. The terms “connected,” “linked,” and “coupled,” used in this application, are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. The term “multiple” used in this application refers to two or more. The "and / or" operator describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: A alone, A and B simultaneously, and B alone. Typically, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," and "third," etc., used in this application are merely for distinguishing similar objects and do not represent a specific ordering of the objects.
[0025] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of the terminal for the script invocation method in this embodiment. For example... Figure 1 As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1The different configurations shown are illustrated.
[0026] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the script invocation method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0027] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0028] This embodiment provides a script invocation method. Figure 2 This is a flowchart of the script calling method in this embodiment, such as... Figure 2 As shown, the process includes the following steps:
[0029] Step S201: Obtain business function requirement information.
[0030] This application describes a method for calling a script, which involves obtaining an existing script based on current business requirements and then calling it. Based on this, before calling the script, it is necessary to first obtain business function requirement information. This information includes the current requirements for the business function. Furthermore, the business function requirement information can be used to select the business function based on preset business function requirement rules, or it can be based on the input of specific keywords related to the current business function requirement. In this embodiment, no specific special requirements are made; it is only necessary to ensure that the obtained business function requirements clearly express the needs for the business function.
[0031] Step S202: Based on the business function requirement information, match the target script and corresponding script execution rules in the database that meet the business function requirement information. The target script is obtained by encapsulating the initial script. The script execution rules include rules that enable the target script to execute normally in different environments.
[0032] In the previous step, we have obtained the business function requirements information. Next, based on the obtained business function requirements information, we can match the target scripts that can meet the business function requirements information in the database of several existing target scripts. Understandably, in this embodiment, the target script is stored in the database based on its own business functions. The target script is obtained by encapsulating the initial script. It's easy to understand that the unprocessed initial script is a script directly output by technicians based on other business needs, suitable for the current requirements. It lacks compatibility and versatility and cannot be directly applied to other business functions. However, by encapsulating the initial script, a target script applicable to the same business function requirements in different environments can be obtained. In different embodiments, the encapsulation process for the initial script differs. It could involve parameter compatibility, script splitting based on the function of each field to create multiple target scripts, or other methods, as long as a target script that meets the business function requirements can be obtained through encapsulation of the initial script. Furthermore, simply obtaining the target script is not enough to directly call it to meet business function requirements; script execution rules are also needed. Script execution rules can be script execution carriers that help the script run, parameter range limits for the specific implementation of the target script, or other script execution methods that help the target script run normally to achieve business functions. In this embodiment, it is only necessary to ensure that the target script can run normally and complete business function requirements in different environments through the script execution rules. Additionally, as is easily understood, if the obtained business function requirement information cannot be satisfied by existing scripts in the database, or if the business function requirement information is not in a standardized format, an error report will be generated.
[0033] Step S203: Configure the target script based on the script execution rules to obtain the script to be called.
[0034] In this embodiment, the target script that meets the business function requirements and the corresponding script execution rules have already been obtained from the database. Based on this, it is necessary to further configure the target script based on the business function requirements information to make the script parameters in the target script suitable for the business function requirements and the script execution environment with those requirements. Therefore, the target script is configured based on the business function requirements information using the script execution rules. Script configuration can involve configuring some parameters of the target script based on the business function requirements environment, adapting the target script to the business function requirements, or installing a script carrier. The goal is simply to configure the target script based on the script execution rules to obtain a script that meets the business function requirements and can be executed normally. Through the above steps, firstly, the business function requirements information is obtained; then, a target script that meets the business function requirements information is matched based on this information. This target script is obtained by encapsulating the initial script, possessing compatibility and versatility. Next, the script execution rules applicable to this target script are obtained; then, the target script is configured based on the script execution rules and the business function requirements information to obtain the script to be called. Compared with related technologies, this method obtains a packaged target script that meets business function requirements, and then configures the target script to obtain the script to be called. This ensures that the script can be used normally in other environments with the same business function requirements, thus solving the problem of low versatility of test scripts in related technologies. This method improves the versatility of test scripts and enables them to be used for testing more software.
[0035] In one embodiment, before matching the target script in the database that meets the business function requirement information based on the business function requirement information, the method further includes: obtaining an initial script, obtaining the corresponding script business function based on the initial script; performing script encapsulation processing on the initial script to obtain the target script; and sending the correspondence between the target script and the script business function to the database.
[0036] Understandably, before obtaining the target script that meets the business function requirements from the database, the initial script needs to be encapsulated into the target script. Therefore, the initial script is first obtained, and, as is easily understood, the corresponding script business function is also obtained simultaneously. Based on this, a correspondence is established between the initial script and the script business function. Then, the initial script undergoes script encapsulation. In this embodiment, the script encapsulation is performed on the script itself. Through the script's own parameters and business functions, parameters in the script that do not affect its own business functions are made compatible, or parameter values that can replace the original parameters are found in the database and used to replace the corresponding parameters in the target script. The correspondence between the target script and the script business function is then sent to the database to facilitate finding the target script through business function matching. This improves the efficiency of finding the target script based on business function requirements.
[0037] In another embodiment, before performing script encapsulation processing on the initial script, the process includes: obtaining script information of the initial script and the target script in the database, the script information including script name, script business function and script update time; checking whether the script information of the initial script is duplicated with the script information of the target script in the database, and if duplicated, generating a script duplication report and / or alarm.
[0038] In this embodiment, before encapsulating the initial script, it is necessary to obtain script information for both the initial script and the target script in the database. This script information includes the script name, script business function, and script update time. Based on the script information in the target script, a duplicate check is performed on the initial script. This check verifies whether the script information of the initial script is identical to that of the target script, or whether there is any content that is identical to the script information in the target script. The result of the duplicate check is then obtained. If a duplicate is found, it can be determined that a target script corresponding to the initial script exists in the database, and a script duplicate report and / or alarm is generated, terminating the encapsulation process for the initial script. If no duplicate is found, the encapsulation process for the initial script continues. This duplicate check before encapsulating the initial script avoids repeatedly encapsulating the same initial script, improving script generation efficiency and avoiding unnecessary script encapsulation.
[0039] In one embodiment, the script encapsulation process for the initial script includes: performing script format verification on the initial script to obtain the script format of the initial script; matching the script encapsulation rules corresponding to the script format in the database, the script encapsulation rules including processing rules that can perform compatibility processing or parameter replacement processing on the script parameters of the initial script; and encapsulating the initial script based on the script encapsulation rules to obtain the target script.
[0040] Understandably, since technical personnel may use different scripting languages, the initial script format and the language environment in which the script runs will vary. Therefore, it is necessary to apply script encapsulation rules corresponding to different script formats to the initial script. Based on this, the initial script is first validated to determine its format. Then, based on this format, script encapsulation rules in the database that match the format are matched. Finally, the initial script is encapsulated according to these rules. In this embodiment, script encapsulation involves compatibility processing or parameter replacement of script parameters. Compatibility processing sets initial values for script parameters that do not affect the business functionality. Parameter replacement involves searching the database for replaceable parameter data, matching the corresponding parameters in the initial script, and then replacing the data. This results in a highly compatible script that meets the business functionality requirements, improving the script compatibility and versatility of the initial script. By applying different script encapsulation rules to different script formats, the accuracy of script encapsulation is improved, and the error rate during encapsulation is reduced.
[0041] In another embodiment, before encapsulating the initial script, the method further includes: matching the script format with preset script parameter verification rules in the database that meet the script format, the preset script parameter verification rules including rules that can verify whether the parameters in the initial script can be executed normally; performing script parameter verification on the initial script based on the preset script parameter verification rules, and verifying whether there are any empty or incorrect parameters, and if so, generating a parameter error report and / or alarm.
[0042] In this embodiment, before encapsulating the initial script, it is necessary to validate the script parameters. This involves matching the script format against preset script parameter validation rules in the database to determine if the script parameters in the initial script can function correctly to fulfill its business functions, and to verify whether there are any empty or incorrect parameters in the initial script. It is understandable that if the initial script contains script parameters that cannot function correctly and thus fail to meet business function requirements, then even if it is encapsulated, the resulting target script will also fail to meet business function requirements. Therefore, if the validation result indicates the presence of empty or incorrect parameters, a parameter error report and / or alarm should be generated. The method in this embodiment can reduce the error rate during the encapsulation of the initial script.
[0043] In one embodiment, encapsulating the initial script based on script encapsulation rules to obtain the target script includes: matching script parameters in the initial script that satisfy the script encapsulation rules based on the script encapsulation rules, and performing parameter compatibility processing on the script parameters to obtain the target script.
[0044] In this embodiment, script encapsulation involves matching script parameters in the initial script that satisfy the encapsulation rules, and then performing script compatibility processing on these parameters to obtain the target script. It is understood that the script encapsulation rules include parameter compatibility rules that satisfy the script format. Through these rules, existing script parameters in the initial script can be replaced with parameters compatible with other business rules, or the parameters can be modified to their default values. The encapsulated script does not affect the business functionality of the initial script and can meet the needs of the same business functions in different application environments. By matching script parameters that satisfy the encapsulation rules, targeted script parameter compatibility processing is achieved, improving the efficiency and accuracy of script encapsulation.
[0045] In another embodiment, after configuring the target script based on the script execution rules to obtain the script to be called, the method further includes: performing script execution verification on the script to be called based on the script execution rules, verifying whether the relevant parameters of the script to be called after running are within a preset threshold range, and generating a script configuration error report and / or alarm if the verification fails.
[0046] In this embodiment, after obtaining the script to be called, and before outputting the script to the requesting end, it is necessary to perform script execution verification on the script to be called. Script execution verification means verifying whether the relevant parameters obtained after running the script are within a preset threshold range. In addition, the running parameters of the target script can be verified based on the script format, and whether it can meet the business function, or whether the entire script is complete. Other verification processes and rules can also be used, as long as it can be ensured that the script to be called is correct and can meet the business function requirements. If the verification passes, the script to be called can be output normally. If the verification fails, it means that there is a parameter setting error in the script after parameter setting, and a parameter setting error report and / or alarm is generated to enable relevant technical personnel to perform error correction and improve the fault tolerance rate when calling the script.
[0047] In other embodiments, an initial script verification method based on a script call method is also provided. First, the script format of the initial script is verified. When uploading the script, the file extension of the initial script file is obtained, and it is determined whether the file extension is within a preset set. In this embodiment, the supported file extensions are jmx, java, py, txt, and some compressed file formats. Then, the uniqueness of the script name is verified, that is, whether the script name is duplicated with the existing script name in the database. If a script with the same name already exists, the upload fails.
[0048] In another embodiment, the method of encapsulating script data further includes: obtaining customized parameters corresponding to the initial script, and directly encapsulating the script based on the customized parameters when the initial script is obtained; or matching the script parameters corresponding to the initial script through an SQL script, and then encapsulating the initial script. In addition, after encapsulating the script, it is also necessary to receive or generate a report related to the script parameters and generate the corresponding script execution file. Alternatively, the initial script can be manually encapsulated by technicians, as long as the corresponding target script can be obtained.
[0049] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0050] This embodiment also provides a script invocation device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. The terms "module," "unit," "subunit," etc., used below refer to combinations of software and / or hardware that implement a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0051] Figure 3 This is a structural block diagram of the script calling device in this embodiment, as shown below. Figure 3 As shown, the device includes: a business requirement information acquisition module 10, a target script acquisition module 20, a script to be called acquisition module 30, a script encapsulation module, a script duplication check module, and a script verification module.
[0052] Business Requirement Information Acquisition Module 10: Used to acquire business function requirement information.
[0053] Target script acquisition module 20: It is used to match target scripts in the database that meet the business function requirements based on the business function requirements information. The target scripts are obtained by encapsulating the initial scripts.
[0054] The script acquisition module 30: Based on business function requirement information, it matches the target script and corresponding script execution rules in the database that meet the business function requirement information. The target script is obtained by encapsulating the initial script. The script execution rules include rules that enable the target script to execute normally in different environments.
[0055] Script encapsulation module: Used to obtain the initial script, obtain the corresponding script business functions based on the initial script; encapsulate the initial script to obtain the target script; and send the correspondence between the target script and the script business functions to the database.
[0056] The script encapsulation module is also used to perform script format verification on the initial script to obtain the script format of the initial script; match the script encapsulation rules corresponding to the script format in the database, the script encapsulation rules include processing rules that can perform compatibility processing or parameter replacement processing on the script parameters of the initial script; and encapsulate the initial script based on the script encapsulation rules to obtain the target script.
[0057] The script encapsulation module is also used to match script parameters in the initial script that meet the script encapsulation rules based on the script encapsulation rules, and to make the script parameters compatible to obtain the target script.
[0058] Script duplication check module: Used to obtain script information of the initial script and the target script in the database. The script information includes script name, script business function and script update time; check whether the script information of the initial script is duplicated with the script information of the target script in the database. If duplicated, a script duplication report and / or alarm will be generated.
[0059] Script validation module: Used to match the script format with preset script parameter validation rules in the database that meet the script format. The preset script parameter validation rules include rules that can verify whether the parameters in the initial script can be executed normally. Based on the preset script parameter validation rules, the module performs script parameter validation on the initial script to check whether there are any empty or incorrect parameters. If so, it generates a parameter error report and / or alarm.
[0060] The script verification module is also used to verify the execution of the script to be called based on the script execution rules. It verifies whether the relevant parameters of the script to be called are within the preset threshold range after execution. If the verification fails, a script configuration error report and / or alarm will be generated.
[0061] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.
[0062] This embodiment also provides an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0063] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0064] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0065] S1, Obtain business function requirements information.
[0066] S2, based on business function requirement information, matches the target script and corresponding script execution rules in the database that meet the business function requirement information. The target script is obtained by encapsulating the initial script, and the script execution rules include rules that enable the target script to execute normally in different environments.
[0067] S3 configures the target script based on the script execution rules to obtain the script to be called.
[0068] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated in this embodiment.
[0069] Furthermore, in conjunction with the script invocation methods provided in the above embodiments, this embodiment can also provide a storage medium for implementation. This storage medium stores a computer program; when executed by a processor, the computer program implements any of the script invocation methods described in the above embodiments.
[0070] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0071] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.
[0072] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or independent of other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0073] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims
1. A script invocation method, characterized in that, include: Obtain the initial script, and obtain the corresponding script business function based on the initial script; the initial script is a script that is directly output from other business functions and is suitable for the current requirements, and is not directly applied to other business functions; The initial script is checked for script format to obtain the script format of the initial script; Match the script encapsulation rules corresponding to the script format in the database. The script encapsulation rules include compatibility processing and parameter replacement processing of the script parameters of the initial script, or script splitting based on the function of each field in the initial script to split into multiple target scripts. The compatibility processing involves setting the script parameters in the initial script that do not affect the business functions themselves to their initial values; The initial script is encapsulated based on the script encapsulation rules to obtain the target script; The target script is applicable to the same business function requirements in different environments; Send the correspondence between the target script and the script's business function to the database; Obtain business function requirements information; Based on the business function requirement information, target scripts that meet the business function requirement information and corresponding script execution rules are matched in the database. The target script is obtained by encapsulating the initial script. The script execution rules include rules that enable the target script to execute normally under different environments. Based on the script execution rules, the target script is configured to obtain the script to be called. Based on the script execution rules, the script to be called is validated to check whether the relevant parameters of the script after it is run are within a preset threshold range. If the validation fails, a script configuration error report and / or alarm is generated.
2. The script invocation method according to claim 1, characterized in that, Before performing script encapsulation processing on the initial script, the following is included: Obtain script information of the initial script and the target script in the database, the script information including script name, script business function and script update time; Check whether the script information of the initial script is the same as the script information of the target script in the database. If they are the same, generate a script duplication report and / or alarm.
3. The script invocation method according to claim 1, characterized in that, The process of encapsulating the initial script includes the following: Based on the script format, the database is matched with preset script parameter verification rules that satisfy the script format. The preset script parameter verification rules include rules that can verify whether the parameters in the initial script can be executed normally. The initial script is validated based on the preset script parameter validation rules. If any parameters are empty or incorrect, a parameter error report and / or alarm are generated.
4. The script invocation method according to claim 1, characterized in that, The process of encapsulating the initial script based on the script encapsulation rules to obtain the target script includes: Based on the script encapsulation rules, the script parameters in the initial script that satisfy the script encapsulation rules are matched, and the script parameters are made compatible to obtain the target script.
5. A script invocation device, characterized in that, include: The script encapsulation module is used to obtain an initial script and obtain the corresponding script business function based on the initial script; the initial script is a script that is directly output from other business functions and is suitable for the current requirements, but is not directly applied to other business functions; The initial script is checked for script format to obtain the script format of the initial script; Match the script encapsulation rules corresponding to the script format in the database. The script encapsulation rules include compatibility processing and parameter replacement processing of the script parameters of the initial script, or script splitting based on the function of each field in the initial script to split into multiple target scripts. The compatibility processing involves setting the script parameters in the initial script that do not affect the business functions themselves to their initial values; The initial script is encapsulated based on the script encapsulation rules to obtain the target script; The target script is applicable to the same business function requirements in different environments; Send the correspondence between the target script and the script's business function to the database; Business Requirement Information Acquisition Module: Used to acquire business function requirement information; Target script acquisition module: Based on the business function requirement information, it matches the target scripts in the database that meet the business function requirement information and the corresponding script execution rules. The target scripts are obtained by encapsulating the initial scripts. The script execution rules include rules that enable the target scripts to execute normally under different environments. The script to be invoked acquisition module: configures the target script based on the script execution rules to obtain the script to be invoked; The script verification module is used to verify the script to be called based on the script execution rules, and to verify whether the relevant parameters of the script to be called after execution are within the preset threshold range. If the verification fails, a script configuration error report and / or alarm is generated.
6. The apparatus according to claim 5, characterized in that, The device further includes: The script duplication check module is used to obtain script information of the initial script and the target script in the database. The script information includes the script name, script business function, and script update time. Check whether the script information of the initial script is the same as the script information of the target script in the database. If they are the same, generate a script duplication report and / or alarm.
7. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the script invocation method according to any one of claims 1 to 4.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the script invocation method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Dubbo interface test method and device, electronic device and storage medium
CN112363907A