CN112015663B - Test data recording method, device, equipment and medium - Google Patents
Test data recording method, device, equipment and medium Download PDFInfo
- Publication number
- CN112015663B CN112015663B CN202010968254.8A CN202010968254A CN112015663B CN 112015663 B CN112015663 B CN 112015663B CN 202010968254 A CN202010968254 A CN 202010968254A CN 112015663 B CN112015663 B CN 112015663B
- Authority
- CN
- China
- Prior art keywords
- target
- request
- test data
- use case
- data recording
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention relates to the technical field of testing, and provides a test data recording method, device, equipment and medium, which can track and capture internal variables in real time according to a tracking ID through a byte code enhancement technology, and establish a target corresponding relation according to a target code function and a target identifier so as to establish a corresponding relation between a target use case corresponding to each intercepted target request and the target code function, effectively solve the problem that the relation between the use case and the code function cannot be established, store the target corresponding relation and variable values into a database, and further realize parallel recording of test data. The present application also relates to blockchain techniques in which target correspondences and variable values may be stored on the blockchain.
Description
Technical Field
The present invention relates to the field of testing technologies, and in particular, to a method, an apparatus, a device, and a medium for recording test data.
Background
In performing the test, it is generally necessary to record the relationship between the case and the code function to assist in achieving the positioning of errors, checking the coverage of the case, and the like.
In the prior art, open source tools are mainly used for recording the relation between the cases and the code functions, but a plurality of open source code coverage rate statistics tools can count codes covered in a certain period of time, but if a plurality of test cases are executed by a plurality of testers in the period of time at the same time, the codes in the period of time cannot be distinguished to be covered by which cases respectively, the direct relation between the codes and the cases cannot be directly established, and the functions covered by a certain case cannot be intuitively checked.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a test data recording method, apparatus, device and medium, which can effectively solve the problem that the relationship between the use case and the code function cannot be established, and realize parallel recording of test data.
A test data recording method, the test data recording method comprising:
responding to a test data recording instruction, and intercepting each request of a test system by adopting an Agent technology;
for each intercepted target request, acquiring a target identifier of the target request, wherein the target identifier is used for determining a target use case corresponding to the target request;
determining whether to track the target request according to the target identifier;
when the target request is determined to be tracked, configuring a tracking ID for the target request, and setting an internal variable in an execution thread of the target request;
adopting a byte code enhancement technology, and recording the variable value of the internal variable according to the tracking ID;
responding to an ending recording instruction, acquiring an object code function from the variable value, and establishing an object corresponding relation according to the object code function and the object identifier;
and storing the target corresponding relation and the variable value into a database.
According to a preferred embodiment of the present invention, said determining whether to track said target request based on said target identification comprises:
calling a pre-configured global identification list, wherein identifications of all requests to be tracked are stored in the global identification list;
traversing the global identification list by the target identification;
when traversing in the global identity list to an identity matching the target identity, determining to track the target request.
According to a preferred embodiment of the present invention, the configuring the tracking ID for the target request, and setting the internal variable in the execution thread of the target request includes:
acquiring a request cookie of the target request;
configuring the tracking ID in the request cookie;
acquiring an execution thread of the target request;
setting an InheretothreadLocal variable as the internal variable in the execution thread.
According to a preferred embodiment of the present invention, the obtaining the target code function from the variable value, and establishing the target correspondence according to the target code function and the target identifier includes:
acquiring the target code function from the variable value by adopting a regular expression, wherein the target code function comprises a function name and parameters;
Determining a target use case corresponding to the target request according to the target identifier;
and associating the target use case with the target code function to obtain a corresponding relation between the target use case and the target code function as the target corresponding relation.
According to a preferred embodiment of the present invention, the test data recording method further includes:
when it is determined not to track the target request and/or in response to the end recording instruction, the value of the request cookie is cleared.
According to a preferred embodiment of the present invention, the test data recording method further includes:
determining a configuration code function of the target use case, and determining a first number of the configuration code functions;
determining a second number of the object code functions;
calculating the quotient of the second quantity and the first quantity as the function coverage rate of the target use case, and storing the function coverage rate to a blockchain;
when the coverage rate of the function is larger than or equal to a preset threshold value, determining that the quality of the target use case passes the verification; or alternatively
And when the coverage rate of the function is smaller than the preset threshold, determining that the quality of the target use case does not pass the verification, and feeding back the quality of the target use case to the designated terminal equipment.
According to a preferred embodiment of the present invention, the test data recording method further includes:
and when the target code function is monitored to be modified, feeding back the target use case to the appointed terminal equipment as a to-be-returned use case.
A test data recording apparatus, the test data recording apparatus comprising:
the interception unit is used for responding to the test data recording instruction and intercepting each request of the test system by adopting an Agent technology;
the acquisition unit is used for acquiring a target identifier of each intercepted target request, wherein the target identifier is used for determining a target use case corresponding to the target request;
a determining unit, configured to determine whether to track the target request according to the target identifier;
a configuration unit, configured to configure a tracking ID for the target request and set an internal variable in an execution thread of the target request when it is determined to track the target request;
a recording unit, configured to record variable values of the internal variables according to the tracking ID using a byte code enhancement technique;
the establishing unit is used for responding to the recording ending instruction, acquiring an object code function from the variable value, and establishing an object corresponding relation according to the object code function and the object identifier;
And the storage unit is used for storing the target corresponding relation and the variable value into a database.
An electronic device, the electronic device comprising:
a memory storing at least one instruction; and
And the processor executes the instructions stored in the memory to realize the test data recording method.
A computer readable storage medium having stored therein at least one instruction for execution by a processor in an electronic device to implement the test data recording method.
According to the technical scheme, each request of a test system can be intercepted by adopting an Agent technology in response to a test data recording instruction, a target identifier of each intercepted target request is obtained, the target identifier is used for determining a target use case corresponding to the target request, whether the target request is tracked or not is determined according to the target identifier, when the target request is determined to be tracked, a tracking ID is configured for the target request, an internal variable is arranged in an execution thread of the target request, a byte code enhancement technology is adopted, the variable value of the internal variable is recorded according to the tracking ID, the variable value of the internal variable is tracked and captured according to the tracking ID through the byte code enhancement technology, the variable value of the internal variable is recorded, a target code function is obtained from the variable value in response to a recording instruction, and a target corresponding relation is established according to the target code function and the target identifier, so that the corresponding relation between the target use case corresponding to the intercepted target request and the target code function is established, the corresponding relation between the corresponding target use case and the target code function is effectively established, the problem of the corresponding relation between the application case and the corresponding relation in the prior art and the corresponding relation between the application case and the target code function is effectively solved, and the corresponding relation between the application and the test data and the test database is further saved, and the test data is further realized.
Drawings
FIG. 1 is a flow chart of a test data recording method according to a preferred embodiment of the present invention.
FIG. 2 is a functional block diagram of a test data recording apparatus according to a preferred embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention for implementing a test data recording method.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart showing a test data recording method according to a preferred embodiment of the present invention. The order of the steps in the flowchart may be changed and some steps may be omitted according to various needs.
The test data recording method is applied to one or more electronic devices, wherein the electronic devices are devices capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and the hardware of the electronic devices comprises, but is not limited to, microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASICs), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSPs), embedded devices and the like.
The electronic device may be any electronic product that can interact with a user in a human-computer manner, such as a personal computer, tablet computer, smart phone, personal digital assistant (Personal Digital Assistant, PDA), game console, interactive internet protocol television (Internet Protocol Television, IPTV), smart wearable device, etc.
The electronic device may also include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network server, a server group composed of a plurality of network servers, or a Cloud based Cloud Computing (Cloud Computing) composed of a large number of hosts or network servers.
The network in which the electronic device is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), and the like.
S10, responding to a test data recording instruction, and intercepting each request of a test system by adopting an Agent technology.
In this embodiment, the test data recording instruction may be triggered by a relevant developer or tester.
The Agent is equivalent to an interceptor, the Agent code is executed before the main method is executed, the code in the Agent is the monitoring code is injected into the code to be monitored by utilizing a byte code modification tool, and the execution time, parameters and the like of the code are captured.
Through Agent technology, each request of the test system can be effectively intercepted, so that parallel recording of test data is assisted.
S11, for each intercepted target request, acquiring a target identifier of the target request, wherein the target identifier is used for determining a target use case corresponding to the target request.
In this embodiment, the target identifier may include, but is not limited to: IP, digital signature, etc., the invention is not limited to the form of the target identification.
S12, determining whether to track the target request according to the target identifier.
It will be appreciated that not all requests have tracking requirements, and therefore, first, it is determined whether the target request has the need to track, so as to avoid burdening the system with performing meaningless tracking.
Specifically, the determining whether to track the target request according to the target identifier includes:
calling a pre-configured global identification list, wherein identifications of all requests to be tracked are stored in the global identification list;
traversing the global identification list by the target identification;
when traversing in the global identity list to an identity matching the target identity, determining to track the target request.
By the implementation mode, whether the target request is tracked or not can be determined according to actual requirements, and system burden is effectively reduced.
In this embodiment, the test data recording method further includes:
acquiring historical recording data, determining all requests to be recorded according to the historical recording data, acquiring the identifiers of all requests, and configuring the global identifier list according to the identifiers of all requests; and/or
And receiving the identifier uploaded by the user, and configuring the global identifier list according to the received identifier.
S13, when the target request is determined to be tracked, configuring a tracking ID for the target request, and setting an internal variable in an execution thread of the target request.
The internal variables are used for recording data in the test process, namely data generated when the target use case is executed.
In at least one embodiment of the present invention, the configuring the tracking ID for the target request and setting the internal variable in the execution thread of the target request includes:
acquiring a request cookie of the target request;
configuring the tracking ID in the request cookie;
acquiring an execution thread of the target request;
Setting an InheretothreadLocal variable as the internal variable in the execution thread.
The tracking ID can be a character string with a preset bit number, and the tracking ID can be obtained by converting according to the target identifier.
For example: and when the target identification bit 123 is used, adding a check bit 15 on the basis of the target identification to obtain the tracking ID of 12315.
It can be appreciated that, since the tracking ID corresponds to the target request and the target request corresponds to the target identifier, the tracking ID also has a one-to-one correspondence with the target identifier, which can provide a basis for subsequently establishing a relationship between a use case and a code function.
Further, the InhereableThreadLocal variable is an internal variable of the execution thread, and can enable the child thread to inherit the numerical value of the parent thread, so that the data placed in the InhereableThreadLocal variable can be acquired through inheritance, namely, the variable value of the internal variable can be acquired through the child thread in the execution thread.
S14, adopting a byte code enhancement technology, and recording the variable value of the internal variable according to the tracking ID.
The byte code enhancement technology may be Java byte code enhancement technology, that is, after the Java byte code is generated, the Java byte code is modified to enhance its function, which is equivalent to modifying the binary file of the application program. The Java bytecode enhancement technique is mainly to reduce redundant codes, improve performance, and the like.
In this embodiment, by the byte code enhancement technique, the internal variable can be tracked and captured in real time according to the tracking ID, and the variable value of the internal variable can be recorded.
S15, responding to the recording ending instruction, acquiring an object code function from the variable value, and establishing an object corresponding relation according to the object code function and the object identifier.
The recording ending instruction may also be triggered by a relevant developer or tester.
In at least one embodiment of the present invention, the obtaining the target code function from the variable value, and establishing the target correspondence according to the target code function and the target identifier includes:
acquiring the target code function from the variable value by adopting a regular expression, wherein the target code function comprises a function name and parameters;
determining a target use case corresponding to the target request according to the target identifier;
and associating the target use case with the target code function to obtain a corresponding relation between the target use case and the target code function as the target corresponding relation.
Through the implementation manner, the corresponding relation between the target use cases and the target code functions corresponding to each intercepted target request can be established, and the problem that the relation between the use cases and the code functions cannot be established in the prior art is effectively solved.
In at least one embodiment of the present invention, the test data recording method further includes:
when it is determined not to track the target request and/or in response to the end recording instruction, the value of the request cookie is cleared.
By the embodiment, when the target request is determined to be not required to be tracked or stopped being tracked, the space for requesting the cookie can be released in time, so that the running performance of the system is improved.
S16, storing the target corresponding relation and the variable value into a database.
The corresponding relation between each intercepted request use case and the function code is put in storage, so that the problem of parallel recording of test data can be effectively solved, the corresponding use case can be positioned through each code function, the corresponding code function can be positioned through the use case, and the relevant responsible person can be further positioned because each use case has the corresponding editor.
In this embodiment, in order to improve the security of data, the target correspondence may also be stored in the blockchain.
In at least one embodiment of the present invention, the test data recording method further includes:
determining a configuration code function of the target use case, and determining a first number of the configuration code functions;
Determining a second number of the object code functions;
calculating the quotient of the second quantity and the first quantity as the function coverage rate of the target use case, and storing the function coverage rate to a blockchain;
when the coverage rate of the function is larger than or equal to a preset threshold value, determining that the quality of the target use case passes the verification; or alternatively
And when the coverage rate of the function is smaller than the preset threshold, determining that the quality of the target use case does not pass the verification, and feeding back the quality of the target use case to the designated terminal equipment.
The preset threshold may be configured in a user-defined manner, for example: 97%.
The appointed terminal equipment can be equipment of a user editing the target use case, and further can timely feed back the unqualified use case to a corresponding responsible person so as to timely modify the unqualified use case and avoid a normal testing process of images.
Therefore, the above embodiment can not only check the function coverage of the use cases, but also further automatically evaluate the use case quality to assist in more accurate testing.
In at least one embodiment of the present invention, the test data recording method further includes:
and when the target code function is monitored to be modified, feeding back the target use case to the appointed terminal equipment as a to-be-returned use case.
Through the implementation mode, the test case needing regression of the modified code function can be rapidly positioned, the workload required by test return is effectively reduced, the test feedback speed is improved, and the risk of missing test is reduced.
According to the technical scheme, each request of a test system can be intercepted by adopting an Agent technology in response to a test data recording instruction, a target identifier of each intercepted target request is obtained, the target identifier is used for determining a target use case corresponding to the target request, whether the target request is tracked or not is determined according to the target identifier, when the target request is determined to be tracked, a tracking ID is configured for the target request, an internal variable is arranged in an execution thread of the target request, a byte code enhancement technology is adopted, the variable value of the internal variable is recorded according to the tracking ID, the variable value of the internal variable is tracked and captured according to the tracking ID through the byte code enhancement technology, the variable value of the internal variable is recorded, a target code function is obtained from the variable value in response to a recording instruction, and a target corresponding relation is established according to the target code function and the target identifier, so that the corresponding relation between the target use case corresponding to the intercepted target request and the target code function is established, the corresponding relation between the corresponding target use case and the target code function is effectively established, the problem of the corresponding relation between the application case and the corresponding relation in the prior art and the corresponding relation between the application case and the target code function is effectively solved, and the corresponding relation between the application and the test data and the test database is further saved, and the test data is further realized.
FIG. 2 is a functional block diagram of a test data recording apparatus according to a preferred embodiment of the present invention. The test data recording device 11 comprises an interception unit 110, an acquisition unit 111, a determination unit 112, a configuration unit 113, a recording unit 114, a building unit 115 and a storage unit 116. The module/unit referred to in the present invention refers to a series of computer program segments capable of being executed by the processor 13 and of performing a fixed function, which are stored in the memory 12. In the present embodiment, the functions of the respective modules/units will be described in detail in the following embodiments.
In response to the test data recording instruction, the interception unit 110 intercepts each request of the test system using Agent technology.
In this embodiment, the test data recording instruction may be triggered by a relevant developer or tester.
The Agent is equivalent to an interceptor, the Agent code is executed before the main method is executed, the code in the Agent is the monitoring code is injected into the code to be monitored by utilizing a byte code modification tool, and the execution time, parameters and the like of the code are captured.
Through Agent technology, each request of the test system can be effectively intercepted, so that parallel recording of test data is assisted.
For each intercepted target request, the acquiring unit 111 acquires a target identifier of the target request, where the target identifier is used to determine a target use case corresponding to the target request.
In this embodiment, the target identifier may include, but is not limited to: IP, digital signature, etc., the invention is not limited to the form of the target identification.
The determination unit 112 determines whether to track the target request based on the target identification.
It will be appreciated that not all requests have tracking requirements, and therefore, first, it is determined whether the target request has the need to track, so as to avoid burdening the system with performing meaningless tracking.
Specifically, the determining unit 112 determines whether to track the target request according to the target identifier includes:
calling a pre-configured global identification list, wherein identifications of all requests to be tracked are stored in the global identification list;
traversing the global identification list by the target identification;
when traversing in the global identity list to an identity matching the target identity, determining to track the target request.
By the implementation mode, whether the target request is tracked or not can be determined according to actual requirements, and system burden is effectively reduced.
In this embodiment, history recording data is obtained, all requests to be recorded are determined according to the history recording data, identifiers of all requests are obtained, and the global identifier list is configured according to the identifiers of all requests; and/or
And receiving the identifier uploaded by the user, and configuring the global identifier list according to the received identifier.
When it is determined to track the target request, the configuration unit 113 configures a tracking ID for the target request, and sets an internal variable within the execution thread of the target request.
The internal variables are used for recording data in the test process, namely data generated when the target use case is executed.
In at least one embodiment of the present invention, the configuring unit 113 configures a tracking ID for the target request, and setting an internal variable in an execution thread of the target request includes:
acquiring a request cookie of the target request;
configuring the tracking ID in the request cookie;
acquiring an execution thread of the target request;
setting an InheretothreadLocal variable as the internal variable in the execution thread.
The tracking ID can be a character string with a preset bit number, and the tracking ID can be obtained by converting according to the target identifier.
For example: and when the target identification bit 123 is used, adding a check bit 15 on the basis of the target identification to obtain the tracking ID of 12315.
It can be appreciated that, since the tracking ID corresponds to the target request and the target request corresponds to the target identifier, the tracking ID also has a one-to-one correspondence with the target identifier, which can provide a basis for subsequently establishing a relationship between a use case and a code function.
Further, the InhereableThreadLocal variable is an internal variable of the execution thread, and can enable the child thread to inherit the numerical value of the parent thread, so that the data placed in the InhereableThreadLocal variable can be acquired through inheritance, namely, the variable value of the internal variable can be acquired through the child thread in the execution thread.
The recording unit 114 uses a byte code enhancement technique to record the variable value of the internal variable according to the tracking ID.
The byte code enhancement technology may be Java byte code enhancement technology, that is, after the Java byte code is generated, the Java byte code is modified to enhance its function, which is equivalent to modifying the binary file of the application program. The Java bytecode enhancement technique is mainly to reduce redundant codes, improve performance, and the like.
In this embodiment, by the byte code enhancement technique, the internal variable can be tracked and captured in real time according to the tracking ID, and the variable value of the internal variable can be recorded.
In response to the recording end instruction, the establishing unit 115 acquires an object code function from the variable values, and establishes an object correspondence according to the object code function and the object identifier.
The recording ending instruction may also be triggered by a relevant developer or tester.
In at least one embodiment of the present invention, the establishing unit 115 obtains an object code function from the variable value, and establishes an object correspondence according to the object code function and the object identifier, including:
acquiring the target code function from the variable value by adopting a regular expression, wherein the target code function comprises a function name and parameters;
determining a target use case corresponding to the target request according to the target identifier;
and associating the target use case with the target code function to obtain a corresponding relation between the target use case and the target code function as the target corresponding relation.
Through the implementation manner, the corresponding relation between the target use cases and the target code functions corresponding to each intercepted target request can be established, and the problem that the relation between the use cases and the code functions cannot be established in the prior art is effectively solved.
In at least one embodiment of the invention, the value of the request cookie is cleared when it is determined that the target request is not tracked and/or in response to the end recording instruction.
By the embodiment, when the target request is determined to be not required to be tracked or stopped being tracked, the space for requesting the cookie can be released in time, so that the running performance of the system is improved.
The storage unit 116 stores the target correspondence and the variable value in a database.
The corresponding relation between each intercepted request use case and the function code is put in storage, so that the problem of parallel recording of test data can be effectively solved, the corresponding use case can be positioned through each code function, the corresponding code function can be positioned through the use case, and the relevant responsible person can be further positioned because each use case has the corresponding editor.
In this embodiment, in order to improve the security of data, the target correspondence may also be stored in the blockchain.
In at least one embodiment of the invention, a configuration code function of the target use case is determined, and a first number of the configuration code functions is determined;
determining a second number of the object code functions;
Calculating the quotient of the second quantity and the first quantity as the function coverage rate of the target use case, and storing the function coverage rate to a blockchain;
when the coverage rate of the function is larger than or equal to a preset threshold value, determining that the quality of the target use case passes the verification; or alternatively
And when the coverage rate of the function is smaller than the preset threshold, determining that the quality of the target use case does not pass the verification, and feeding back the quality of the target use case to the designated terminal equipment.
The preset threshold may be configured in a user-defined manner, for example: 97%.
The appointed terminal equipment can be equipment of a user editing the target use case, and further can timely feed back the unqualified use case to a corresponding responsible person so as to timely modify the unqualified use case and avoid a normal testing process of images.
Therefore, the above embodiment can not only check the function coverage of the use cases, but also further automatically evaluate the use case quality to assist in more accurate testing.
In at least one embodiment of the present invention, when it is monitored that the target code function is modified, the target use case is fed back to the specified terminal device as a to-be-returned use case.
Through the implementation mode, the test case needing regression of the modified code function can be rapidly positioned, the workload required by test return is effectively reduced, the test feedback speed is improved, and the risk of missing test is reduced.
According to the technical scheme, each request of a test system can be intercepted by adopting an Agent technology in response to a test data recording instruction, a target identifier of each intercepted target request is obtained, the target identifier is used for determining a target use case corresponding to the target request, whether the target request is tracked or not is determined according to the target identifier, when the target request is determined to be tracked, a tracking ID is configured for the target request, an internal variable is arranged in an execution thread of the target request, a byte code enhancement technology is adopted, the variable value of the internal variable is recorded according to the tracking ID, the variable value of the internal variable is tracked and captured according to the tracking ID through the byte code enhancement technology, the variable value of the internal variable is recorded, a target code function is obtained from the variable value in response to a recording instruction, and a target corresponding relation is established according to the target code function and the target identifier, so that the corresponding relation between the target use case corresponding to the intercepted target request and the target code function is established, the corresponding relation between the corresponding target use case and the target code function is effectively established, the problem of the corresponding relation between the application case and the corresponding relation in the prior art and the corresponding relation between the application case and the target code function is effectively solved, and the corresponding relation between the application and the test data and the test database is further saved, and the test data is further realized.
Fig. 3 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention for implementing the test data recording method.
The electronic device 1 may comprise a memory 12, a processor 13 and a bus, and may further comprise a computer program, such as a test data recording program, stored in the memory 12 and executable on the processor 13.
It will be appreciated by those skilled in the art that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, the electronic device 1 may be a bus type structure, a star type structure, the electronic device 1 may further comprise more or less other hardware or software than illustrated, or a different arrangement of components, for example, the electronic device 1 may further comprise an input-output device, a network access device, etc.
It should be noted that the electronic device 1 is only used as an example, and other electronic products that may be present in the present invention or may be present in the future are also included in the scope of the present invention by way of reference.
The memory 12 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 12 may in some embodiments be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. The memory 12 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 1. Further, the memory 12 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 12 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of test data recording programs, but also for temporarily storing data that has been output or is to be output.
The processor 13 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, a combination of various control chips, and the like. The processor 13 is a Control Unit (Control Unit) of the electronic device 1, connects the respective components of the entire electronic device 1 using various interfaces and lines, and executes various functions of the electronic device 1 and processes data by running or executing programs or modules stored in the memory 12 (for example, executing a test data recording program or the like), and calling data stored in the memory 12.
The processor 13 executes the operating system of the electronic device 1 and various types of applications installed. The processor 13 executes the application program to implement the steps of the various test data recording method embodiments described above, such as the steps shown in fig. 1.
Illustratively, the computer program may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules/units may be a series of instruction segments of a computer program capable of performing a specific function for describing the execution of the computer program in the electronic device 1. For example, the computer program may be divided into an interception unit 110, an acquisition unit 111, a determination unit 112, a configuration unit 113, a recording unit 114, a creation unit 115, a saving unit 116.
The integrated units implemented in the form of software functional modules described above may be stored in a computer readable storage medium. The software functional module is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor (processor) to perform a portion of the test data recording method according to the embodiments of the present invention.
The integrated modules/units of the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on this understanding, the present invention may also be implemented by a computer program for instructing a relevant hardware device to implement all or part of the procedures of the above-mentioned embodiment method, where the computer program may be stored in a computer readable storage medium and the computer program may be executed by a processor to implement the steps of each of the above-mentioned method embodiments.
Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created from the use of blockchain nodes, and the like.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The bus may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one arrow is shown in FIG. 3, but only one bus or one type of bus is not shown. The bus is arranged to enable a connection communication between the memory 12 and at least one processor 13 or the like.
Although not shown, the electronic device 1 may further comprise a power source (such as a battery) for powering the various components, which may preferably be logically connected to the at least one processor 13 via a power management means, so as to perform functions such as charge management, discharge management, and power consumption management via the power management means. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
Further, the electronic device 1 may also comprise a network interface, optionally the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the electronic device 1 and other electronic devices.
The electronic device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
Fig. 3 shows only an electronic device 1 with components 12-13, it being understood by a person skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or a different arrangement of components.
In connection with fig. 1, the memory 12 in the electronic device 1 stores a plurality of instructions to implement a test data recording method, the processor 13 being executable to implement:
responding to a test data recording instruction, and intercepting each request of a test system by adopting an Agent technology;
for each intercepted target request, acquiring a target identifier of the target request, wherein the target identifier is used for determining a target use case corresponding to the target request;
determining whether to track the target request according to the target identifier;
when the target request is determined to be tracked, configuring a tracking ID for the target request, and setting an internal variable in an execution thread of the target request;
adopting a byte code enhancement technology, and recording the variable value of the internal variable according to the tracking ID;
Responding to an ending recording instruction, acquiring an object code function from the variable value, and establishing an object corresponding relation according to the object code function and the object identifier;
and storing the target corresponding relation and the variable value into a database.
Specifically, the specific implementation method of the above instructions by the processor 13 may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
In the several embodiments provided in the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.
Claims (7)
1. The test data recording method is characterized by comprising the following steps of:
responding to a test data recording instruction, and intercepting each request of a test system by adopting an Agent technology;
for each intercepted target request, acquiring a target identifier of the target request, wherein the target identifier is used for determining a target use case corresponding to the target request;
determining whether to track the target request according to the target identifier;
when the target request is determined to be tracked, configuring a tracking ID for the target request, and setting an internal variable in an execution thread of the target request;
adopting a byte code enhancement technology, and recording the variable value of the internal variable according to the tracking ID;
responding to an ending recording instruction, acquiring an object code function from the variable value, and establishing an object corresponding relation according to the object code function and the object identifier;
Storing the target corresponding relation and the variable value into a database;
the configuring the tracking ID for the target request and setting an internal variable in an execution thread of the target request comprises the following steps: acquiring a request cookie of the target request; configuring the tracking ID in the request cookie; acquiring an execution thread of the target request; setting an InheretobleThreadLocal variable as the internal variable in the execution thread;
the step of obtaining the target code function from the variable value and establishing a target corresponding relation according to the target code function and the target identifier comprises the following steps: acquiring the target code function from the variable value by adopting a regular expression, wherein the target code function comprises a function name and parameters; determining a target use case corresponding to the target request according to the target identifier; the target use case is associated with the target code function, and a corresponding relation between the target use case and the target code function is obtained to be used as the target corresponding relation;
the test data recording method further comprises the following steps: determining a configuration code function of the target use case, and determining a first number of the configuration code functions; determining a second number of the object code functions; calculating the quotient of the second quantity and the first quantity as the function coverage rate of the target use case, and storing the function coverage rate to a blockchain; when the coverage rate of the function is larger than or equal to a preset threshold value, determining that the quality of the target use case passes the verification; or when the coverage rate of the function is smaller than the preset threshold value, determining that the quality of the target use case does not pass the verification, and feeding back the quality of the target use case to the designated terminal equipment.
2. The test data recording method as claimed in claim 1, wherein said determining whether to track said target request based on said target identification comprises:
calling a pre-configured global identification list, wherein identifications of all requests to be tracked are stored in the global identification list;
traversing the global identification list by the target identification;
when traversing in the global identity list to an identity matching the target identity, determining to track the target request.
3. The test data recording method as claimed in claim 1, wherein the test data recording method further comprises:
when it is determined not to track the target request and/or in response to the end recording instruction, the value of the request cookie is cleared.
4. The test data recording method as claimed in claim 1, wherein the test data recording method further comprises:
and when the target code function is monitored to be modified, feeding back the target use case to the appointed terminal equipment as a to-be-returned use case.
5. A test data recording device for implementing the test data recording method according to claim 1, the test data recording device comprising:
The interception unit is used for responding to the test data recording instruction and intercepting each request of the test system by adopting an Agent technology;
the acquisition unit is used for acquiring a target identifier of each intercepted target request, wherein the target identifier is used for determining a target use case corresponding to the target request;
a determining unit, configured to determine whether to track the target request according to the target identifier;
a configuration unit, configured to configure a tracking ID for the target request and set an internal variable in an execution thread of the target request when it is determined to track the target request;
a recording unit, configured to record variable values of the internal variables according to the tracking ID using a byte code enhancement technique;
the establishing unit is used for responding to the recording ending instruction, acquiring an object code function from the variable value, and establishing an object corresponding relation according to the object code function and the object identifier;
and the storage unit is used for storing the target corresponding relation and the variable value into a database.
6. An electronic device, the electronic device comprising:
a memory storing at least one instruction; and
A processor executing instructions stored in the memory to implement the test data recording method of any one of claims 1 to 4.
7. A computer-readable storage medium, characterized by: the computer-readable storage medium has stored therein at least one instruction that is executed by a processor in an electronic device to implement the test data recording method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010968254.8A CN112015663B (en) | 2020-09-15 | 2020-09-15 | Test data recording method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010968254.8A CN112015663B (en) | 2020-09-15 | 2020-09-15 | Test data recording method, device, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112015663A CN112015663A (en) | 2020-12-01 |
CN112015663B true CN112015663B (en) | 2024-03-15 |
Family
ID=73521560
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010968254.8A Active CN112015663B (en) | 2020-09-15 | 2020-09-15 | Test data recording method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112015663B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112416798B (en) * | 2020-12-04 | 2024-04-09 | 深圳前海微众银行股份有限公司 | Data processing method, device, equipment and storage medium |
CN112749094B (en) * | 2021-01-14 | 2025-02-18 | 中国工商银行股份有限公司 | Test case generation method and device |
CN113157592A (en) * | 2021-05-24 | 2021-07-23 | 杭州笨马网络技术有限公司 | Visual defect positioning method |
CN116166409A (en) * | 2021-11-25 | 2023-05-26 | 中移(苏州)软件技术有限公司 | Resource creation method and device, electronic equipment and storage medium |
CN115712243B (en) * | 2022-11-04 | 2024-07-09 | 北京和利时工业软件有限公司 | Correction method, device, equipment and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102855179A (en) * | 2011-06-30 | 2013-01-02 | 国际商业机器公司 | Program debugging method and system in virtual machine environment |
CN110489315A (en) * | 2019-07-18 | 2019-11-22 | 威富通科技有限公司 | A kind of tracking of operation requests, tracking device and server |
CN110874324A (en) * | 2019-10-14 | 2020-03-10 | 平安普惠企业管理有限公司 | A method, device, terminal device and storage medium for saving test result data |
CN111400189A (en) * | 2020-03-25 | 2020-07-10 | 平安银行股份有限公司 | Code coverage monitoring method, device, electronic device and storage medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7047521B2 (en) * | 2001-06-07 | 2006-05-16 | Lynoxworks, Inc. | Dynamic instrumentation event trace system and methods |
US10031841B2 (en) * | 2013-06-26 | 2018-07-24 | Sap Se | Method and system for incrementally updating a test suite utilizing run-time application executions |
-
2020
- 2020-09-15 CN CN202010968254.8A patent/CN112015663B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102855179A (en) * | 2011-06-30 | 2013-01-02 | 国际商业机器公司 | Program debugging method and system in virtual machine environment |
CN110489315A (en) * | 2019-07-18 | 2019-11-22 | 威富通科技有限公司 | A kind of tracking of operation requests, tracking device and server |
CN110874324A (en) * | 2019-10-14 | 2020-03-10 | 平安普惠企业管理有限公司 | A method, device, terminal device and storage medium for saving test result data |
CN111400189A (en) * | 2020-03-25 | 2020-07-10 | 平安银行股份有限公司 | Code coverage monitoring method, device, electronic device and storage medium |
Non-Patent Citations (1)
Title |
---|
基于JTest的自动化单元测试技术;高远;杨欣;李凯;;指挥信息系统与技术(第04期);第95-99页 * |
Also Published As
Publication number | Publication date |
---|---|
CN112015663A (en) | 2020-12-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112015663B (en) | Test data recording method, device, equipment and medium | |
CN113392090B (en) | Data verification method, device, equipment and medium based on database migration | |
CN113468049B (en) | Configurable interface-based test method, device, equipment and medium | |
CN111277626B (en) | Server upgrading method and device, electronic equipment and medium | |
CN114185776B (en) | Big data tracking method, device, equipment and medium for application | |
CN111949708A (en) | Multi-task prediction method, device, equipment and medium based on time sequence feature extraction | |
CN112948275A (en) | Test data generation method, device, equipment and storage medium | |
CN112287318B (en) | Cross-application login method, device, equipment and medium | |
CN114385453A (en) | Database cluster exception handling method, device, equipment and medium | |
CN112667244B (en) | Data verification method, device, electronic equipment and computer readable storage medium | |
CN114116400A (en) | Application exception handling method, device, equipment and medium based on log printing | |
CN111694843B (en) | Missing number detection method and device, electronic equipment and storage medium | |
CN114666408B (en) | Market condition factor data transparent transmission method, device, equipment and medium based on Internet | |
CN113505079A (en) | Application program testing method, device, equipment and medium | |
CN116306591B (en) | Flow form generation method, device, equipment and medium | |
CN114036068B (en) | Update detection method, device, equipment and storage medium based on privacy security | |
CN114185502B (en) | Log printing method, device, equipment and medium based on production line environment | |
CN117576721A (en) | Visitor management method, device, equipment and medium for appointed personnel | |
CN112634045B (en) | Data processing method, device, electronic equipment and storage medium | |
CN113360398A (en) | Hybrid application program testing method, device, equipment and medium | |
CN112000945B (en) | Authorization method, device, equipment and medium based on artificial intelligence | |
CN118503141B (en) | Test case generation method, device, equipment and medium | |
CN118820005B (en) | A PC-based BMC data IPMI remote management method and system | |
CN116414366B (en) | Middleware interface generation method, device, equipment and medium | |
CN117316359B (en) | Blood detection process tracking method, device, equipment and medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |