CN111930612B - Code updating correctness detection method and device and computing equipment - Google Patents

Code updating correctness detection method and device and computing equipment Download PDF

Info

Publication number
CN111930612B
CN111930612B CN202010659335.XA CN202010659335A CN111930612B CN 111930612 B CN111930612 B CN 111930612B CN 202010659335 A CN202010659335 A CN 202010659335A CN 111930612 B CN111930612 B CN 111930612B
Authority
CN
China
Prior art keywords
response message
key
difference
type
differences
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
Application number
CN202010659335.XA
Other languages
Chinese (zh)
Other versions
CN111930612A (en
Inventor
王虹艺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pierbulaini Software Co ltd
Original Assignee
Beijing Pierbulaini Software Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Pierbulaini Software Co ltd filed Critical Beijing Pierbulaini Software Co ltd
Priority to CN202010659335.XA priority Critical patent/CN111930612B/en
Publication of CN111930612A publication Critical patent/CN111930612A/en
Application granted granted Critical
Publication of CN111930612B publication Critical patent/CN111930612B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Computer Security & Cryptography (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Quality & Reliability (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)
  • Input From Keyboards Or The Like (AREA)

Abstract

The invention discloses a method for detecting the correctness of code updating, which comprises the following steps: acquiring a first response message and a second response message from an operating environment where a previous code is deployed, and acquiring a third response message from the operating environment where an update code is deployed; comparing the first response message with the third response message to obtain a first difference set; determining first, second and third types of differences; determining that the update code is in error when the first set of differences includes a first type of difference and/or a second type of difference; and when the first set of differences includes only the third type of differences: comparing the first response message with the second response message to obtain a second difference set, and acquiring a third type difference key-value pair from the second difference set; removing key-value pairs corresponding to the acquired differential key-value pairs from the third type of differences; if the removed third type of differences do not include any key-value pairs, then the update code is free of errors.

Description

Code updating correctness detection method and device and computing equipment
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a method and apparatus for detecting code update correctness, and a computing device.
Background
Along with the rapid development of network technology, the speed of software updating iteration is also faster, and the test of the updating code is performed when the software updating iteration is performed, so that the method is a key link for guaranteeing the reliability and stability of the software after the updating iteration. At present, the update codes are tested through a regression test, wherein the regression test is to replay the grabbed online/offline traffic to the running environment where the update codes and the previous codes are deployed, and the HTTP response messages obtained from the previous code running environment are used as a basis to be manually compared with the HTTP response messages obtained from the update code running environment to obtain differences, and whether the new codes have problems is judged based on the differences of the two HTTP response messages.
The current method for manually comparing the difference between the HTTP response message obtained by the previous code running environment and the HTTP response message obtained by updating the code running environment comprises the following steps: manually configuring fields of response messages which need to be ignored in advance in the test system, and ignoring differences corresponding to the configured fields when comparing HTTP response messages obtained in the previous code running environment with HTTP response messages obtained in the new code running environment; or manually carrying out regular replacement configuration on partial fields in the HTTP response message to be ignored, and when manually comparing the HTTP response message obtained from the previous code running environment with the HTTP response message obtained from the updated code running environment, replacing the difference matched by the regular expression with the same value and then comparing. However, the method of neglecting the field corresponding difference to judge the correctness of the updated code when manually pre-configuring the comparison is cumbersome and time-consuming.
For this reason, a new method for detecting the correctness of code update is needed to solve the problems in the above technical solution.
Disclosure of Invention
Accordingly, the present invention provides a method, system, and computing device for detecting correctness of code update, so as to solve or at least alleviate the above problems.
According to one aspect of the present invention, there is provided a method of detecting correctness of code update, executed in a computing device having deployed therein an execution environment running a previous code and an updated code, the method comprising:
acquiring a first response message and a second response message from the running environment deployed with the previous code, and acquiring a third response message from the running environment deployed with the updated code, wherein the first, second and third response messages comprise one or more key-value pairs;
comparing the first response message with the third response message to obtain a first difference set;
determining a first, second, and third type of differences, the first type of differences comprising key-value pairs in which a key is present in the first response message and a third response message is absent, the second type of differences comprising key-value pairs in which a key is absent in the first response message and a third response message is present, and the third type of differences comprising key-value pairs in which a key is present in both the first and third response messages and corresponding key values are inconsistent in the first response message and the third response message;
Determining that the update code is in error when the first set of differences includes a first type of difference and/or a second type of difference; and
when the first set of differences includes only differences of a third type:
comparing the first response message with the second response message to obtain a second difference set, and acquiring a difference key-value pair, of which keys exist in the first response message and the second response message and corresponding key values are inconsistent in the first response message and the second response message, from the second difference set;
removing key-value pairs corresponding to the acquired difference key-value pairs from the third type of difference; and
if the removed third type of differences do not include any key-value pairs, then the update code is free of errors.
Optionally, the comparing the first response message with the third response message to obtain a first difference set includes:
extracting paths and values corresponding to all nodes from the first response message, wherein the nodes comprise leaf nodes;
taking the path corresponding to each node as a key and taking the value as a key value to form a key-value pair, and taking one or more obtained key-value pairs as a first set;
extracting paths and values corresponding to all nodes from the third response message, wherein the nodes comprise leaf nodes;
Taking the path corresponding to each node as a key and taking the value as a key value to form a key-value pair, and taking one or more obtained key-value pairs as a third set;
and comparing the first set with the third set in a cooperative manner to obtain the first difference set.
Optionally, the method further comprises:
sorting key values of partial key-value pairs in the first response message, the second response message and the third response message to obtain the sorted first response message, second response message and third response message;
comparing the ordered first response message with the third response message to obtain a new first difference set, wherein the new first difference set only comprises third type differences, and the third type differences in the new first difference set are different from the third type differences in the first difference set.
Optionally, the sorting the key values of the partial key-value pairs in the first response message, the second response message, and the third response message includes:
partial key-value pairs are taken out from the first response message, the second response message and the third response message;
sorting the key values of the extracted partial key-value pairs to obtain sorted partial key-value pairs;
And replacing the sequenced partial key-value pairs with positions corresponding to the first response message, the second response message and the third response message to take out the partial key-value pairs.
Optionally, the comparing the first response message with the second response message to obtain a second difference set includes:
comparing the sequenced first response message with the second response message to obtain a new second difference set;
and acquiring a difference key-value pair, of which keys exist in the first response message and the second response message and corresponding key values are inconsistent in the first response message and the second response message, from the new second difference set as a new difference key-value pair.
Optionally, the removing key-value pairs corresponding to the acquired difference key-value pairs from the third type difference includes:
removing key-value pairs corresponding to the acquired new differential key-value pairs from the third type of differences of the new first set of differences.
Optionally, the first response message and the second response message are acquired from the running environment deployed with the previous code, and the third response message is acquired from the running environment deployed with the updated code in the following order:
Acquiring a first response message from a running environment deployed with previous codes;
acquiring a third response message from the running environment deployed with the update code; and
a second response message is obtained from the runtime environment in which the previous code was deployed.
According to one aspect of the present invention, there is provided a code update correctness detection apparatus for execution in a computing device having disposed therein an execution environment in which a previous code and an updated code are executed, the apparatus comprising:
the system comprises an acquisition module, a first response message acquisition module, a second response message acquisition module and a third response message acquisition module, wherein the acquisition module acquires a first response message and a second response message from an operation environment deployed with a previous code, and acquires a third response message from the operation environment deployed with an updated code, and the first response message, the second response message and the third response message all comprise one or more key-value pairs;
the comparison module is used for comparing the first response message with the third response message to obtain a first difference set; and when the first set of differences includes only differences of a third type: comparing the first response message with the second response message through the comparison module to obtain a second difference set, wherein a difference key-value pair, of which keys exist in the first response message and the second response message and corresponding key values are inconsistent in the first response message and the second response message, is obtained from the second difference set and is used as a first key value pair;
A difference type determining module that determines, by the difference type determining module, first, second, and third type differences, the first type difference comprising a key-value pair in which a key is present in the first response message and a key is not present in the third response message, the second type difference comprising a key-value pair in which a key is not present in the first response message and a key-value is not present in the third response message, and the third type difference comprising a key-value pair in which a key is present in both the first and third response messages and a corresponding key value is inconsistent in the first response message and the third response message;
a judging module, when the first difference set comprises a first type difference and/or a second type difference, determining that the update code has an error through the judging module; and if the removed third type difference does not comprise any key-value pair, judging that the updating code has no error by the judging module.
A removal module that, when the first set of differences includes only third type differences: and removing key-value pairs corresponding to the acquired difference key-value pairs from the third type difference by the removing module.
According to one aspect of the present invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method as described above.
According to an aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a mobile terminal, cause the mobile terminal to perform the method as described above.
According to the technical scheme of the invention, a method for detecting the code updating correctness is provided, a first difference set is obtained by comparing a response message obtained by running a previous code for the first time with a response message obtained by running an updating code for the first time, and then the difference between the response messages obtained by running the previous code for the first time and the second time is removed from the first difference set, so that the difference is compared for two times, the difference d method for the two times can eliminate the difference caused by a time stamp and the like, and the situation that the error occurs to the correctness judgment of the updating code due to the difference caused by the time stamp and the like can be eliminated, and whether the code deployment has errors can be better determined.
Secondly, the method for comparing the differences twice is simple to realize, can automatically classify the difference items, can automatically identify the differences called noise, and automatically filters the differences identified as noise in the process of testing the updated codes, so that manual pre-configuration is not needed, the efficiency of judging whether the updated codes are correct is greatly improved, and manual neglected configuration of partial nodes in the response message can be overlapped on the basis.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above, as well as additional objects, features, and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention;
FIG. 2 illustrates a schematic diagram of a method 200 for detecting correctness of a code update according to an embodiment of the invention;
FIG. 3 illustrates a flow chart of a first difference set determination method 300 according to one embodiment of the invention;
FIG. 4 is a schematic diagram of a method 400 for detecting correctness of code update according to another embodiment of the present invention;
fig. 5 shows a schematic diagram of a code update correctness detection apparatus 500 according to an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
For update iterations of software, it is a common practice to improve the performance of the software. In the prior art, the reliability and stability of the software after updating iteration are ensured mainly by testing the updating code. At present, correctness of an updated code is judged through a regression test, wherein the regression test is to replay the grabbed online/offline traffic to an operating environment where a new code and a previous code are deployed, and the HTTP response message obtained from the previous code operating environment is used as a basis to be manually compared with the HTTP response message obtained from the new code operating environment to obtain a difference, and whether the new code has a problem is judged based on the difference between the two HTTP response messages.
The differences between the HTTP response message obtained by the previous code running environment and the HTTP response message obtained by the new code running environment comprise the following four types of differences: 1) The key-value pairs in the two response messages differ in key value (value), e.g., timestamp class field, and such differences are not due to code updates, are negligible in updating code testing, and are therefore referred to as noise differences when comparing messages; 2) The keys of the two message key-value pairs are different, when the difference appears, the updating code is judged to have errors, and when the messages are compared, the difference cannot be ignored; 3) The number or sequence of the values of the key-value pairs in the two messages are different, the differences are not caused by code updating, the differences can be ignored in the updating code testing process, and the differences are also called noise differences when the messages are compared; 4) The response codes and/or the response heads of the two response messages are different, when such differences occur, the update codes are judged to have errors, and when the messages are compared, the differences cannot be ignored.
Since the difference of noise is not caused by updating codes, the noise difference is more when the difference is compared, and the comparison efficiency is reduced, so that in order to improve the detection efficiency of the code updating accuracy at present, before the updating codes are tested, the fields in the response message which need to be ignored when compared are manually preconfigured, so as to filter the difference corresponding to the fields in the testing process, namely, the 1) and 3) differences are filtered as much as possible when the updating codes are tested, and whether the updating codes are correct is judged based on the difference obtained by testing.
However, the above-mentioned manual configuration of the fields to be ignored when comparing the response messages is cumbersome and time-consuming, and the filtering is considered as a poor difference effect of noise. Accordingly, in order to solve the above-mentioned problems, the present invention proposes a method for detecting the correctness of code update, which is executed in the computing device 100, and the computing device 100 is deployed with an execution environment that executes the previous code and the updated code, that is, an application that can execute the previous code and the updated code is deployed in the computing device 100.
In the invention, by replaying the grabbed online/offline traffic to the running environment of the computing device 100 where the previous code and the update code are deployed, replaying the online/offline traffic twice to the running environment where the previous code is deployed to obtain a first response message and a second response message corresponding to the previous code, replaying the online/offline traffic once to the running environment where the update code is deployed to obtain a third response message corresponding to the update code, comparing the first response message with the third response message to obtain a first difference set, and determining that the update code has an error when the first difference set comprises a first type difference and/or a second type difference based on three predetermined difference types, and when the first difference set only comprises a third type difference: comparing the first response message with the second response message to obtain a second difference set, acquiring a difference key-value pair of which keys exist in the first response message and the second response message and corresponding key values are inconsistent in the first response message and the second response message from the second difference set, removing the key-value pair corresponding to the acquired difference key-value pair from the third type difference, and updating the code correctly if the removed third type difference does not comprise any key-value pair. According to the method, the difference items can be automatically classified, the difference called noise can be automatically identified, the identified difference called noise can be automatically filtered in the process of testing the updated code, particularly, the difference of the timestamp fields can be 100% filtered, the implementation is simple, manual pre-configuration is not needed, and the efficiency of judging whether the updated code is correct or not is greatly improved.
FIG. 1 illustrates a block diagram of a computing device 100 according to one embodiment of the invention. As shown in FIG. 1, in a basic configuration 102, a computing device 100 typically includes a system memory 106 and one or more processors 104. The memory bus 108 may be used for communication between the processor 104 and the system memory 106.
Depending on the desired configuration, the processor 104 may be any type of processing including, but not limited to: a microprocessor (μp), a microcontroller (μc), a digital information processor (DSP), or any combination thereof. The processor 104 may include one or more levels of caches, such as a first level cache 110 and a second level cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations, the memory controller 118 may be an internal part of the processor 104.
Depending on the desired configuration, system memory 106 may be any type of memory including, but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. The system memory 106 may include an operating system 120, one or more applications 122, and program data 124. The application 122 is actually a plurality of program instructions for instructing the processor 104 to perform a corresponding operation. In some implementations, the application 122 may be arranged to cause the processor 104 to operate with the program data 124 on an operating system.
Computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to basic configuration 102 via bus/interface controller 130. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices such as a display or speakers via one or more a/V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via one or more communication ports 164 over a network communication link.
The network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media in a modulated data signal, such as a carrier wave or other transport mechanism. A "modulated data signal" may be a signal that has one or more of its data set or changed in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or special purpose network, and wireless media such as acoustic, radio Frequency (RF), microwave, infrared (IR) or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In the computing device 100 according to the present invention, the application 122 includes a plurality of program instructions for detecting the correctness of the code update, which may instruct the processor 104 to execute a method 200 for detecting the correctness of the code update according to the present invention, so that the computing device 100 automatically filters noise differences by executing a method 200 for detecting the correctness of the code update according to the present invention, thereby efficiently determining whether the updated code has errors.
Fig. 2 shows a schematic flow chart of a method 200 of detecting the correctness of a code update in a picture set according to an embodiment of the invention. The method 200 may be performed in an application of the computing device 100.
As shown in fig. 2, the method starts at step S210. In step S210, a first response message and a second response message are acquired from the running environment in which the previous code is deployed, and a third response message is acquired from the running environment in which the update code is deployed. It can be understood that the present invention operates the previous code twice in the operating environment where the previous code is deployed, thereby obtaining the first response message and the second response message, and operates the update code once in the operating environment where the update code is deployed, thereby obtaining the third response message. And one or more key-value pairs are included in each of the first, second and third response messages.
After the response message corresponding to the previous code and the response message corresponding to the update code are obtained, the difference between the two messages needs to be compared to determine the correctness of the update code. Subsequently, in step S220, the first response message is compared with the third response message to obtain a first difference set. The chart 300 is a flowchart of a first difference set determining method, and the first difference set determining method 300 starts in step S310. In step S310, paths and values corresponding to all nodes are extracted from the first response message, and since the response message stores the parameters in the json text, paths and values corresponding to all nodes are extracted from the json text of the first response message, and the nodes include leaf nodes.
Then in step S320, a path corresponding to each node is used as a key, and a value is used as a key value to form a key-value pair, and the obtained one or more key-value pairs are used as a first set.
After the first set is determined, in step S330, paths and values corresponding to all nodes are extracted from the third response message, and further, paths and values corresponding to all nodes are extracted from json text of the third response message.
Next, in step S340, a path corresponding to each node is used as a key, and a value is used as a key value to form a key-value pair, and the obtained one or more key-value pairs are used as a third set.
After the first set and the third set are determined, in step S350, the first set and the third set are compared cooperatively to obtain a first difference set. In one embodiment of the present invention, the first set and the third set are compared together by the method provided by com. In addition, in order to more clearly understand the difference between the json text of the response message and the first set or the third set, examples of the json text of the first response message and the first set are given below.
First response message json text:
first set example:
{
"/Noticelist":"null"
"/UserName": "old name"
"/SysName": management System "
"/LogoffUrl":"http://"
"/MessageUrl":"http://"
"/NavList/0/Url":"/passport/Home/Index"
"/NavList/0/Class":"nav-home"
"/NavList/0/Name": "front page"
"/NavList/0/CnName": "front page"
"/NavList/0/IsCurrent":"false"
"/NavList/0/IsNew":""
"/NavList/0/IsFloat":"false"
"/NavList/0/IsService":"false"
"/NavList/0/OrderNum":"0.0"
}
Based on the comparison of the json text of the first response message and the first set, it can be seen that all nodes in the first set are of the same level, and all key-value pairs are of the same level, so that the differences between the first set and the third set can be conveniently compared, and the first difference set can be conveniently determined.
Since it is necessary to filter out the noise difference in the first difference set and thus to eliminate the influence of the noise difference on judging whether the update code is correct, it is necessary to define the difference type and thus to determine the difference type in the first difference set. Next in step S230, the first, second and third type differences are determined. In one embodiment of the invention, the first type of difference is defined to include a key-value pair in which a key is present in the first response message and not in the third response message, the second type of difference includes a key-value pair in which a key is not present in the first response message and is present in the third response message, and the third type of difference includes a key-value pair in which a key is present in both the first and third response messages and corresponding key values are inconsistent in the first and third response messages, the third type of difference being the 1) type of difference described above, i.e., a difference considered noise.
By defining the difference types in the above manner, the difference type in the first difference set can be determined, and then whether the update code is correct or not can be judged, next in step S240, when the first difference set includes the first type difference and/or the second type difference, it is determined that the update code is incorrect, and when the first difference set does not include any difference, the update code is correct, however in step S250, when the first difference set includes only the third type difference, in step S260, the first response message is compared with the second response message to obtain the second difference set, and a difference key-value pair in which the keys exist in both the first and second response messages and the corresponding key values are inconsistent in the first response message and the second response message is obtained from the second difference set. Subsequently, in step S270, key-value pairs corresponding to the acquired difference key-value pairs are removed from the third type difference. Next in step S280, if the removed third type of difference does not include any key-value pairs, the update code is free of errors.
However, when there is a second level timestamp at the interface of the computing device 100, there may be a case where the timestamp is unchanged within 1 second for two previous code running environments due to the short response time, and the timestamp difference (i.e., the type 1 difference described above) cannot be identified as the third type difference of the second difference set. When the code running environment is requested to be updated, the timestamp change causes the timestamp difference to be included in the third type of difference of the first difference set, and after the key-value pair corresponding to the acquired difference key-value pair is removed from the third type of difference, the timestamp difference still exists in the third type of difference, and the computing device 100 can make a judgment that the updated code is wrong, but in fact, the timestamp difference is not caused by the code update, so that a misjudgment occurs.
In order to solve the above-mentioned problems, in one embodiment of the present invention, a first response message and a second response message are acquired from a running environment in which a previous code is deployed, and a third response message is acquired from a running environment in which an update code is deployed, in the following order: the method includes the steps of obtaining a first response message from a running environment in which previous codes are deployed, obtaining a third response message from the running environment in which updated codes are deployed, and obtaining a second response message from the running environment in which the previous codes are deployed.
Thus, if the timestamp of the previous code is changed for two requests, it is identified as a difference, and if the timestamp of the previous code is unchanged for two requests, then time is elapsed, the timestamp of the update code of the intermediate request is necessarily identical, and after the key-value pair corresponding to the acquired difference key-value pair is removed from the third type difference, there is no timestamp difference in the third type difference, so that a misjudgment situation does not occur.
According to the method, the difference items can be automatically classified, the difference called noise can be automatically identified, the identified difference called noise can be automatically filtered in the process of testing the update codes, particularly, the difference of the timestamp fields can be 100% filtered, the implementation is simple, manual pre-configuration is not needed, the efficiency of judging whether the update codes are correct is greatly improved, and manual neglected configuration of partial nodes in the response message can be overlapped on the basis.
Since the third type difference of the first difference set may include 1) type differences and 3) type differences, in another embodiment of the present invention, on the basis of the method 200 for detecting the correctness of code update, the content of the response message corresponding to 3) type differences is configured in advance, so as to filter all 1) type differences and 3) type differences that may be included in the third type difference during the test. The diagram 400 is a schematic diagram of a method for detecting code update correctness according to another embodiment of the present invention, and the method 400 for detecting code update correctness starts in step S401 and ends in step S410. The steps S401 to S405 are the same as the steps S210 to S250, and are not repeated here, and the steps S406 to S410 are described next.
It is determined in step S405 that when the first set of differences includes only the third type of differences: in step S406, the key values of part of the key-value pairs in the first response message, the second response message and the third response message are ordered, so as to obtain the ordered first response message, second response message and third response message. For example, a designated child node (key of a key-value pair) is extracted from 3 response messages, if the child node is not an array, the child node ignores the child node, if the child node is an array, text ordering is performed on a first layer element (key value corresponding to the key) in the child node, then the child node and the corresponding ordered first layer element (ordered key-value pair) are put back to a position corresponding to an atomic node of json text and the corresponding first layer element, so that when the ordered response messages are compared, 3) type differences regarded as noise are filtered, and misjudgment that update codes exist due to different sequences of the factors is avoided. However, the present invention is not limited to the above method, and any method capable of ordering the key-value pairs in the first response message, the second response message, and the third response message is within the scope of the present invention.
Then in step S407, the sorted first response message is compared with the third response message to obtain a new first difference set. Wherein the new first set of differences comprises only third type differences and 3) type differences of the third type differences in the new first set of differences are filtered out, and therefore the third type differences in the new first set of differences comprises only 1) type differences, the third type differences in the new first set of differences being different from the third type differences in the first set of differences.
After the first difference set is determined, in step S408, the sorted first response message is compared with the second response message to obtain a new second difference set, and a difference key-value pair whose key exists in both the first and second response messages and whose corresponding key value is inconsistent in the first and second response messages is obtained from the new second difference set as a new difference key-value pair, and in step S409, a key-value pair corresponding to the obtained new difference key-value pair is removed from the third type difference of the new first difference set. Next in step S410, if the third type of differences of the removed new first set of differences does not comprise any key-value pairs, the update code is free of errors.
According to the method, the difference items can be automatically classified, so that the difference called noise can be automatically identified, all the differences regarded as noise can be automatically filtered in the process of testing the updated code, the implementation is simple, manual pre-configuration is not needed, and the efficiency of judging whether the updated code is correct or not is greatly improved.
Fig. 5 shows a schematic diagram of a code update correctness detection apparatus 500 according to an embodiment of the invention. The code update correctness detection apparatus 500 is adapted to perform the code update correctness detection method 200 of the present invention. The code update correctness detection apparatus 500 resides in the computing device 100, so that the computing device 100 executes the code update correctness detection method 200 of the present invention.
As shown in fig. 5, the device 500 for detecting the correctness of code update includes an acquisition module 510, a comparison module 520, a difference type determination module 530, a judgment module 540, and a removal module 550.
According to one embodiment, a first response message and a second response message are acquired from a running environment deployed with previous code and a third response message is acquired from a running environment deployed with updated code by an acquisition module 510, wherein the first, second and third response messages each comprise one or more key-value pairs;
According to one embodiment, the comparison module 520 compares the first response message with the third response message to obtain a first difference set; and when the first set of differences includes only differences of a third type: comparing the first response message with the second response message through a comparison module 520 to obtain a second difference set, wherein a difference key-value pair, in which keys exist in both the first and second response messages and corresponding key values are inconsistent in the first response message and the second response message, is obtained from the second difference set and is used as a first key value pair;
according to one embodiment, first, second, and third type differences are determined by the difference type determination module 530, the first type difference comprising a key-value pair in which a key is present in the first response message and not in the third response message, the second type difference comprising a key-value pair in which a key is not present in the first response message and is present in the third response message, and the third type difference comprising a key-value pair in which a key is present in both the first and third response messages and corresponding key values are inconsistent in the first response message and the third response message;
according to one embodiment, when the first set of differences includes a first type of difference and/or a second type of difference, determining, by the decision module 540, that the update code is in error; and if the removed third type of difference does not include any key-value pairs, determining, by the determining module 540, that the update code is free of errors.
According to one embodiment, when the first set of differences comprises only differences of a third type: key-value pairs corresponding to the acquired differential key-value pairs are removed from the third type of differential by a removal module 550.
It should be noted that, the obtaining module 510 is specifically configured to perform the method of step S210, the comparing module 520 is specifically configured to perform the method of steps S220 and S250-S260, the difference type determining module 530 is specifically configured to perform the method of step S230, the determining module 540 is specifically configured to perform the method of steps S240 and S280, the removing module 550 is specifically configured to perform the method of step S270, and the processing logic and functions of the obtaining module 510, the comparing module 520, the difference type determining module 530, the determining module 540 and the removing module 550 can be referred to the relevant descriptions of steps S210-S280. Likewise, the code update correctness checking apparatus 500 is adapted to execute the code update correctness checking method 400 according to another embodiment of the present invention, which is not described herein.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U-drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the mobile terminal will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the code update correctness detection method of the invention according to instructions in said program code stored in the memory.
By way of example, and not limitation, readable media comprise readable storage media and communication media. The readable storage medium stores information such as computer readable instructions, data structures, program modules, or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.

Claims (10)

1. A method of detecting correctness of code updates, performed in a computing device having deployed therein an execution environment that executes previous code and updated code, the method comprising:
acquiring a first response message and a second response message from the running environment deployed with the previous code, and acquiring a third response message from the running environment deployed with the updated code, wherein the first, second and third response messages comprise one or more key-value pairs;
comparing the first response message with the third response message to obtain a first difference set;
determining a first, second, and third type of differences, the first type of differences comprising key-value pairs in which a key is present in the first response message and a third response message is absent, the second type of differences comprising key-value pairs in which a key is absent in the first response message and a third response message is present, and the third type of differences comprising key-value pairs in which a key is present in both the first and third response messages and corresponding key values are inconsistent in the first response message and the third response message;
determining that the update code is in error when the first set of differences includes a first type of difference and/or a second type of difference; and
When the first set of differences includes only differences of a third type:
comparing the first response message with the second response message to obtain a second difference set, and acquiring a difference key-value pair, of which keys exist in the first response message and the second response message and corresponding key values are inconsistent in the first response message and the second response message, from the second difference set;
removing key-value pairs corresponding to the acquired difference key-value pairs from the third type of difference; and
if the removed third type of differences do not include any key-value pairs, then the update code is free of errors.
2. The method of claim 1, wherein comparing the first response message with the third response message to obtain a first set of differences comprises:
extracting paths and values corresponding to all nodes from the first response message, wherein the nodes comprise leaf nodes;
taking the path corresponding to each node as a key and taking the value as a key value to form a key-value pair, and taking one or more obtained key-value pairs as a first set;
extracting paths and values corresponding to all nodes from the third response message, wherein the nodes comprise leaf nodes;
Taking the path corresponding to each node as a key and taking the value as a key value to form a key-value pair, and taking one or more obtained key-value pairs as a third set;
and comparing the first set with the third set in a cooperative manner to obtain the first difference set.
3. The method of claim 1, the method further comprising:
sorting key values of partial key-value pairs in the first response message, the second response message and the third response message to obtain the sorted first response message, second response message and third response message;
comparing the ordered first response message with the third response message to obtain a new first difference set, wherein the new first difference set only comprises third type differences, and the third type differences in the new first difference set are different from the third type differences in the first difference set.
4. The method of claim 3, wherein the ordering key values of partial key-value pairs in the first, second, and third response messages comprises:
partial key-value pairs are taken out from the first response message, the second response message and the third response message;
Sorting the key values of the extracted partial key-value pairs to obtain sorted partial key-value pairs;
and replacing the sequenced partial key-value pairs with positions corresponding to the first response message, the second response message and the third response message to take out the partial key-value pairs.
5. The method of claim 3 or 4, wherein comparing the first response message with the second response message to obtain a second set of differences comprises:
comparing the sequenced first response message with the second response message to obtain a new second difference set;
and acquiring a difference key-value pair, of which keys exist in the first response message and the second response message and corresponding key values are inconsistent in the first response message and the second response message, from the new second difference set as a new difference key-value pair.
6. The method of claim 5, wherein the removing key-value pairs corresponding to the acquired difference key-value pairs from the third type of difference comprises:
removing key-value pairs corresponding to the acquired new differential key-value pairs from the third type of differences of the new first set of differences.
7. The method of any of claims 1 to 6, wherein the first response message and the second response message are obtained from the execution environment in which the previous code is deployed, and the third response message is obtained from the execution environment in which the update code is deployed, in the following order:
Acquiring a first response message from a running environment deployed with previous codes;
acquiring a third response message from the running environment deployed with the update code; and
a second response message is obtained from the runtime environment in which the previous code was deployed.
8. A code update correctness detection apparatus for execution in a computing device having deployed therein an execution environment that executes a previous code and an updated code, the apparatus comprising:
the system comprises an acquisition module, a first response message acquisition module, a second response message acquisition module and a third response message acquisition module, wherein the acquisition module acquires a first response message and a second response message from an operation environment deployed with a previous code, and acquires a third response message from the operation environment deployed with an updated code, and the first response message, the second response message and the third response message all comprise one or more key-value pairs;
the comparison module is used for comparing the first response message with the third response message to obtain a first difference set; and when the first set of differences includes only differences of a third type: comparing the first response message with the second response message through the comparison module to obtain a second difference set, wherein a difference key-value pair, of which keys exist in the first response message and the second response message and corresponding key values are inconsistent in the first response message and the second response message, is obtained from the second difference set and is used as a first key value pair;
A difference type determining module that determines, by the difference type determining module, first, second, and third type differences, the first type difference comprising a key-value pair in which a key is present in the first response message and a key is not present in the third response message, the second type difference comprising a key-value pair in which a key is not present in the first response message and a key-value is not present in the third response message, and the third type difference comprising a key-value pair in which a key is present in both the first and third response messages and a corresponding key value is inconsistent in the first response message and the third response message;
a judging module, when the first difference set comprises a first type difference and/or a second type difference, determining that the update code has an error through the judging module; and if the removed third type difference does not comprise any key-value pairs, judging that the update code has no error by the judging module;
a removal module that, when the first set of differences includes only third type differences: and removing key-value pairs corresponding to the acquired difference key-value pairs from the third type difference by the removing module.
9. A computing device, comprising:
at least one processor; and
A memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-7.
10. A readable storage medium storing program instructions which, when read and executed by a mobile terminal, cause the mobile terminal to perform the method of any of claims 1-7.
CN202010659335.XA 2020-07-09 2020-07-09 Code updating correctness detection method and device and computing equipment Active CN111930612B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010659335.XA CN111930612B (en) 2020-07-09 2020-07-09 Code updating correctness detection method and device and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010659335.XA CN111930612B (en) 2020-07-09 2020-07-09 Code updating correctness detection method and device and computing equipment

