CN112100070A - Version defect detection method and device, server and storage medium - Google Patents

Version defect detection method and device, server and storage medium Download PDF

Info

Publication number
CN112100070A
CN112100070A CN202010968510.3A CN202010968510A CN112100070A CN 112100070 A CN112100070 A CN 112100070A CN 202010968510 A CN202010968510 A CN 202010968510A CN 112100070 A CN112100070 A CN 112100070A
Authority
CN
China
Prior art keywords
field
service data
version
similarity
data
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.)
Withdrawn
Application number
CN202010968510.3A
Other languages
Chinese (zh)
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 Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology 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 Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202010968510.3A priority Critical patent/CN112100070A/en
Publication of CN112100070A publication Critical patent/CN112100070A/en
Withdrawn legal-status Critical Current

Links

Images

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/3692Test management for test results analysis
    • 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/368Test management for test version control, e.g. updating test cases to a new software version
    • 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
    • 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)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a method and a device for detecting version defects, a server and a storage medium, and belongs to the technical field of internet. The method comprises the following steps: comparing a first field in the first service data with a second field in the second service data; calculating the similarity between a first field and a second field with different fields; determining a comparison result of the first service data and the second service data according to the similarity calculation result; and detecting the version defects existing in the second version software according to the comparison result. According to the method and the device, when different fields exist in the first service data and the second service data, the result of direct comparison is not determined to be failed, the similarity among the different fields is calculated, the similar fields in the different fields are omitted through the similarity calculation, the difference among the different fields is reduced, the similar fields do not need to be eliminated through manual investigation, and the detection cost is reduced. In addition, the similar field is not used as a failure field any more, and the detection success rate is improved.

Description

