A parameter acquisition method, a computer device and a storage medium

By adding index information to the target static data, the problem of requiring additional code to obtain dynamic data is solved, the separation of data and code is achieved, the parameter acquisition process is simplified, and the efficiency of automated testing is improved.

CN111694736BActive Publication Date: 2025-10-21NEW H3C BIG DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010475150.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-29
Publication Date
2025-10-21
Estimated Expiration
2040-05-29

AI Technical Summary

Technical Problem

In automated testing, the acquisition of dynamic data requires additional code writing, which makes the parameter acquisition process cumbersome and makes it impossible to effectively separate data and code.

Method used

By determining the target dynamic data attributes, generating the first index information, and loading it into the target static data to form the first target static data, dynamic data can be obtained by reading static data, avoiding the need for additional code input.

Benefits of technology

It enables automated acquisition of dynamic data, simplifies the parameter acquisition process, avoids the separation of scripts and code, and improves testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111694736B_ABST
    Figure CN111694736B_ABST
Patent Text Reader

Abstract

The present specification provides a parameter acquisition method, a computer device and a storage medium, the method comprising: determining a target dynamic data attribute, the target dynamic data attribute being an attribute of dynamic data to be obtained when the parameter is acquired; acquiring first index information according to the target dynamic data attribute, wherein the first index information is index information for acquiring the target dynamic data; loading the first index information into target static data to form first target static data, wherein the target static data is static data to be obtained when the parameter is acquired; and acquiring the parameter according to the first target static data. Through the method, the technical problem that data and code are not separated when the parameter is acquired can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communication technology, and in particular to a parameter acquisition method, a computer device, and a storage medium. Background Art

[0002] Traditional automated testing involves a large amount of data when obtaining parameters (such as positional parameters). This typically requires separating data from code to prepare the positional parameters required for interface testing in advance. While static data can generally be prepared in advance, dynamic data (such as IDs and tickets) often cannot and must be obtained during actual code execution.

[0003] Moreover, in systems with more complex functions, dynamic data is often used more frequently. For example, when obtaining the parameters of "Interface A" through a test script, a certain parameter to be obtained needs to rely on "Interface B" to query and obtain. However, the parameter queried by "Interface B" is dynamic data, and dynamic data cannot be entered in the test script. If you want to obtain the dynamic data, you need to manually write code to obtain the dynamic data through "Interface B" and pass the obtained dynamic data to "Interface A" for testing.

[0004] From this, we can see that currently, when obtaining parameters, data and code are not separated. In the process of obtaining parameters, additional code needs to be written. How to separate data and code when obtaining parameters and obtain dynamic data without additional input code has become an important part of automated testing work. Summary of the Invention

[0005] In order to overcome the current technical problem of not being able to separate data and code when acquiring parameters, the present disclosure provides a parameter acquisition method, a computer device, and a storage medium.

[0006] The present disclosure provides a method for obtaining parameters, the method comprising:

[0007] Determining a target dynamic data attribute, where the target dynamic data attribute is an attribute of the dynamic data to be obtained when acquiring the parameter;

[0008] Acquire first index information according to the target dynamic data attribute, wherein the first index information is index information for acquiring the target dynamic data;

[0009] Loading the first index information into target static data to form first target static data, wherein the target static data is static data required to obtain the parameters;

[0010] The parameters are acquired according to the first target static data.

[0011] It can be seen from the above embodiments that the first target static data is formed by adding the first index information to the target static data, so that when obtaining parameters, the target dynamic data is obtained by reading the first index information in the first target static data, thereby avoiding the need to obtain the target dynamic data by additional input code when obtaining parameters, making it impossible to separate the script and the code in the process of obtaining parameters, resulting in the process of obtaining parameters being too cumbersome.

[0012] In this embodiment, the target dynamic data attributes include: location parameters and data parameters for obtaining the target dynamic data;

[0013] The acquiring first index information according to the target dynamic data attribute specifically includes:

[0014] First index information is generated according to the position parameter and the data parameter.

[0015] In this embodiment, the target dynamic data attribute further includes: a dynamic identifier and an end identifier;

[0016] When the device reads the dynamic identifier, the device is informed that the target dynamic data needs to be called;

[0017] When the device reads the end identifier, the device is informed that the target dynamic data has been acquired.

[0018] In this embodiment, loading the first index information into the target static data specifically includes:

[0019] Adding parameter items of target dynamic data to the target static data;