Publications (2)

Publication Number Publication Date
CN111930612A CN111930612A (en) 2020-11-13
CN111930612B true CN111930612B (en) 2024-03-19

Family

ID=73312269

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010659335.XA Active CN111930612B (en) 2020-07-09 2020-07-09 Code updating correctness detection method and device and computing equipment

Country Status (1)

Country Link
CN (1) CN111930612B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113791983A (en) * 2021-09-24 2021-12-14 北京顺源开华科技有限公司 Application code testing method and device and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106569844A (en) * 2016-09-23 2017-04-19 北京五八信息技术有限公司 Processing method, processing device and equipment for program code update
CN108491331A (en) * 2018-04-13 2018-09-04 平安普惠企业管理有限公司 Method for testing software, device, equipment and computer storage media
CN108595200A (en) * 2018-04-19 2018-09-28 北京微播视界科技有限公司 Code update method, figure update method, device, storage medium and terminal
CN109271313A (en) * 2018-08-13 2019-01-25 中国平安财产保险股份有限公司 Code test method, device and computer readable storage medium
CN109460220A (en) * 2018-10-19 2019-03-12 泰康保险集团股份有限公司 The predefined code generating method of message, device, electronic equipment and storage medium
CN109710522A (en) * 2018-12-17 2019-05-03 平安普惠企业管理有限公司 Code test method, device, computer equipment and storage medium
US10635566B1 (en) * 2017-07-31 2020-04-28 Cisco Technology, Inc. Predicting code change impact within an integrated development environment
CN111209180A (en) * 2018-11-21 2020-05-29 中国移动通信集团浙江有限公司 Regression testing method and device based on fuzzy matching

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10795664B2 (en) * 2018-10-30 2020-10-06 Walmart Apollo, Llc Systems and methods for differential bundle updates

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106569844A (en) * 2016-09-23 2017-04-19 北京五八信息技术有限公司 Processing method, processing device and equipment for program code update
US10635566B1 (en) * 2017-07-31 2020-04-28 Cisco Technology, Inc. Predicting code change impact within an integrated development environment
CN108491331A (en) * 2018-04-13 2018-09-04 平安普惠企业管理有限公司 Method for testing software, device, equipment and computer storage media
CN108595200A (en) * 2018-04-19 2018-09-28 北京微播视界科技有限公司 Code update method, figure update method, device, storage medium and terminal
CN109271313A (en) * 2018-08-13 2019-01-25 中国平安财产保险股份有限公司 Code test method, device and computer readable storage medium
CN109460220A (en) * 2018-10-19 2019-03-12 泰康保险集团股份有限公司 The predefined code generating method of message, device, electronic equipment and storage medium
CN111209180A (en) * 2018-11-21 2020-05-29 中国移动通信集团浙江有限公司 Regression testing method and device based on fuzzy matching
CN109710522A (en) * 2018-12-17 2019-05-03 平安普惠企业管理有限公司 Code test method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111930612A (en) 2020-11-13

Similar Documents

Publication Publication Date Title
WO2018000607A1 (en) Method and electronic apparatus for identifying test case failure causes
US10185650B1 (en) Testing service with control testing
CN108304318B (en) Device compatibility testing method and terminal device
CN115039084A (en) Unit testing of components of a dataflow graph
CN111737137B (en) Interface test data generation method and device, host and storage medium
CN108875317B (en) Software clone detection method and device, detection equipment and storage medium
CN112379888B (en) Code change analysis method
CN111930612B (en) Code updating correctness detection method and device and computing equipment
CN112149136A (en) loT device firmware vulnerability detection method and system and electronic device
CN111309586A (en) Command testing method, device and storage medium thereof
CN111383704B (en) Built-in self-test circuit of memory and test method for memory
JP2020173650A (en) Program operation system, and program operation method
US20160306972A1 (en) Virus signature matching method and apparatus
CN110503504B (en) Information identification method, device and equipment of network product
CN111782504B (en) Application program abnormality diagnosis method, mobile terminal and readable storage medium
CN111371818B (en) Data request verification method, device and equipment
CN114611039A (en) Asynchronous loading rule analysis method and device, storage medium and electronic equipment
CN114518885A (en) Information collection method and device, electronic equipment and storage medium
CN114281691A (en) Test case sequencing method and device, computing equipment and storage medium
CN115016987B (en) Operating system checking method, computing device and storage medium
CN117114087B (en) Fault prediction method, computer device, and readable storage medium
US20230222276A1 (en) Programmatically generated reduced fault injections for functional safety circuits
CN115291957B (en) Initialization method and device of multiprocessor mainboard
JP6949440B2 (en) Vector generator and vector generator program
US11036613B1 (en) Regression analysis for software development and management using machine learning

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