Version defect detection method and device, server and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for detecting a version defect, a server, and a storage medium.
Background
Generally, after the software is released, version upgrading is carried out on the released software irregularly so as to solve defects existing in the running process of the software. Considering that the compatibility of different versions of software is different, in order to avoid introducing new defects to cause that the original functions of the software cannot be used, the version defect of the software after version upgrade needs to be detected before formal release.
At present, the related technology is mainly based on a Diffy test tool to detect the version defect of the software after version upgrade. Diffy serves as an open-source automatic testing tool, service processing requests can be distributed to different versions of software, service data returned by the different versions of software are compared, and version defects existing in the software with the upgraded version are detected according to a comparison result. When business data returned by different versions of software are compared, if different fields exist in the business data of the different versions of software, the comparison result is determined to be failure, and then the upgraded software is determined to have version defects.
However, some differences in the service data returned by different versions of software are often acceptable, and the result comparison method based on the Diffy tool does not ignore these slight differences, and at this time, the version defect in the software after version upgrade needs to be checked in a manual manner, which increases the detection cost virtually.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for detecting version defects, a server and a storage medium, which can reduce detection cost. The technical scheme is as follows:
in one aspect, a method for detecting a version defect is provided, where the method includes:
acquiring first service data and second service data, wherein the first service data is data generated when a first version of software is operated in a specified environment based on a service processing request, and the second service data is data generated when a second version of software is operated in the specified environment based on the service processing request;
comparing a first field in the first service data with a second field in the second service data;
if the first field and the second field are different fields, calculating the similarity between the first field and the second field;
determining a comparison result of the first service data and the second service data according to the similarity calculation result;
and detecting the version defects existing in the second version software according to the comparison result.
In another embodiment of the present disclosure, before comparing the first field in the first service data with the second field in the second service data, the method further includes:
acquiring field attributes of fields to be compared from configuration information of a software interface;
and acquiring the first field from the first service data and acquiring the second field from the second service data according to the field attribute.
In another embodiment of the present disclosure, the obtaining the first field from the first service data and the second field from the second service data according to the field attribute includes:
if the field attribute is a white list, acquiring a field with the field attribute being the white list from the first service data, determining the acquired field as the first field, acquiring a field with the field attribute being the black list from the second service data, and determining the acquired field as the second field;
and if the field attribute is a blacklist, removing the field of which the field attribute is the blacklist in the first service data, determining the remaining field as the first field, removing the field of which the field attribute is the blacklist in the second service data, and determining the remaining field as the second field.
In another embodiment of the present disclosure, the calculating the similarity between the first field and the second field includes:
acquiring field types of the first field and the second field from configuration information of a software interface;
calculating the similarity between the first field and the second field according to the field type;
when the similarity between the first field and the second field is larger than a preset threshold value, determining that the first field and the second field are similar fields.
In another embodiment of the present disclosure, the calculating the similarity between the first field and the second field according to the field type includes:
if the field types of the first field and the second field are arrays, calculating array similarity between the first field and the second field;
if the field types of the first field and the second field are numbers, calculating the number similarity between the first field and the second field;
and if the field types of the first field and the second field are texts, calculating text similarity or semantic similarity between the first field and the second field.
In another embodiment of the present disclosure, the method further comprises:
acquiring first test data and second test data, wherein the first test data is data generated when a first version of software is operated in the specified environment based on a service test request, and the second test data is data generated when a second version of software is operated in the specified environment based on the service test request;
comparing a third field in the first test data with a fourth field in the second test data based on the initial configuration information of the software interface;
if the third field and the fourth field are different fields, calculating the similarity between the third field and the fourth field based on the initial configuration information;
determining a test comparison result of the first test data and the second test data according to the similarity calculation result;
if the test comparison result does not accord with the preset result, adjusting the initial configuration information of the software interface until the obtained test result accords with the preset result;
and determining the configuration information which accords with the preset result as the configuration information of the software interface.
In another embodiment of the present disclosure, before comparing the first field in the first service data with the second field in the second service data, the method further includes:
preprocessing the first service data and the second service data to obtain comparable first service data and second service data;
and when the first service data and the second service data which can be compared meet the preset condition, executing the operation of comparing a first field in the first service data with a second field in the second service data.
In another embodiment of the present disclosure, the determining a comparison result of the first service data and the second service data according to the similarity calculation result includes:
if the first field and the second field are similar fields, determining that the comparison result is similar and successful;
and if the first field and the second field are non-similar fields, determining that the comparison result is failure.
In another aspect, an apparatus for detecting a version defect is provided, the apparatus including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring first service data and second service data, the first service data is data generated when a first version of software is operated in a specified environment based on a service processing request, and the second service data is data generated when a second version of software is operated in the specified environment based on the service processing request;
the comparison module is used for comparing a first field in the first service data with a second field in the second service data;
a calculating module, configured to calculate a similarity between the first field and the second field if the first field and the second field are different fields;
the determining module is used for determining a comparison result of the first service data and the second service data according to a similarity calculation result;
and the detection module is used for detecting the version defects existing in the second version software according to the comparison result.
In another embodiment of the present disclosure, the first and second substrates are,
the acquisition module is also used for acquiring the field attribute of the field to be compared from the configuration information of the software interface;
the obtaining module is further configured to obtain the first field from the first service data according to the field attribute, and obtain the second field from the second service data.
In another embodiment of the present disclosure, the obtaining module is further configured to, if the field attribute is a white list, obtain a field whose field attribute is a white list from the first service data, determine the obtained field as the first field, obtain a field whose field attribute is a black list from the second service data, and determine the obtained field as the second field; and if the field attribute is a blacklist, removing the field of which the field attribute is the blacklist in the first service data, determining the remaining field as the first field, removing the field of which the field attribute is the blacklist in the second service data, and determining the remaining field as the second field.
In another embodiment of the present disclosure, the calculation module is configured to obtain field types of the first field and the second field from configuration information of a software interface; calculating the similarity between the first field and the second field according to the field type; when the similarity between the first field and the second field is larger than a preset threshold value, determining that the first field and the second field are similar fields.
In another embodiment of the present disclosure, the calculating module is configured to calculate an array similarity between the first field and the second field if the field types of the first field and the second field are arrays; if the field types of the first field and the second field are numbers, calculating the number similarity between the first field and the second field; and if the field types of the first field and the second field are texts, calculating text similarity or semantic similarity between the first field and the second field.
In another embodiment of the present disclosure, the apparatus further comprises:
the obtaining module is further configured to obtain first test data and second test data, where the first test data is data generated when a first version of software is run in the specified environment based on a service test request, and the second test data is data generated when a second version of software is run in the specified environment based on the service test request;
the comparison module is used for comparing a third field in the first test data with a fourth field in the second test data based on the initial configuration information of the software interface;
the calculation module is further configured to calculate, based on the initial configuration information, a similarity between the third field and the fourth field if the third field and the fourth field are different fields;
the determining module is further configured to determine a test comparison result of the first test data and the second test data according to a similarity calculation result;
the adjusting module is used for adjusting the initial configuration information of the software interface if the test comparison result does not accord with a preset result until the obtained test result accords with the preset result;
the determining module is further configured to determine configuration information when the preset result is met as the configuration information of the software interface.
In another embodiment of the present disclosure, the apparatus further comprises:
the preprocessing module is used for preprocessing the first service data and the second service data to obtain comparable first service data and second service data;
the comparison module is further configured to compare a first field in the first service data with a second field in the second service data when the first service data and the second service data which can be compared meet a preset condition.
In another embodiment of the present disclosure, the alignment module is configured to determine that the alignment result is similar and successful if the first field and the second field are similar fields; and if the first field and the second field are non-similar fields, determining that the comparison result is failure.
In another aspect, a server is provided, where the server includes a processor and a memory, where the memory stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the method for detecting a version defect according to the one aspect.
In another aspect, a computer-readable storage medium is provided, in which at least one program code is stored, and the at least one program code is loaded and executed by a processor to implement the method for detecting a version defect according to an aspect.
The technical scheme provided by the embodiment of the disclosure has the following beneficial effects:
when different fields exist in the first service data and the second service data, the result of direct comparison is not determined to be failed, the similarity between the different fields is calculated, the similar fields in the different fields are omitted through the similarity calculation, the difference between the different fields is reduced, the similar fields do not need to be eliminated through manual investigation, and the detection cost is reduced. In addition, the similar field is not used as a failure field any more, and the detection success rate is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is an implementation environment related to a method for detecting a version defect according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of a method for detecting a version defect according to an embodiment of the present disclosure;
FIG. 3 is a diagram illustrating a field alignment process according to an embodiment of the disclosure;
FIG. 4 is a schematic diagram of a similarity calculation process provided by the embodiment of the present disclosure;
FIG. 5 is a flowchart of a method for detecting a version defect according to an embodiment of the present disclosure;
FIG. 6 is a schematic structural diagram of an apparatus for detecting a version defect according to an embodiment of the present disclosure;
FIG. 7 illustrates a server for detection of version defects, according to an example embodiment.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
It is to be understood that the terms "each," "a plurality," and "any" and the like, as used in the embodiments of the present disclosure, are intended to encompass two or more, each referring to each of the corresponding plurality, and any referring to any one of the corresponding plurality. For example, the plurality of words includes 10 words, and each word refers to each of the 10 words, and any word refers to any one of the 10 words.
Before carrying out the embodiments of the present disclosure, terms referred to in the embodiments of the present disclosure are explained first.
And (3) flow playback: as a currently popular regression testing method, the method mainly records the traffic under the real environment, plays back the recorded traffic in the testing environment, and then compares the results of the real service data and the testing service data.
And (3) regression testing: the method refers to that after the old code is modified, the test needs to be carried out again to confirm that no new error is introduced into the modification or other codes generate errors. The regression test can greatly reduce the cost of the system in the stages of test, maintenance and upgrade and the like.
And Mock refers to a test method for creating and replacing some objects which are not easy to construct or obtain by using a virtual object in the test process.
Version defect: the defects caused by different software compatibility of different versions are referred to. Version defects can affect the implementation of software functions, even resulting in improper use of software.
At present, when version defect detection is performed on different versions of software, a flow playback and result comparison method is mainly adopted, and tools for performing flow playback and result comparison are Doom and Diffy.
Doom is an automatic regression platform, which can copy a part of online real traffic on a line and regress the copied real traffic in a test environment. Doom is a platform for asynchronous playback requests, and can drop all external calls mock to restore the environment when real traffic is sent, so that the consistency of comparison results is ensured. However, Doom requests are sent at different times, and for a service scene with timeliness, randomness and irregularity, service data returned asynchronously cannot be compared with service data in a real environment, so that the comparison result has a large difference.
Diffy is an open-source automatic testing tool, and by adopting a Diff testing technology, service processing requests can be distributed to different versions of software, and version defects existing in the software with the upgraded version can be detected by comparing service data returned by the different versions of software. However, the Diffy comparison method does not preprocess the returned service data, but directly compares the returned service data, and the Diffy comparison does not ignore the slight difference in the service data, which results in a high comparison failure rate, and requires a manual method to perform investigation, thereby increasing the detection cost.
The method provided by the embodiment of the disclosure sends a service processing request to the cluster running different versions of software in real time, performs directional preprocessing, comparison of black and white list results, calculation of similarity of difference fields and other processing on returned service data, and finally obtains a comparison result with weakened noise, thereby performing detection of version defects based on the comparison result. By adopting the method provided by the embodiment of the disclosure, the comparison result difference caused by different request time, algorithm difference and the like is reduced, the problem that the failure rate of direct comparison of the service data returned by the complex service processing request is higher is solved, the comparison result with weak difference automatically passes through, and the manual troubleshooting cost is reduced.
Application scenario of detection method for version defects provided by embodiment of the present disclosure
The method for detecting the version defects provided by the embodiment of the disclosure can be applied to complex scene testing of an engine end similar to an advertisement platform, and is also applicable to common API (application program interface) testing. For the service test, the regression testing efficiency can be improved by adopting the method provided by the embodiment of the disclosure.
Referring to fig. 1, an implementation environment related to the method for detecting a version defect according to the embodiment of the present disclosure is shown, and referring to fig. 1, the implementation environment includes a terminal 101, a terminal 102, and a server 103.
The terminal 101 and the terminal 102 are installed and run with different versions of software, and the terminal 101 and the terminal 102 are in the same environment, and execute a service processing operation based on a received service processing request in the running process of the different versions of software to generate different service data, and then return the generated service data to the server 103 through a software interface, so that the server 103 can detect version defects of the different versions of software.
The server 103 is a background server for different versions of software, and the server 103 can provide the same environment for running different versions of software, and the same environment comprises the same database and the like. After receiving the service data returned by the different versions of software through the software interface, the server 103 detects the software version defects existing in the different versions of software by comparing the service data of the different versions of software.
The terminal 101 and the terminal 102 may be, but are not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, and the like. The server 103 may be an independent physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers. The terminals 101, 102 and the server 103 may be directly or indirectly connected through wired or wireless communication, and the embodiments of the present disclosure are not limited herein.
Based on the implementation environment shown in fig. 1, an embodiment of the present disclosure provides a method for detecting a version defect, and referring to fig. 2, a flow of the method provided by the embodiment of the present disclosure includes:
201. the server acquires the first service data and the second service data.
The first service data is data generated when the first version software is operated in the specified environment based on the service processing request, and the second service data is data generated when the second version software is operated in the specified environment based on the service processing request. The service processing request is used for triggering and executing a corresponding service in the software running process to generate service data, for example, triggering and executing a corresponding service in the first version software running process to generate first service data; and triggering and executing the corresponding service in the running process of the second version software to generate second service data. The specified environment can be an online real service processing environment or an offline test environment, the embodiment of the disclosure does not specifically limit the specified environment, and only needs to ensure that the first version software and the second version software are in the same environment, so that differences caused by different operating environments can be shielded when detecting version defects, and the accuracy of detection is improved. The first version software and the second version software are different versions of the same software, the first version software is released software, the second version software is software to be released and needs to be subjected to version defect detection, the version of the first version software is lower than that of the second version software, and the release of the second version software is used for overcoming the defects of the first version software in the operation process and adding new functions.
When the server acquires the first service data and the second service data, the server can receive the first service data returned by the first version software through the software interface and receive the second service data returned by the second version software, so that the first service data and the second service data are acquired accordingly.
Further, in order to reduce the difference between the first service data and the second service data, the server initializes a comparison environment of the first service data and the second service data, and aligns the first service data and the second service data in an initialization process to make the first service data and the second service data become data in a specified format capable of being compared, where the specified format may be a JSON format or the like.
202. And the server compares the first field in the first service data with the second field in the second service data.
Considering that the first service data and the second service data may include key fields that cannot be directly compared, such as encrypted fields, irregular fields, and the like, if the fields are directly compared, the comparison result is usually failed, which results in a high comparison failure rate and an inaccurate comparison result. In order to reduce the comparison failure rate and improve the accuracy of the comparison result, the method provided by the embodiment of the disclosure further preprocesses the first service data and the second service data. When the server preprocesses the first service data and the second service data, different processing modes can be adopted for different fields, for example, for an encrypted field, the encrypted field can be decoded, and for an irregular field, regular features of the irregular field can be extracted. The first service data and the second service data which can be compared are obtained by preprocessing the first service data and the second service data, for example, the first service data and the second service data are changed into a JSON format which can be compared.
After the first service data and the second service data are converted into the comparable data, the server also judges whether the comparable first service data and the comparable second service data meet preset conditions, and when the comparable first service data and the comparable second service data meet the preset conditions, the server determines that the first service data and the comparable second service data are valid, and then compares fields in the first service data and the comparable second service data. The preset condition can be obtained from the configuration information of the software interface.
In order to improve the comparison efficiency, the server also acquires the sequencing information from the configuration information of the software interface, and if the sequencing information does not ignore sequencing, the field in the first service data is compared with the field in the second service data according to the original sequence; if the sorting information is neglected sorting, sorting the fields in the second service data based on the fields in the first service data, so that the sequence of the fields in the second service data is the same as the sequence of the fields in the first service data, thereby facilitating comparison between the fields in the first service data and the fields in the second service data. For example, the sequence of the fields in the first service data is field a, field B, field C, and field D, and the sequence of the fields in the second service data is field B, field D, field a, and field C, then the fields in the second service data are reordered according to the sequence of the fields in the first service data, so that the sequence of the fields in the second service data is also field a, field B, field C, and field D.
Usually, the first service data and the second service data include a plurality of fields, and the fields are meaningful, the comparison of the fields can detect the version defect of the software, and the fields are meaningless, and the comparison of the fields only increases the calculation amount of the detection process, thereby prolonging the detection time. Therefore, before comparing the field in the first service data with the field in the second service data, the first field to be compared may be obtained from the first service data, and the second field to be compared may be obtained from the second service data.
When the server acquires the first field and the second field, the following steps can be adopted:
2021. and the server acquires the field attribute of the field to be compared from the configuration information of the software interface.
In the embodiment of the present disclosure, the configuration information of the software interface includes relevant configurations for determining the field alignment policy, for example, a configuration of field attributes of the fields to be aligned, a configuration of ignoring alignment, a configuration of similarity calculation, and the like. The field attribute is used for determining the comparison mode of the field, including a white list, a black list, a full field and the like. Based on the configuration information of the software interface, the terminal can acquire the field attribute of the field to be compared from the configuration information of the software interface.
2022. And the server acquires the first field from the first service data and acquires the second field from the second service data according to the field attribute.
When the terminal acquires the first field from the first service data and the second field from the second service data according to the field attribute, the following situations are included but not limited to:
in the first case, if the field attribute is a white list, the server acquires a field with the field attribute being the white list from the first service data, determines the acquired field as a first field, acquires a field with the field attribute being a black list from the second service data, and determines the acquired field as a second field.
And in the second case, if the field attribute is the blacklist, the server removes the field of which the field attribute is the blacklist in the first service data, determines the rest field as the first field, removes the field of which the field attribute is the blacklist in the second service data, and determines the rest field as the second field.
And in the third case, if the field attribute is a full field except for a white list and a black list, the server determines all fields in the first service data as first fields and determines all fields in the second service data as second fields.
After the first field and the second field are obtained, the server may compare the first field and the second field one by one according to the order. For any first field, if the field values of the first field and the second field are the same, determining that the first field and the second field are the same; and if the field values of the first field and the second field are different, determining that the first field and the second field are different fields.
In another embodiment of the present disclosure, when comparing a first field in first service data with a second field in second service data, a server may search for a field with the same field name as the first field in the second field, when the second field with the same field name as the first field is found in the second field, compare a field value of the first field with a field value of the second field, if the field value of the first field is the same as the field value of the second field, determine that the first field and the second field are the same field, and if the field value of the first field is different from the field value of the second field, determine that the first field and the second field are different fields.
It should be noted that the number of the first fields and the second fields is at least one, the server compares the at least one first field with the at least one second field one by one when comparing the first fields with the second fields, and after the comparison of all the first fields with all the second fields is completed, the server may screen out the same fields and record different fields based on the comparison result, and further perform further investigation on different fields through step 203.
The process of comparing the first field and the second field is described below with reference to fig. 3 as an example.
Referring to fig. 3, the server obtains a result a and a result B returned by the first version software and the second version software, obtains a comparison policy of the result a and the result B from the configuration information of the software interface, and compares the result a and the result B based on the obtained comparison policy. Firstly, the server executes initialization operation to initialize a comparison environment, then judges whether to ignore sequencing or not based on a comparison strategy, and if the sequencing is ignored, reorders fields in a result B based on a result A; and if the sequencing is not ignored, comparing the result A with the result B in the original sequence. Then, judging a comparison mode adopted when the result A and the result B are compared based on a comparison strategy, and if the comparison mode is white list comparison, only keeping fields needing to be compared in the result A and the result B; if the comparison mode is blacklist comparison, removing the field which ignores the comparison; and if the comparison mode is full-field comparison, comparing all fields in the result A and the result B. According to the three comparison modes, the server hides fields which do not need to be compared, updates the comparison environment, further compares the fields which need to be compared in the result A and the result B, removes the same fields based on the comparison result, reserves different fields, and further updates the comparison environment.
203. If the first field and the second field are different fields, the server calculates the similarity between the first field and the second field.
And when the first field and the second field are determined to be different fields through comparison, the server calculates the similarity between the first field and the second field, and further determines the relationship between the first field and the second field through similarity calculation.
Specifically, when the server calculates the similarity between the first field and the second field, the following method may be adopted:
2031. and the server acquires the field types of the first field and the second field from the configuration information of the software interface.
The field types include an array (List), a Number (Number), a text, and the like.
2032. And the server calculates the similarity between the first field and the second field according to the field type.
According to the field types of the first field and the second field, when the server calculates the similarity between the first field and the second field, the following situations are included:
in the first case, if the field types of the first field and the second field are arrays, the server calculates the array similarity between the first field and the second field.
In the second case, if the field types of the first field and the second field are numbers, the server calculates the number similarity between the first field and the second field;
in the third case, if the field types of the first field and the second field are texts, the server calculates the text similarity or semantic similarity between the first field and the second field.
2033. And when the similarity between the first field and the second field is greater than a preset threshold, the server determines that the first field and the second field are similar fields.
The preset threshold may be set according to the detection precision of the version defect, and the preset threshold may be 0.8, 0.9, and the like. In response to the fact that the similarity between the first field and the second field is larger than a preset threshold value, the server determines that the first field and the second field are similar fields; and in response to the similarity between the first field and the second field being smaller than a preset threshold, the server determines that the first field and the second field are comparison failure fields.
204. And the server determines a comparison result of the first service data and the second service data according to the similarity calculation result.
In the embodiment of the present disclosure, after comparing a first field in first service data with a second field in second service data, if the first field and the second field are the same field, it may be determined that a comparison result of the first service data and the second service data is successful; if the first field and the second field are different fields, the server calculates the similarity between the first field and the second field, and based on the calculation result of the similarity, no comparison failure field exists in the first field and the second field, namely the first field and the second field are the same field or similar fields, so that the comparison result of the first service data and the second service data can be determined to be similar and successful; if the comparison failure field exists in the first field and the second field, the comparison result of the first service data and the second service data can be determined to be the comparison failure.
The similarity calculation and comparison result determination process will be described with reference to fig. 4.
Referring to fig. 4, after comparing a first field in the first service data with a second field in the second service data to obtain a comparison result, if the first field and the second field are both the same field, it is determined that the comparison result is successful; if different fields exist in the first field and the second field, judging whether a similarity algorithm is configured or not, if the similarity algorithm is configured, executing the similarity algorithm to calculate the similarity between the different fields to obtain a similarity value, and if the similarity value is smaller than a preset threshold value, continuously judging the similarity between the different fields until all the different fields finish calculating the similarity. Calculating results based on the similarity of all different fields, and if the failed field still exists, determining that the comparison result of the first service data and the second service data is the comparison failure; and if the failure field does not exist, determining that the comparison result of the first service data and the second service data is similar to success.
The process of determining the above-mentioned alignment result is described below with reference to fig. 5 as an example.
Referring to fig. 5, the same request is sent to a cluster a running a first version of software and a cluster B running a second version of software, so that a result a returned by the cluster a and a result B returned by the cluster B are obtained, the result a and the result B are preprocessed and pre-checked to obtain processed a and processed B, fields in the processed a and processed B are compared, if different fields exist, the similarity is calculated by adopting a similarity calculation algorithm to obtain a similarity calculation result, and then the comparison result is determined based on the similarity calculation result.
205. And the server detects the version defects in the second version software according to the comparison result.
And when the comparison result is failure, the server can determine that the second version software has version defects. In response to a version bug in the second version of software, the technician will optimize the second version of software to overcome the version bug in the second version of software.
In the embodiment of the present disclosure, the configuration information of the software interface affects the detection result of detecting the version defect existing in the second version software, so to avoid the influence of other factors on the detection result, before the embodiment of the present disclosure is executed, the software interface is also configured, and specifically, the following method may be adopted:
2051. the server obtains the first test data and the second test data.
The first test data is data generated when the first version software is operated in the specified environment based on the service test request, and the second test data is data generated when the second version software is operated in the specified environment based on the service test request.
2052. And based on the initial configuration information of the software interface, the server compares the third field in the first test data with the fourth field in the second test data.
The third field is a field to be compared in the first test data, and the fourth field is a field to be compared in the second test data. The initial configuration information is used to indicate an initial alignment policy, including initial configuration of field attributes, initial configuration of neglecting alignment, initial configuration of similarity calculation, and the like.
2053. If the third field and the fourth field are different fields, the server calculates the similarity between the third field and the fourth field based on the initial configuration information.
And in response to that the third field and the fourth field are different fields, the server acquires an initial field type and an initial preset threshold value from the initial configuration information, and then calculates the similarity between the third field and the fourth field based on the initial field type and the initial preset threshold value.
2054. And the server determines a test comparison result of the first test data and the second test data according to the similarity calculation result.
If the third field in the first test data and the fourth field in the second test data do not have the field failed in comparison and do not have the similar field, determining that the test comparison result of the first test data and the second test data is successful; if the third field in the first test data and the fourth field in the second test data do not have the field failed in comparison, but have similar fields, determining that the test comparison results of the first test data and the second test data are similar and successful; and if the fields which fail to be compared exist in the third field in the first test data and the fourth field in the second test data, determining that the test comparison result of the first test data and the second test data is failure.
2055. And if the test comparison result does not accord with the preset result, the server adjusts the initial configuration information of the software interface until the obtained test result accords with the preset result.
The preset result can be a test result predicted by a technician before testing, and the preset result can be success, similar success or failure, a ratio of fields with failed comparison, and the like.
2056. And the server determines the configuration information which accords with the preset result as the configuration information of the software interface.
Based on the configured software interface, the server implements the version defect detection on the second version software by executing the steps 201 to 205.
According to the method provided by the embodiment of the disclosure, when different fields exist in the first service data and the second service data, the result of direct comparison is not determined to be failed, the similarity between the different fields is calculated, and the similar fields in the different fields are omitted through the similarity calculation, so that the difference between the different fields is reduced, the similar fields do not need to be eliminated through manual investigation, and the detection cost is reduced. In addition, the similar field is not used as a failure field any more, and the detection success rate is improved.
Referring to fig. 6, an embodiment of the present disclosure provides an apparatus for detecting a version defect, including:
an obtaining module 601, configured to obtain first service data and second service data, where the first service data is data generated when a first version of software is run in a specified environment based on a service processing request, and the second service data is data generated when a second version of software is run in the specified environment based on the service processing request;
a comparing module 602, configured to compare a first field in the first service data with a second field in the second service data;
a calculating module 603, configured to calculate a similarity between the first field and the second field if the first field and the second field are different fields;
a determining module 604, configured to determine a comparison result between the first service data and the second service data according to the similarity calculation result;
the detecting module 605 is configured to detect the version defect existing in the second version software according to the comparison result.
In another embodiment of the present disclosure, the first and second substrates are,
the obtaining module 601 is further configured to obtain a field attribute of the field to be compared from the configuration information of the software interface;
the obtaining module 601 is further configured to obtain a first field from the first service data according to the field attribute, and obtain a second field from the second service data.
In another embodiment of the present disclosure, the obtaining module 601 is further configured to, if the field attribute is a white list, obtain a field whose field attribute is the white list from the first service data, determine the obtained field as a first field, obtain a field whose field attribute is a black list from the second service data, and determine the obtained field as a second field; and if the field attribute is the blacklist, removing the field of which the field attribute is the blacklist in the first service data, determining the rest field as the first field, removing the field of which the field attribute is the blacklist in the second service data, and determining the rest field as the second field.
In another embodiment of the present disclosure, the calculating module 603 is configured to obtain field types of the first field and the second field from configuration information of the software interface; calculating the similarity between the first field and the second field according to the field type; and when the similarity between the first field and the second field is greater than a preset threshold value, determining that the first field and the second field are similar fields.
In another embodiment of the present disclosure, the calculating module 603 is configured to calculate an array similarity between the first field and the second field if the field types of the first field and the second field are arrays; if the field types of the first field and the second field are numbers, calculating the number similarity between the first field and the second field; and if the field types of the first field and the second field are texts, calculating text similarity or semantic similarity between the first field and the second field.
In another embodiment of the present disclosure, the apparatus further comprises:
the obtaining module 601 is further configured to obtain first test data and second test data, where the first test data is data generated when a first version of software is run in a specified environment based on a service test request, and the second test data is data generated when a second version of software is run in the specified environment based on the service test request;
a comparison module 602, configured to compare a third field in the first test data with a fourth field in the second test data based on the initial configuration information of the software interface;
a calculating module 603, configured to calculate, if the third field and the fourth field are different fields, a similarity between the third field and the fourth field based on the initial configuration information;
the determining module 604 is further configured to determine a test comparison result of the first test data and the second test data according to the similarity calculation result;
the adjusting module is used for adjusting the initial configuration information of the software interface if the test comparison result does not accord with the preset result until the obtained test result accords with the preset result;
and the determining module is also used for determining the configuration information which accords with the preset result as the configuration information of the software interface.
In another embodiment of the present disclosure, the apparatus further comprises:
the preprocessing module is used for preprocessing the first service data and the second service data to obtain the first service data and the second service data which can be compared;
the comparing module 602 is further configured to compare a first field in the first service data with a second field in the second service data when the first service data and the second service data that can be compared satisfy a preset condition.
In another embodiment of the present disclosure, the comparing module 602 is configured to determine that the comparison result is similar and successful if the first field and the second field are similar fields; and if the first field and the second field are non-similar fields, determining that the comparison result is failure.
In summary, according to the apparatus provided in the embodiment of the present disclosure, when different fields exist in the first service data and the second service data, and the result of the direct comparison is not determined to be a failure, the similarity between the different fields is calculated, and the similar fields in the different fields are omitted through the similarity calculation, so that the difference between the different fields is reduced, thereby eliminating the similar fields without manual investigation, and reducing the detection cost. In addition, the similar field is not used as a failure field any more, and the detection success rate is improved.
FIG. 7 illustrates a server for detection of version defects, according to an example embodiment. Referring to fig. 7, server 700 includes a processing component 722 that further includes one or more processors and memory resources, represented by memory 732, for storing instructions, such as applications, that are executable by processing component 722. The application programs stored in memory 732 may include one or more modules that each correspond to a set of instructions. Further, the processing component 722 is configured to execute instructions to perform the functions performed by the server in the above-described version defect detection method.
The server 700 may also include a power component 726 configured to perform power management of the server 700, a wired or wireless network interface 750 configured to connect the server 700 to a network, and an input output (I/O) interface 758. The Server 700 may operate based on an operating system, such as Windows Server, stored in a memory 732TM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTMOr the like.
According to the server provided by the embodiment of the disclosure, when different fields exist in the first service data and the second service data, the result of direct comparison is not determined to be a failure, the similarity between the different fields is calculated, and the similar fields in the different fields are omitted through the similarity calculation, so that the difference between the different fields is reduced, the similar fields do not need to be eliminated through manual investigation, and the detection cost is reduced. In addition, the similar field is not used as a failure field any more, and the detection success rate is improved.
The embodiment of the disclosure provides a computer-readable storage medium, in which at least one program code is stored, and the at least one program code is loaded and executed by a processor to implement the method for detecting the version defect shown in fig. 2. The computer readable storage medium may be non-transitory. For example, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
According to the computer-readable storage medium provided by the embodiment of the disclosure, when different fields exist in the first service data and the second service data, the result of direct comparison is not determined to be a failure, but the similarity between the different fields is calculated, and the similar fields in the different fields are omitted through the similarity calculation, so that the difference between the different fields is reduced, the similar fields do not need to be removed through manual investigation, and the detection cost is reduced. In addition, the similar field is not used as a failure field any more, and the detection success rate is improved.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is intended to be exemplary only and not to limit the present disclosure, and any modification, equivalent replacement, or improvement made without departing from the spirit and scope of the present disclosure is to be considered as the same as the present disclosure.

Claims (11)

1. A method for detecting a version defect, the method comprising:
acquiring first service data and second service data, wherein the first service data is data generated when a first version of software is operated in a specified environment based on a service processing request, and the second service data is data generated when a second version of software is operated in the specified environment based on the service processing request;
comparing a first field in the first service data with a second field in the second service data;
if the first field and the second field are different fields, calculating the similarity between the first field and the second field;
determining a comparison result of the first service data and the second service data according to the similarity calculation result;
and detecting the version defects existing in the second version software according to the comparison result.
2. The method of claim 1, wherein before comparing the first field in the first service data with the second field in the second service data, further comprising:
acquiring field attributes of fields to be compared from configuration information of a software interface;
and acquiring the first field from the first service data and acquiring the second field from the second service data according to the field attribute.
3. The method of claim 2, wherein the obtaining the first field from the first service data and the second field from the second service data according to the field attribute comprises:
if the field attribute is a white list, acquiring a field with the field attribute being the white list from the first service data, determining the acquired field as the first field, acquiring a field with the field attribute being the black list from the second service data, and determining the acquired field as the second field;
and if the field attribute is a blacklist, removing the field of which the field attribute is the blacklist in the first service data, determining the remaining field as the first field, removing the field of which the field attribute is the blacklist in the second service data, and determining the remaining field as the second field.
4. The method of claim 1, wherein the calculating the similarity between the first field and the second field comprises:
acquiring field types of the first field and the second field from configuration information of a software interface;
calculating the similarity between the first field and the second field according to the field type;
when the similarity between the first field and the second field is larger than a preset threshold value, determining that the first field and the second field are similar fields.
5. The method of claim 4, wherein the calculating the similarity between the first field and the second field according to the field type comprises:
if the field types of the first field and the second field are arrays, calculating array similarity between the first field and the second field;
if the field types of the first field and the second field are numbers, calculating the number similarity between the first field and the second field;
and if the field types of the first field and the second field are texts, calculating text similarity or semantic similarity between the first field and the second field.
6. The method according to any one of claims 2 to 5, further comprising:
acquiring first test data and second test data, wherein the first test data is data generated when a first version of software is operated in the specified environment based on a service test request, and the second test data is data generated when a second version of software is operated in the specified environment based on the service test request;
comparing a third field in the first test data with a fourth field in the second test data based on the initial configuration information of the software interface;
if the third field and the fourth field are different fields, calculating the similarity between the third field and the fourth field based on the initial configuration information;
determining a test comparison result of the first test data and the second test data according to the similarity calculation result;
if the test comparison result does not accord with the preset result, adjusting the initial configuration information of the software interface until the obtained test result accords with the preset result;
and determining the configuration information which accords with the preset result as the configuration information of the software interface.
7. The method according to any one of claims 1 to 5, wherein before comparing the first field in the first service data with the second field in the second service data, further comprising:
preprocessing the first service data and the second service data to obtain comparable first service data and second service data;
and when the first service data and the second service data which can be compared meet the preset condition, executing the operation of comparing a first field in the first service data with a second field in the second service data.
8. The method according to any one of claims 1 to 5, wherein the determining a comparison result of the first service data and the second service data according to the similarity calculation result comprises:
if the first field and the second field are similar fields, determining that the comparison result is similar and successful;
and if the first field and the second field are non-similar fields, determining that the comparison result is failure.
9. An apparatus for detecting version defects, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring first service data and second service data, the first service data is data generated when a first version of software is operated in a specified environment based on a service processing request, and the second service data is data generated when a second version of software is operated in the specified environment based on the service processing request;
the comparison module is used for comparing a first field in the first service data with a second field in the second service data;
a calculating module, configured to calculate a similarity between the first field and the second field if the first field and the second field are different fields;
the determining module is used for determining a comparison result of the first service data and the second service data according to a similarity calculation result;
and the detection module is used for detecting the version defects existing in the second version software according to the comparison result.
10. A server, characterized in that it comprises a processor and a memory, in which at least one program code is stored, which is loaded and executed by the processor to implement the method of detection of a version defect according to any one of claims 1 to 8.
11. A computer-readable storage medium, wherein at least one program code is stored, which is loaded and executed by a processor, to implement the method of detecting a version defect according to any one of claims 1 to 8.
CN202010968510.3A 2020-09-15 2020-09-15 Version defect detection method and device, server and storage medium Withdrawn CN112100070A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010968510.3A CN112100070A (en) 2020-09-15 2020-09-15 Version defect detection method and device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010968510.3A CN112100070A (en) 2020-09-15 2020-09-15 Version defect detection method and device, server and storage medium

Publications (1)

Publication Number Publication Date
CN112100070A true CN112100070A (en) 2020-12-18

Family

ID=73759141

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010968510.3A Withdrawn CN112100070A (en) 2020-09-15 2020-09-15 Version defect detection method and device, server and storage medium

Country Status (1)

Country Link
CN (1) CN112100070A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220573A (en) * 2021-05-12 2021-08-06 北京百度网讯科技有限公司 Test method and device for micro-service architecture and electronic equipment
CN114676062A (en) * 2022-04-06 2022-06-28 北京百度网讯科技有限公司 Method and device for testing difference data of interface, electronic equipment and medium
CN115297041A (en) * 2022-07-29 2022-11-04 深圳前海微众银行股份有限公司 Data verification method and device for flow playback

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109471790A (en) * 2018-09-04 2019-03-15 中国平安人寿保险股份有限公司 Send nuclear parameter comparison method and device, computer installation and readable storage medium storing program for executing
CN110569046A (en) * 2018-06-06 2019-12-13 阿里巴巴集团控股有限公司 Data processing method, device, equipment and storage medium
CN111563051A (en) * 2020-07-16 2020-08-21 平安国际智慧城市科技股份有限公司 Crawler-based data verification method and device, computer equipment and storage medium
CN111625252A (en) * 2020-04-23 2020-09-04 平安科技(深圳)有限公司 Cluster upgrading maintenance method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110569046A (en) * 2018-06-06 2019-12-13 阿里巴巴集团控股有限公司 Data processing method, device, equipment and storage medium
CN109471790A (en) * 2018-09-04 2019-03-15 中国平安人寿保险股份有限公司 Send nuclear parameter comparison method and device, computer installation and readable storage medium storing program for executing
CN111625252A (en) * 2020-04-23 2020-09-04 平安科技(深圳)有限公司 Cluster upgrading maintenance method and device, electronic equipment and storage medium
CN111563051A (en) * 2020-07-16 2020-08-21 平安国际智慧城市科技股份有限公司 Crawler-based data verification method and device, computer equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220573A (en) * 2021-05-12 2021-08-06 北京百度网讯科技有限公司 Test method and device for micro-service architecture and electronic equipment
CN113220573B (en) * 2021-05-12 2024-06-25 北京百度网讯科技有限公司 Test method and device for micro-service architecture and electronic equipment
CN114676062A (en) * 2022-04-06 2022-06-28 北京百度网讯科技有限公司 Method and device for testing difference data of interface, electronic equipment and medium
CN115297041A (en) * 2022-07-29 2022-11-04 深圳前海微众银行股份有限公司 Data verification method and device for flow playback
CN115297041B (en) * 2022-07-29 2024-01-02 深圳前海微众银行股份有限公司 Data verification method and device for flow playback
WO2024021362A1 (en) * 2022-07-29 2024-02-01 深圳前海微众银行股份有限公司 Data verification method and apparatus for traffic replay

Similar Documents

Publication Publication Date Title
CN107453960B (en) Method, device and system for processing test data in service test
CN112100070A (en) Version defect detection method and device, server and storage medium
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN110688305B (en) Test environment synchronization method, device, medium and electronic equipment
CN111737140A (en) Interface automation test method, device, equipment and computer readable storage medium
CN114417335A (en) Malicious file detection method and device, electronic equipment and storage medium
CN114201408A (en) Regression testing method, device, computer equipment and storage medium
CN112882957B (en) Test task validity checking method and device
CN113377818A (en) Flow verification method and device, computer equipment and storage medium
CN109214189B (en) Method, device, storage medium and electronic equipment for identifying program bugs
CN116303106A (en) GitFlow software version-based quick rollback method and system suitable for financial industry
CN115328891A (en) Data migration method and device, storage medium and electronic equipment
CN111737129B (en) Service control method, device, computer readable medium and electronic equipment
CN114650211A (en) Fault repairing method, device, electronic equipment and computer readable storage medium
CN110362464B (en) Software analysis method and equipment
CN112948195A (en) Interface testing method and device, electronic equipment and storage medium
CN111209197A (en) Application program continuous integration test method, system, equipment and storage medium
CN115640236B (en) Script quality detection method and computing device
CN113157558B (en) System testing method and device
CN114968829B (en) Full link pressure test method, electronic device and storage medium
CN113626332B (en) Debugging method, device, equipment, storage medium and computer program product
CN111953544B (en) Fault detection method, device, equipment and storage medium of server
CN112947948B (en) Deployment method and device of application service
CN113760475A (en) Online system migration method, device, medium and electronic equipment
CN118468265A (en) Application version detection method and device

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20201218

WW01 Invention patent application withdrawn after publication