[0020] The first index information is loaded into the parameter item, thereby forming first target static data.

[0021] The embodiment of the present disclosure further provides a computer device, the computer device comprising: a processor and a machine-readable storage medium;

[0022] The machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of the above embodiment.

[0023] The embodiments of the present disclosure further provide a machine-readable storage medium storing machine-executable instructions. When called and executed by a processor, the machine-executable instructions prompt the processor to implement the method steps of the above embodiments.

[0024] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and, together with the description, serve to explain the principles of the specification.

[0026] Figure 1 A flow chart of a parameter acquisition method provided in an embodiment of the present disclosure;

[0027] Figure 2 A schematic diagram of the architecture of a parameter acquisition method provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with this specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of this specification, as detailed in the appended claims.

[0029] The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. As used in this specification and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0030] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information without departing from the scope of this specification. Depending on the context, the term "if" as used herein may be interpreted as "when," "when," or "in response to determining."

[0031] like Figure 1 As shown, an embodiment of the present disclosure provides a method for obtaining parameters, the method comprising:

[0032] S1 determines the target dynamic data attributes, the target dynamic data attributes are the attributes of the dynamic data to be obtained when obtaining the parameters;

[0033] S2. According to the target dynamic data attributes, obtain the first index information, wherein the first index information is the index information for obtaining the target dynamic data;

[0034] S3. The first index information is loaded into the target static data to form a first target static data, wherein the target static data is the static data required to obtain the parameters;

[0035] S4. Acquire the parameters according to the first target static data.

[0036] In step S1 , the target dynamic data attributes may include location parameters and data parameters for acquiring the target dynamic data.

[0037] The data parameter may be a query parameter for obtaining target dynamic data, and the location parameter may be a parameter for establishing an association relationship, as shown in Table 1, for example:

[0038] Positional parameters Data parameters Data parameters ID name type apm_1 windows os

[0039] Table 1

[0040] ID is the address parameter in the position parameter. When retrieving the target dynamic data from the first target static data using the first index information, the associated Table 1 is retrieved using apm_1 in ID. Name and type are the name query parameter and type query parameter, respectively. Table 1 as a whole can be used to indicate that the target dynamic data to be retrieved is an address parameter. By using name as "windows" and type as "OS," the address parameter corresponding to name and type is retrieved and used as the target dynamic data.

[0041] It should be noted that the above embodiment only uses ID as a position parameter and name and type as query parameters. In other embodiments, other target dynamic data attributes may be generated for other dynamic data.

[0042] The above embodiment shows the content of a target dynamic data attribute. In actual application, it is necessary to generate first index information based on the target dynamic data attribute and load the first index information into the target static data. The first index information can be generated based on the target dynamic data attribute. For example, the index information can include a location parameter for associating with the query target dynamic data and a query parameter for querying the target dynamic data, as shown in Table 2:

[0043] Positional parameters Query parameters ID url_id apm_1 get / apm / applicationlist

[0044] Table 2

[0045] As shown in Table 2, the ID "apm_1" is linked to Table 1. The query parameter url_id is used to obtain the ID address. The specific execution command for this query parameter is "get / apm / applicationlist", which retrieves all the address parameters queried in Table 1 and uses them as the target dynamic data. It should be noted that Table 2 only lists one example of querying a dynamic address. In other embodiments, other target dynamic data can be obtained through corresponding indexes.

[0046] It should be noted that, in another embodiment, the first index information may also be in the following format, specifically: get / apm / applicationlist-table B-apm_1, where "get / apm / applicationlist-table B" is the execution command, and apm_1 is used to associate with table 1.

[0047] It should be noted that, in practical applications, Table 2 can be used as a static data item. Generally, when obtaining parameters, multiple static data items need to be read, and the first index information in Table 2 can be used as one of the multiple static data items.

[0048] Based on the above embodiment, the target dynamic data attribute further includes: a dynamic identifier and an end identifier. When the dynamic identifier is read, the step of retrieving the target dynamic data is executed. When the end identifier is read, it is determined that the target dynamic data has been obtained and the retrieving step is terminated. The dynamic identifier and the end identifier may be as shown in Table 3:

[0049] Positional parameters Query parameters ID url_id apm_1 |var| / get / apm / applicationlist|var|

[0050] Table 3

[0051] As shown in Table 3, in this embodiment, "var" is a dynamic identifier and an end identifier. When "var" is read for the first time, it is considered to be a dynamic identifier, and when "var" is read again, it is considered to be an end identifier. In other embodiments, other characters can also be used as dynamic identifiers and / or end identifiers.

[0052] In an embodiment of actual application, the execution subject for obtaining parameters may be a network device, such as a switch, a router, a gateway device or a server. Specifically, the specific action of obtaining parameters may be executed through an APP in the network device.

[0053] For example, in a system, a network device needs to delete a first resource through interface A, but the parameters of the deletion interface need to provide the ID (address information) of the first resource in the system, and the operator often only knows the name and type of this resource (that is, the ID can be considered as the target dynamic data). At this time, the above method can be used to obtain the ID through a script.

[0054] First, Table 1 and Table 3 are introduced, where Table 1 represents the target dynamic data attributes used in interface B; Table 3 represents the first index information used to obtain the ID in interface A (the specific acquisition process is the same as the above embodiment and will not be repeated here).

[0055] When deleting the first resource through interface A, in addition to the ID, other static data also needs to be retrieved, such as Figure 2 As shown, when deleting the first resource, it is necessary to obtain multiple interface A parameters, which can be obtained through corresponding static data, and the ID is the target dynamic data. In combination with the above embodiment, in order to avoid the problem of additional code input when obtaining dynamic data through scripts, the first index information can be loaded into data index 1, and the dynamic data can be obtained by calling static data.

[0056] When the network device reads the first index information, it can obtain all IDs having the name and type of the first resource through interface B (query interface) according to the first index information.

[0057] After the network device obtains all the parameters, it executes an action of deleting the first resource.

[0058] It can be seen from the above embodiments that the first target static data is formed by adding the first index information to the target static data, so that when obtaining parameters, the target dynamic data is obtained by reading the first index information in the first target static data, thereby avoiding the need to obtain the target dynamic data by additional input code when obtaining parameters, making it impossible to separate the script and the code in the process of obtaining parameters, resulting in the process of obtaining parameters being too cumbersome.

[0059] Based on the same concept as the above method embodiment, an embodiment of the present disclosure further provides a computer device, the computer device comprising: a processor and a machine-readable storage medium;

[0060] The machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps of the above embodiment.

[0061] Based on the same concept as the above method embodiment, the embodiment of the present disclosure also provides a machine-readable storage medium storing machine-executable instructions. When called and executed by a processor, the machine-executable instructions prompt the processor to implement the method steps of the above embodiment.

[0062] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0063] Other embodiments of the present invention will readily occur to those skilled in the art upon consideration of the present invention and practice of the invention claimed herein. This specification is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of this specification and include common knowledge or customary techniques in the art not claimed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present invention being indicated by the following claims.

[0064] It should be understood that the present description is not limited to the exact structure that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.

[0065] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.

Claims

1. A method for obtaining parameters, characterized in that: The method comprises: Determining a target dynamic data attribute, where the target dynamic data attribute is an attribute of the dynamic data to be obtained when acquiring the parameter; Acquire first index information according to the target dynamic data attribute, wherein the first index information is index information for acquiring the target dynamic data; Loading the first index information into target static data to form first target static data, wherein the target static data is static data required to obtain the parameters; Acquiring the parameter according to the first target static data; The target dynamic data attributes include: a location parameter and a data parameter for obtaining the target dynamic data, the data parameter is a query parameter for obtaining the target dynamic data, and the location parameter is a parameter for establishing an association relationship.

2. The method according to claim 1, characterized in that The acquiring first index information according to the target dynamic data attribute specifically includes: First index information is generated according to the position parameter and the data parameter.

3. The method according to claim 2, characterized in that The target dynamic data attributes also include: a dynamic identifier and an end identifier; When the device reads the dynamic identifier, the device is informed that the target dynamic data needs to be called; When the device reads the end identifier, the device is informed that the target dynamic data has been acquired.

4. The method according to claim 1, wherein The step of loading the first index information into the target static data specifically includes: Adding parameter items of target dynamic data to the target static data; The first index information is loaded into the parameter item, thereby forming first target static data.

5. A computer device, characterized in that: The computer device includes: a processor and a machine-readable storage medium; The machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to implement the method steps described in any one of claims 1 to 4.

6. A machine-readable storage medium, characterized in that The method stores machine executable instructions, which, when called and executed by a processor, prompt the processor to implement the method steps described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Interface testing method and device

    CN110096434A