CN113760759A - Debugging method, debugging device, electronic device, and storage medium - Google Patents
Debugging method, debugging device, electronic device, and storage medium Download PDFInfo
- Publication number
- CN113760759A CN113760759A CN202111026473.5A CN202111026473A CN113760759A CN 113760759 A CN113760759 A CN 113760759A CN 202111026473 A CN202111026473 A CN 202111026473A CN 113760759 A CN113760759 A CN 113760759A
- Authority
- CN
- China
- Prior art keywords
- variable
- script
- data interface
- preset
- newly added
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000013515 script Methods 0.000 claims abstract description 235
- 238000012360 testing method Methods 0.000 claims abstract description 181
- 230000008676 import Effects 0.000 claims abstract description 37
- 230000015654 memory Effects 0.000 claims description 13
- 238000004590 computer program Methods 0.000 claims description 10
- 230000008569 process Effects 0.000 description 6
- 239000000463 material Substances 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011056 performance test Methods 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Abstract
The application discloses a debugging method, a debugging device, an electronic device and a storage medium. The debugging method of the embodiment of the application comprises the following steps: storing name information of a preset variable into a lead-out script; after all the test scripts are executed, calling the export script to obtain a preset variable; and under the condition that the newly added test script is added and the data interface tested by the newly added test script is not associated with a new variable, calling the import script to import the preset variable, so that the data interface can directly call the preset variable when the newly added test script is executed. According to the debugging method, all the test scripts are executed, the export script is called to obtain the preset variable, when the newly added test scripts are required to be debugged, when the data interface tested by the newly added test scripts is not associated with the new variable, the preset variable is imported to be directly called by the data interface, and therefore the relevant test scripts do not need to be repeatedly executed to obtain the preset variable.
Description
Technical Field
The present application relates to the field of interface automation testing technologies, and in particular, to a debugging method, a debugging apparatus, an electronic apparatus, and a storage medium.
Background
At present, when an application program interface is subjected to correctness testing and performance testing, a written test script is generally executed in an interface test tool, so that a request is initiated to a tested interface to check whether data returned by the interface is correct or not, and whether an exception occurs or not is determined under the condition of multiple returns. However, when there are multiple test scripts, because there are many variables related to the interface to be tested, when a test script is added and needs to be debugged, all test scripts must be executed each time to obtain the latest variable, and repeated operations many times result in low efficiency.
Disclosure of Invention
The embodiment of the application provides a debugging method, a debugging device, an electronic device and a storage medium.
The debugging method of the embodiment of the application comprises the following steps:
storing name information of a preset variable into a lead-out script;
after all the test scripts are executed, calling the export script to obtain the preset variable;
and under the condition that the test script is newly added and a data interface tested by the newly added test script is not associated with a new variable, calling an import script to import the preset variable, so that the data interface can directly call the preset variable when the newly added test script is executed.
According to the debugging method in the embodiment of the application, the preset variable is obtained by executing all the test scripts and calling the export script, so that the newly added test scripts are added, when the newly added test scripts need to be debugged, and when the data interface tested by the newly added test scripts is not associated with the new variable, the preset variable is directly introduced to be directly called by the data interface, the test scripts do not need to be repeatedly executed for many times, the preset variable called by the data interface is obtained, and the debugging efficiency is improved.
In some embodiments, the preset variable includes a return value generated by a preset interface when the test script calls the preset interface.
In some embodiments, the debugging method comprises:
and determining that the data interface is not associated with the new variable when the data interface does not need to call the variable, or when the data interface needs to call the variable and the preset variable comprises the variable.
In some embodiments, the debugging method further comprises:
and determining that the data interface is associated with the new variable when the data interface needs to call a variable and the preset variable does not include the variable.
In some embodiments, the debugging method further comprises:
and updating the name information of the new variable to the export script under the condition that the data interface is associated with the new variable.
In some embodiments, the debugging method further comprises:
and after all the newly added test scripts are executed, calling the updated export script to obtain a new preset variable.
In some embodiments, the debugging method further comprises:
and calling the import script to import the new preset variable so that the data interface can directly call the new preset variable when the newly added test script is executed.
In an embodiment of the present application, there is provided a debugging apparatus including:
the storage module is used for storing the name information of the preset variable to the export script;
the first calling module is used for calling the export script to obtain the preset variable after all the test scripts are executed;
the second calling module is used for calling an import script to import the preset variable under the condition that the test script is newly added and a data interface tested by the newly added test script is not associated with a new variable, so that the data interface can directly call the preset variable when the newly added test script is executed.
The present application provides an electronic device, which includes a memory and a processor, wherein the memory is used for storing a computer program, and the processor is used for executing the computer program to implement the debugging method described in any one of the above embodiments.
Embodiments of the present application provide a non-transitory computer-readable storage medium of computer-executable instructions, which, when executed by one or more processors, cause the processors to perform the debugging method described in any of the above embodiments.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The above and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flowchart of a debugging method in an embodiment of the present application;
FIG. 2 is a block diagram of a debugging apparatus according to an embodiment of the present application;
FIG. 3 is a schematic plan view of an electronic device according to an embodiment of the present application;
FIG. 4 is a diagram of a text document generated by invoking an export script in an embodiment of the present application;
FIG. 5 is a schematic flowchart of a debugging method in an embodiment of the present application;
FIG. 6 is a schematic flowchart of a debugging method in an embodiment of the present application;
FIG. 7 is a flowchart illustrating a debugging method according to an embodiment of the present application;
FIG. 8 is a flow chart illustrating a debugging method according to an embodiment of the present application;
fig. 9 is a flowchart illustrating a debugging method according to an embodiment of the present application.
Description of the main element symbols:
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative and are only for the purpose of explaining the present application and are not to be construed as limiting the present application.
In the description of the present application, it is to be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," and the like are used in the orientations and positional relationships indicated in the drawings for convenience in describing the present application and for simplicity in description, and are not intended to indicate or imply that the referenced devices or elements must have a particular orientation, be constructed in a particular orientation, and be operated in a particular manner, and are not to be construed as limiting the present application. Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
In the description of the present application, it is to be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; may be mechanically connected, may be electrically connected or may be in communication with each other; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art as appropriate.
In this application, unless expressly stated or limited otherwise, the first feature "on" or "under" the second feature may comprise direct contact of the first and second features, or may comprise contact of the first and second features not directly but through another feature in between. Also, the first feature being "on," "above" and "over" the second feature includes the first feature being directly on and obliquely above the second feature, or merely indicating that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature includes the first feature being directly under and obliquely below the second feature, or simply meaning that the first feature is at a lesser elevation than the second feature.
The following disclosure provides many different embodiments or examples for implementing different features of the application. In order to simplify the disclosure of the present application, specific example components and arrangements are described below. Of course, they are merely examples and are not intended to limit the present application. Moreover, the present application may repeat reference numerals and/or letters in the various examples, such repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed. In addition, examples of various specific processes and materials are provided herein, but one of ordinary skill in the art may recognize applications of other processes and/or use of other materials.
Referring to fig. 1, an embodiment of the present application provides a debugging method, including:
step S10: storing name information of a preset variable into a lead-out script;
step S20: after all the test scripts are executed, calling the export script to obtain a preset variable;
step S30: and under the condition that the newly added test script is added and the data interface tested by the newly added test script is not associated with a new variable, calling the import script to import the preset variable, so that the data interface can directly call the preset variable when the newly added test script is executed.
Referring to fig. 2, an embodiment of the present disclosure provides a debugging apparatus 200, where the debugging apparatus 200 includes a saving module 21, a first calling module 22, and a second calling module 23. The debugging method in the embodiment of the present application can be realized by the debugging apparatus 200 in the embodiment of the present application. For example, the step S10 may be implemented by the saving module 21 of the debugging apparatus 200, the step S20 may be implemented by the first calling module 22 of the debugging apparatus 200, and the step S30 may be implemented by the second calling module 23 of the debugging apparatus 200.
Or, the saving module 21 is configured to save the name information of the preset variable to the export script; the first calling module 22 is configured to call the export script to obtain a preset variable after all the test scripts are executed; the second calling module 23 is configured to call the import script to import the preset variable when the new test script is added and the data interface tested by the new test script is not associated with a new variable, so that the data interface can directly call the preset variable when the new test script is executed.
Referring to fig. 3, the present application further provides an electronic device 100, where the electronic device 100 includes a processor 11 and a memory 12, the memory 12 is used for storing a computer program, and the processor 11 is used for executing the computer program to implement the debugging method of the above steps, or the processor 11 is used for saving name information of a preset variable in an export script, calling the export script to obtain the preset variable after all test scripts are executed, and calling the import script to import the preset variable when a test script is newly added and a data interface tested by the newly added test script is not associated with a new variable, so that the data interface can directly call the preset variable when the newly added test script is executed.
The electronic device 100 in the present application may be an electronic product such as a desktop computer, a notebook computer, a tablet computer, etc., and has a good data processing capability, and can run and develop a test script and an interface test tool platform of a test interface.
According to the debugging method in the embodiment of the application, the preset variable is obtained by calling the export script after executing all the test scripts, so that the newly added test scripts are added, and when the newly added test scripts are required to be debugged, the preset variable is directly introduced to be directly called by the data interface under the condition that the data interface tested by the newly added test scripts is not associated with the new variable, so that the test scripts do not need to be repeatedly executed for many times to obtain the preset variable called by the data interface, and the debugging efficiency is improved. Specifically, the debugging method in the embodiment of the application can improve the debugging efficiency of the script for automatically testing the interface in the automatic interface testing process.
The scripts mentioned in this application are codes written by the user or automatically generated by the processor 11 according to the user's instructions, and the interface (data interface) is an interface of the application program, and is responsible for the communication between a program and other software, and is essentially a predefined function. The software may obtain the required data by accessing an interface of the application.
Currently, when an application program interface is tested, a written test script is generally executed in an interface test tool to initiate a request to an interface to be tested, and then whether data returned by the interface is correct or not is checked, and whether an exception occurs in a returned result or not is checked under the condition of multiple requests at the same time, so that correctness testing and performance testing are realized.
However, when there are multiple test scripts and the test scripts are to be developed or debugged, if the system service flows corresponding to the interfaces called in the test scripts are complicated, the interfaces tested by the multiple test scripts need to be called, so that multiple variables are generated and called. At this time, each time a test script is debugged, a plurality of related test scripts need to be executed to obtain the currently required variables, which results in that development and debugging of the test scripts take a lot of time and are inefficient.
In one embodiment, the tool platform for developing the test script is a meter, when an interface B needs to be tested is newly added, a user can develop and debug the test script B of the test interface B on the tool platform, and since the interface B needs to be accessed only by part of user rights, the interface B can specify which parameters are needed, and if the interface B is called without carrying the parameters, the interface B can judge that the request is wrong and cannot return correct data.
Then, when the test script B calls and tests the interface B, parameters specified by the interface B, such as a user identity certificate, are required to be attached, and the parameters specified by the interface B are obtained by calling another interface a, and the interface a is called by the test script a. Therefore, if the interface B called by the developed test script B is to be tested, the test script a needs to be called first to call the interface a, so as to obtain the parameters required by the call interface B.
It can be understood that, under the condition that the parameters transmitted to the interface a are different, the return values generated by the interface a are also different, that is, although the user identity credentials are all returned, the identity credentials corresponding to different users are different, at this time, a variable needs to be set, the return value of the interface a is given to the variable every time, and the return value of the interface a can be obtained by calling the variable by the interface B.
In addition, in order to test the performance of the interface B, the interface B is often repeatedly tested for many times, that is, the corresponding test script B is executed for many times, and then the test script a is also repeatedly executed for many times in order to obtain the variable required by the interface B, so that the test efficiency is low due to repeated operation for many times. Moreover, in the case of an increasing number of interfaces like interface B, or the interfaces tested by multiple test scripts need to be called each other due to complex system services, which may result in considerable basic repetitive operations and seriously affect efficiency.
Then in steps S10 and S20 of the method provided by the present application, the name information of the preset variable may be saved to the export script. The preset variable is the variable generated by the calling interface a, which needs to be carried when the interface B is called in the above-described embodiment. The user may fill the name information of the preset variable into the export script, and the processor 11 stores the name information of the preset variable into the export script after receiving the user instruction.
The export script can be executed on the tool platform, and when the export script is executed, the export script can index to the preset variable according to the name information of the preset variable and export the preset variable into a text document with a predetermined format, for example, export in the form of an Excel table.
Referring to fig. 4, fig. 4 is an example of a text document in a predetermined format, and it can be understood that the text document derived by executing the export script may include, in addition to name information of the preset variable, a value of the preset variable, a text description of the preset variable, and the like, which is convenient for a user to read and maintain.
In order to obtain all the preset variables, the export script may be called on the tool platform after all the test scripts are executed, so that all the preset variables are searched from all the generated variables after all the test scripts are executed according to the name information, and then the processor 11 calls the export script to export all the preset variables.
In step S30, in case that a new test script is added, i.e. the system service has a new data interface, i.e. the above mentioned interface, to be tested, a command may be entered on the tool platform to make the processor 11 add the test script according to the command to test the new data interface.
At this time, the user may determine whether to call a new variable by using the data interface that needs to be newly added, that is, the user determines whether to attach a parameter specified by the data interface when testing the data interface, and whether the parameter can be obtained by calling a preset variable.
In the case that the data interface is not associated with a new variable, that is, when the parameter required by the data interface is obtained by calling the preset variable, the processor 11 calls the import script to import the preset variable exported in step S20, so that the data interface tested by the newly added test script can obtain the required variable from the imported preset variable to obtain the corresponding parameter. Therefore, the test script related to the variable needed to be used by the data interface can not be called any more, and the debugging efficiency of the newly added test script is improved.
In the above-mentioned embodiment, when an interface B needs to be tested is added, the user may develop and debug a test script B of the test interface B on the tool platform, and the test script B needs to attach parameters specified by the interface B, such as an identity credential of the user, when invoking and testing the interface B.
The parameters specified by the interface B are obtained by calling the interface A, namely the value returned by the calling interface A is the parameter required by accessing the interface B, the parameter is given to a variable, the parameter value is not required to be modified every time, and the interface B can obtain the parameter by directly calling the variable.
At this time, by adopting the debugging method in the application, the variable is a preset variable which needs to be exported, the name information of the parameter is filled in the export script, and after the test script A is executed, the variable is exported through the execution of the export script.
At this time, the variable to be called by the interface B is already included in the derived preset variable and is not associated with a new variable. Therefore, when the correctness and performance of the interface B are tested for many times, before the test script B is executed, the processor 11 may call the import script to import the preset variable, so that the interface B may directly call a required variable in the preset variable to directly obtain the return value of the interface a.
Therefore, the test script A is not required to be called to obtain the return value of the interface A when the test script B is debugged every time, but only the preset variable stored with the return value of the interface A is required to be exported after the test script A is called once, and then the imported preset variable is executed when the test script B is required to be debugged so as to directly take the preset variable.
It can be understood that the debugging method can save development and debugging time of a large number of test scripts, and does not need to execute a plurality of related test scripts each time to obtain parameters required by the test scripts to be developed.
In addition, in the embodiment of the present application, the export script and the import script may be written and packaged using multiple programming languages such as Java and Python, and then may be called on any interface test tool platform, for example, a Jmeter, to implement exporting and importing the preset variable, thereby saving development and debugging time of the test script of the test interface.
In some embodiments, the default variable may include a return value generated by the default interface in the case where the test script calls the default interface.
Therefore, when the test script calls the preset interface, the return value generated by the preset interface is used as the preset variable, the preset variable is exported and stored, and the preset variable is imported when the test script is debugged, so that the test script can be prevented from repeatedly calling the preset interface, and the debugging time of the test script is saved.
Specifically, when the interface automation test script is developed, the test script mainly includes an environment variable declaration, a login module (for implementing authentication), an initialization data module (for obtaining a basic variable ID), a data clearing module (for deleting old data newly added to the previously executed test script), and a specific service logic module (for implementing specific service logic).
In the process of developing the test script, if a return value returned by a certain data interface called by the test script is related to other data interfaces, and because the data interfaces return different return values under the condition of using different parameters, a variable is defined to obtain the return value to be used for being related to different data interfaces.
The preset interface is a data interface that returns a return value required by another data interface among the above-mentioned data interfaces associated with each other. If the data interface a returns the user ID and the data interface B needs the user ID to be called, the data interface a and the data interface B are associated with each other, and the data interface a is the preset interface. It can be understood that the preset variable may be a return value generated by the preset interface when the preset interface is called by the test script. The preset variables may be used by a data interface associated with the preset interface.
Referring to fig. 5, in some embodiments, the debugging method includes:
step S31: and determining that the data interface is not associated with a new variable in the case that the data interface does not need to call the variable, or in the case that the data interface needs to call the variable and the preset variable comprises the variable.
In some embodiments, the second calling module 23 is configured to determine that the data interface is not associated with a new variable when the data interface does not need to call the variable, or when the data interface needs to call the variable and the preset variable includes the variable.
In some embodiments, the processor 11 is configured to determine that the data interface is not associated with a new variable if the data interface does not need to call a variable, or if the data interface needs to call a variable and the preset variable comprises a variable.
Therefore, the confirmation information that whether the user needs to call the variable of the data interface and whether the preset variable comprises the variable when the variable needs to be called can be received, so that the situation that the data interface is not associated with a new variable is determined, and then the imported script is called to import the preset variable, so that the newly added test script can directly call the preset variable to test the data interface.
Specifically, when a user adds a test script to test a corresponding data interface, whether a variable needs to be called can be judged according to a calling condition of the data interface. When the test script is used for testing the data interface, no variable is required to be transmitted, namely the data interface is considered to be not required to call the variable, and further the data interface is considered to be not associated with a new variable; or, when the test script is used for testing the data interface, the data interface needs to use a return value after execution of other data interfaces, and then the data interface is considered to need to call a variable, at this time, a user needs to confirm whether a pre-derived preset variable includes the variable, and under the condition that the variable is included, it is confirmed that the data interface is not associated with a new variable.
When the newly added test script needs to be debugged, the corresponding button can be clicked on the interface test tool platform, so that after the processor receives the instruction, under the condition that the data interface is determined not to be associated with a new variable, the newly added test script is normally debugged by executing the imported script according to the preset steps, and the newly added test script can directly call the preset variable to obtain the required variable.
Particularly, when a newly added test script is used for testing a data interface, and the data interface needs to use a return value after execution of other old data interfaces, the way for the user to judge whether the return value is included in the derived preset variable may be through name information of the return value, that is, searching the name information of the return value variable in the name information of the preset variable, if there is consistent name information, the preset variable is considered to include the variable, and if the name information of the two is inconsistent, the preset variable is considered to not include the variable.
Referring to fig. 6, in some embodiments, the debugging method further includes:
step S32: and under the condition that the data interface needs to call the variable and the preset variable does not comprise the variable, determining that the data interface is associated with a new variable.
In some embodiments, the second calling module 23 is configured to determine that the data interface is associated with a new variable if the data interface needs to call the variable and the preset variable does not include the variable.
In some embodiments, the processor 11 is configured to determine that a new variable is associated with the data interface if the data interface needs to call the variable and the preset variable does not include the variable.
Therefore, the confirmation information that whether the user needs to call the variable of the data interface and whether the preset variable comprises the variable when the variable needs to be called can be received, so that the fact that the new variable is associated with the data interface is determined, and the new variable is convenient to maintain.
Specifically, as described above, when a user adds a test script to test a corresponding data interface, whether a variable needs to be called may be determined according to a calling condition of the data interface. When the test script is used for testing the data interface, the data interface needs to use a return value after the execution of other data interfaces, and the user can confirm that the data interface is associated with a new variable under the condition that the user confirms that the pre-derived preset variable does not comprise the variable.
When a newly added test script needs to be debugged, in order to reduce the time length for debugging for multiple times, a new variable needs to be maintained to be added to a preset variable, that is, the new preset variable is obtained. For example, the user may define name information of a new variable, and at this time, after the processor receives the name information of the new variable, it is determined that the data interface is associated with the new variable, and corresponding processing is performed.
For example, the processor stores the name information of the new variable to update the export script, then the processor executes all the test scripts according to the user instruction and calls the updated export script, so that the new variable is exported to the text document, and the import script can be executed when the newly added test script is debugged for multiple times, so that the newly added test script can directly call the new variable.
Referring to fig. 7, in some embodiments, the debugging method further includes:
step S40: and under the condition that the data interface is associated with the new variable, updating the name information of the new variable to the export script.
In some embodiments, the debugging apparatus 200 further includes an updating module 24, configured to update name information of a new variable to the export script if the data interface is associated with the new variable.
In some embodiments, the processor 11 is configured to update name information of a new variable to the export script if the data interface has the new variable associated therewith.
In this way, by maintaining the export script and updating the name information of the new variable in the export script, when the data interface is associated with the new variable, the real-time performance of the preset variable can be maintained by executing the updated export script, so that the debugging efficiency of the newly added test script can be improved even if the data interface is associated with the new variable.
In step S40, when a new data interface to be tested is added, the user may add a test script on the interface test tool platform to test the data interface. When a new variable is associated with a data interface tested by a newly added test script, if a preset variable before addition is still introduced, the data interface cannot acquire a return value by calling the preset variable because the preset variable does not include the new variable, but one or more test scripts corresponding to the return value need to be called to acquire the new variable to acquire the return value when the newly added test script is executed each time, so that the debugging efficiency is reduced.
Then, the user can define the name information of the new variable, input the name information into the interface test tool platform and input the name information into the export script, so that the processor can store the name information of the new variable in the export script after receiving the name information of the new variable, update the export script is completed, and the new variable can be exported as a preset variable when executing the updated export script.
In one embodiment, a user adds a new test script C, the test script C is used for testing the data interface C, and the parameters required by the data interface C come from the return value returned by the data interface D obtained by calling the data interface D by the test script D.
Then, the return value of the data interface D is assigned to the variable D, and the data interface C calls the variable D to obtain the parameter. And the variable D is not in the derived preset variable and is a new variable. At this time, the user may define name information of the variable D, for example, a user phone number, and then input the name information into the export script, and the processor stores the name information in the export script after receiving the name information, so that the export script may export the variable D when executing the export script next time, and the data interface C may directly call the variable D from the preset variable to obtain the parameter of the required user phone number.
Referring to fig. 8, in some embodiments, the debugging method may further include:
step S50: and after all the newly added test scripts are executed, calling the updated export scripts to obtain new preset variables.
In some embodiments, the first calling module 22 is configured to call the updated export script to obtain the new preset variable after all the added test scripts are executed.
In some embodiments, the processor 11 is configured to call the updated export script to obtain the new preset variable after all the newly added test scripts are executed.
Therefore, the name information of the new variable is maintained in the export script to update the export script, so that the updated export script is called to obtain the new preset variable, the calling requirement of the newly added test script in the subsequent steps is met, and the debugging efficiency of the newly added test script is improved.
Specifically, in step S50, since the data interface tested by the newly added test script is associated with a new variable, in order to save time when debugging the newly added test script multiple times, the export script needs to be re-executed to obtain the preset variable added with the new variable.
In step S40, the export script is updated, so that after all the newly added test scripts are executed, the updated export script can be called to export a new preset variable, where the new preset variable includes a new variable that includes parameters required by the data interface tested by the newly added test script, compared to the old preset variable.
Referring to fig. 9, in some embodiments, the debugging method may further include:
step S60: and calling the import script to import a new preset variable, so that the data interface can directly call the new preset variable when the newly added test script is executed.
In some embodiments, the second calling module 23 may be configured to call the import script to import a new default variable, so that the data interface can directly call the new default variable when the newly added test script is executed.
In some embodiments, the processor 11 is configured to invoke the import script to import the new default variable, so that the data interface can directly invoke the new default variable when executing the newly added test script.
Therefore, the new preset variable is introduced by calling the import script, and the data interface tested by the newly added test script can directly call the new preset variable to acquire the required parameter, so that the test script corresponding to the required parameter of the data interface is prevented from being repeatedly called when the performance of the data interface is tested, and the debugging efficiency of the newly added test script is improved.
Specifically, in step S60, before debugging the newly added test script, the import script may be called to call the new preset variable, so that the parameters required by the newly added data interface may be obtained by directly calling the corresponding new variable in the new preset variable. Therefore, when the newly added data interface needs to be subjected to repeated performance tests for multiple times, the test script related to the new variable needed to be used by the newly added data interface can not be called repeatedly, and the debugging efficiency of the newly added test script is improved.
The present embodiments provide a non-volatile computer-readable storage medium storing a computer program, which, when executed by one or more processors 11, causes the processors 11 to execute the debugging method of any one of the above embodiments.
For example, the computer program, when executed by the one or more processors 11, causes the processors 11 to perform the steps of:
step S10: storing name information of a preset variable into a lead-out script;
step S20: after all the test scripts are executed, calling the export script to obtain a preset variable;
step S30: and under the condition that the newly added test script is added and the data interface tested by the newly added test script is not associated with a new variable, calling the import script to import the preset variable, so that the data interface can directly call the preset variable when the newly added test script is executed.
Specifically, in one embodiment, the electronic device 100 may include a processor 11, and the processor 11 may be a Central Processing Unit (CPU). The Processor 11 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or combinations thereof.
The computer program may be stored in the memory 12, and the memory 12 may be used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the methods in the above-described method embodiments. The processor 11 executes various functional applications and data processing of the processor 11 by executing non-transitory software programs, instructions and modules stored in the memory 12, that is, implements the method in the above-described method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, and the implemented program can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory 12(Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like; the storage medium may also comprise a combination of memories 12 of the kind described above.
In the description herein, references to the description of the terms "one embodiment," "certain embodiments," "an illustrative embodiment," "an example," "a specific example," or "some examples" or the like mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that: numerous changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the application, the scope of which is defined by the claims and their equivalents.
Claims (10)
1. A debugging method, characterized in that the debugging method comprises:
storing name information of a preset variable into a lead-out script;
after all the test scripts are executed, calling the export script to obtain the preset variable;
and under the condition that the test script is newly added and a data interface tested by the newly added test script is not associated with a new variable, calling an import script to import the preset variable, so that the data interface can directly call the preset variable when the newly added test script is executed.
2. The debugging method according to claim 1, wherein the preset variable comprises a return value generated by a preset interface when the test script calls the preset interface.
3. The debugging method according to claim 1, comprising:
and determining that the data interface is not associated with the new variable when the data interface does not need to call the variable, or when the data interface needs to call the variable and the preset variable comprises the variable.
4. The debugging method according to claim 1, further comprising:
and determining that the data interface is associated with the new variable when the data interface needs to call a variable and the preset variable does not include the variable.
5. The debugging method according to claim 1, further comprising:
and updating the name information of the new variable to the export script under the condition that the data interface is associated with the new variable.
6. The debugging method according to claim 5, wherein the debugging method further comprises:
and after all the newly added test scripts are executed, calling the updated export script to obtain a new preset variable.
7. The debugging method according to claim 6, further comprising:
and calling the import script to import the new preset variable so that the data interface can directly call the new preset variable when the newly added test script is executed.
8. A debugging apparatus, characterized in that the debugging apparatus comprises:
the storage module is used for storing the name information of the preset variable to the export script;
the first calling module is used for calling the export script to obtain the preset variable after all the test scripts are executed;
the second calling module is used for calling an import script to import the preset variable under the condition that the test script is newly added and a data interface tested by the newly added test script is not associated with a new variable, so that the data interface can directly call the preset variable when the newly added test script is executed.
9. An electronic device, comprising a memory for storing a computer program and a processor for executing the computer program to implement the debugging method of any of claims 1-7.
10. A non-transitory computer-readable storage medium of computer-executable instructions, which when executed by one or more processors, cause the processors to perform the debugging method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111026473.5A CN113760759A (en) | 2021-09-02 | 2021-09-02 | Debugging method, debugging device, electronic device, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111026473.5A CN113760759A (en) | 2021-09-02 | 2021-09-02 | Debugging method, debugging device, electronic device, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113760759A true CN113760759A (en) | 2021-12-07 |
Family
ID=78792617
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111026473.5A Pending CN113760759A (en) | 2021-09-02 | 2021-09-02 | Debugging method, debugging device, electronic device, and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113760759A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140181793A1 (en) * | 2010-11-10 | 2014-06-26 | Net Magnus Ltd. | Method of automatically testing different software applications for defects |
CN109597761A (en) * | 2018-12-03 | 2019-04-09 | 四川长虹电器股份有限公司 | A kind of automatic interface testing method based on Jmeter |
CN109857667A (en) * | 2019-02-03 | 2019-06-07 | 苏州市龙测智能科技有限公司 | Automatic interface testing method, test device, test equipment and storage medium |
CN111124871A (en) * | 2018-10-31 | 2020-05-08 | 北京国双科技有限公司 | Interface test method and device |
CN112579446A (en) * | 2020-12-10 | 2021-03-30 | 北京软通智慧城市科技有限公司 | Interface testing method and device, electronic equipment and storage medium |
CN113010413A (en) * | 2021-02-20 | 2021-06-22 | 烽火通信科技股份有限公司 | Automatic interface testing method and device |
-
2021
- 2021-09-02 CN CN202111026473.5A patent/CN113760759A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140181793A1 (en) * | 2010-11-10 | 2014-06-26 | Net Magnus Ltd. | Method of automatically testing different software applications for defects |
CN111124871A (en) * | 2018-10-31 | 2020-05-08 | 北京国双科技有限公司 | Interface test method and device |
CN109597761A (en) * | 2018-12-03 | 2019-04-09 | 四川长虹电器股份有限公司 | A kind of automatic interface testing method based on Jmeter |
CN109857667A (en) * | 2019-02-03 | 2019-06-07 | 苏州市龙测智能科技有限公司 | Automatic interface testing method, test device, test equipment and storage medium |
CN112579446A (en) * | 2020-12-10 | 2021-03-30 | 北京软通智慧城市科技有限公司 | Interface testing method and device, electronic equipment and storage medium |
CN113010413A (en) * | 2021-02-20 | 2021-06-22 | 烽火通信科技股份有限公司 | Automatic interface testing method and device |
Non-Patent Citations (1)
Title |
---|
809316839: "使用Jmeter导出导入接口自动化案例中的自定义变量", pages 1 - 4, Retrieved from the Internet <URL:https://blog.51cto.com/u_6183574/2364261> * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110647320A (en) | Project framework construction method and device, computer equipment and storage medium | |
WO2019161619A1 (en) | Automatic interface test method and apparatus, and device and computer-readable storage medium | |
CN111026645B (en) | User interface automatic test method and device, storage medium and electronic equipment | |
CN112199300B (en) | Interface testing method and device, electronic equipment and storage medium | |
CN112765023B (en) | Test case generation method and device | |
CN110879781B (en) | Program debugging method, device, electronic equipment and computer readable storage medium | |
CN112799940B (en) | Regression testing method, regression testing device, computer system and computer readable storage medium | |
WO2019127904A1 (en) | Application program running method, apparatus, computer device and storage medium | |
CN110750443A (en) | Webpage testing method and device, computer equipment and storage medium | |
CN110908895A (en) | Page automatic testing method and device, computer equipment and storage medium | |
CN111309593A (en) | JSON interface verification method, device and equipment and computer readable storage medium | |
CN115357434A (en) | Complete machine testing method, device to be tested, computer device and storage medium | |
CN111538659B (en) | Interface testing method, system, electronic equipment and storage medium of business scene | |
CN114661580A (en) | Flow recording playback method and device, computer equipment and storage medium | |
CN113407449A (en) | Interface testing method and device | |
CN112486811A (en) | Interface test method, device, equipment and medium | |
CN109388420A (en) | Application upgrade test method, device, computer equipment and storage medium | |
CN111324540B (en) | Interface testing method and device | |
CN112306533A (en) | Front-end framework automatic conversion method and device, computer equipment and storage medium | |
CN113760759A (en) | Debugging method, debugging device, electronic device, and storage medium | |
CN113918864A (en) | Website page testing method, testing system, testing device, electronic equipment and medium | |
CN113282476B (en) | Interface performance testing method and device and electronic equipment | |
CN113722229A (en) | Software testing method and device, electronic equipment and storage medium | |
CN112559346A (en) | Service testing method and device | |
CN115858256A (en) | Test method and device for Internet of things equipment and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |