CN111209180B - Regression testing method and device based on fuzzy matching - Google Patents
Regression testing method and device based on fuzzy matching Download PDFInfo
- Publication number
- CN111209180B CN111209180B CN201811392842.0A CN201811392842A CN111209180B CN 111209180 B CN111209180 B CN 111209180B CN 201811392842 A CN201811392842 A CN 201811392842A CN 111209180 B CN111209180 B CN 111209180B
- Authority
- CN
- China
- Prior art keywords
- value
- test
- key
- response message
- ratio
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 253
- 230000004044 response Effects 0.000 claims abstract description 104
- 238000012549 training Methods 0.000 claims abstract description 38
- 238000004519 manufacturing process Methods 0.000 claims abstract description 37
- 238000009826 distribution Methods 0.000 claims description 22
- 238000000034 method Methods 0.000 claims description 18
- 238000003860 storage Methods 0.000 claims description 13
- 239000011159 matrix material Substances 0.000 claims description 11
- 238000004364 calculation method Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 230000002159 abnormal effect Effects 0.000 claims description 8
- 230000005856 abnormality Effects 0.000 claims description 3
- 238000004458 analytical method Methods 0.000 abstract description 7
- 230000008859 change Effects 0.000 abstract description 7
- 238000013461 design Methods 0.000 abstract description 7
- 238000012986 modification Methods 0.000 description 10
- 230000004048 modification Effects 0.000 description 10
- 238000011161 development Methods 0.000 description 9
- 238000007619 statistical method Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000012423 maintenance Methods 0.000 description 5
- 238000001514 detection method Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000013102 re-test Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000005520 cutting process Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000001010 compromised effect Effects 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention provides a regression testing method and device based on fuzzy matching, which are characterized in that a service request message of a production environment is extracted and converted and input into a stable version testing environment, keyword value contents of a response message to be tested are configured and cut, a first response message output by the stable version testing environment is used as a training sample, the number ratio of each keyword value is calculated to form a standard expected testing result, and then the number ratio of the keyword value obtained by a testing version is compared with a standard value in intervals to obtain a testing conclusion; the regression case updating and the actual business fitting with the production can be simply and rapidly realized, and the analysis and judgment of the test result can be automatically adjusted along with the input change, so that the business scene design of professional testers is not needed, and the test coverage degree and the case updating efficiency are improved.
Description
Technical Field
The embodiment of the invention relates to the technical field of testing, in particular to a regression testing method and device based on fuzzy matching.
Background
At any stage in the software lifecycle, a problem may be presented to the software whenever it changes. The change in software may result from errors being discovered and modifications made, and may also be due to the addition of new modules during the integration or maintenance phase. When errors contained in the software are found, modifications to these errors may be missed if the error tracking and management system is not perfect; while the developer is not well aware of the error, the modification may be caused to correct only the external appearance of the error, without repairing the error itself, thereby causing a modification failure; modification may also produce side effects that cause new problems in the unmodified parts of the software, causing errors in functions that would otherwise work properly. Also, when a new code is added to the software, the new code may have an influence on the original code in addition to the possibility of errors contained in the new added code. Thus, whenever the software changes, we have to retest the existing functionality to determine if the modification has achieved its intended purpose, checking if the modification has compromised the original normal functionality. At the same time, new test cases need to be supplemented to test new or modified functionality. Regression testing is required to verify the correctness of the modification and its impact.
Regression testing refers to the re-testing after an old code has been modified to confirm that the modification did not introduce new errors or caused other code to produce errors. Along with the continuous popularization of agile development modes, an automatic regression testing technology is more widely focused and applied, plays an extremely important role in improving the testing efficiency, saving the testing cost and the like, greatly reduces the workload of testers, and can enable the testers to place the center of gravity of the test on the test implementation of the change function point.
The development flow of the automatic regression test of the message type mainly comprises the design of a regression case scene of a tester, the evaluation of a test expert case, the development and investigation of an automatic case of a developer and the automatic test application, but as most of the regression case is written by combining the practical design of the production operation business scene according to experience by a professional tester, the situation of incomplete coverage or inconformity with reality still exists; meanwhile, the automatic test case writing requires the test developer to preset an input message, meanwhile writes an expected output message, compares the expected output with the tested output, and considers the expected output to pass the test when the result is consistent, so that the development and maintenance flow of each regression case is complex, the time consumption is long, and the labor cost is high.
Disclosure of Invention
The embodiment of the invention provides a regression testing method and device based on fuzzy matching, which overcome the problems or at least partially solve the problems.
In a first aspect, an embodiment of the present invention provides a regression testing method based on fuzzy matching, including:
inputting a service request message in a production environment into a stable version test environment to obtain a first service response message output by the stable version test environment; calculating the keyword value ratio in the first service response message, training by taking the keyword value ratio as a sample to obtain a mean value and a standard deviation value which accord with a Gaussian distribution rule, and constructing a key value ratio deviation interval based on the mean value and the standard deviation value;
and inputting the service request message into a test version test environment to obtain a second service response message output by the test version test environment, judging whether the value ratio of the key words in the second service response message is in the key value ratio deviation interval, if so, passing the test, and if not, testing abnormality.
In a second aspect, an embodiment of the present invention provides a regression testing apparatus based on fuzzy matching, including:
the data acquisition generator is used for inputting the service request message extracted from the production environment into the stable version test environment in the training stage, obtaining a first service response message output by the stable version test environment, and inputting the service request message extracted from the production environment into the test version test environment in the test stage, obtaining a second service response message output by the test version test environment;
the key value calculator is used for calculating the keyword value duty ratio in the first service response message in the training stage, and training the sample by taking the keyword value duty ratio as the sample to obtain the mean value and the standard deviation value which accord with the Gaussian distribution rule; calculating the keyword value duty ratio of the second service response message in the test stage;
the deviation analyzer is used for writing the mean value and the standard deviation value obtained in the training stage into a deviation standard library, and constructing a key value duty ratio deviation interval based on the mean value and the standard deviation value; and in the test stage, comparing whether the key value ratio in the two service response messages is in the key value ratio deviation interval, if so, judging that the test is passed, and if not, judging that the test is not passed.
In a third aspect, an embodiment of the present invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the fuzzy matching based regression testing method as provided in the first aspect when executing the program.
In a fourth aspect, embodiments of the present invention provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the fuzzy matching based regression testing method as provided by the first aspect.
The embodiment of the invention provides a regression testing method and device based on fuzzy matching, which are used for extracting a service request message of a production environment, converting and inputting the service request message into a stable version testing environment, configuring and cutting the keyword value content of a response message to be tested, taking a first response message output by the stable version testing environment as a training sample, calculating the number ratio of the keyword value to form a standard expected testing result, and comparing the number ratio of the keyword value obtained by a testing version with a standard value to obtain a testing conclusion; the regression case updating and the actual business fitting with the production can be simply and rapidly realized, and the analysis and judgment of the test result can be automatically adjusted along with the input change, so that the business scene design of professional testers is not needed, and the test coverage degree and the case updating efficiency are improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a regression testing method based on fuzzy matching according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a sample training embodiment according to the present invention;
FIG. 3 is a block diagram of a fuzzy matching based regression testing apparatus according to an embodiment of the present invention;
FIG. 4 is a flow chart of a traffic test phase according to an embodiment of the invention;
fig. 5 is a schematic physical structure of an electronic device according to an embodiment of the invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Regression testing refers to the process of revising a program, and then re-testing to confirm that the revisions do not introduce new errors or cause other code errors, and the regression testing is used as a part of the life cycle of the program and occupies a large workload weight in the whole process test. Multiple regression testing is performed at various stages of program development. Continuous release of new versions of programs in progressive and rapid iterative development makes regression testing more frequent, whereas in the extreme programming approach, regression testing is more required to be performed several times per day.
Although the development mode of the current automation use case can accurately judge the test conclusion, the situation of incomplete coverage or inconformity with reality still exists because most of the writing of regression cases are combined with the business scene of actual design of production operation according to experience by professional testers; meanwhile, the automatic test case writing requires the test developer to preset an input message, meanwhile writes an expected output message, compares the expected output with the tested output, and considers the expected output to pass the test when the result is consistent, so that the development and maintenance flow of each regression case is complex, the time consumption is long, and the labor cost is high.
Therefore, according to the embodiment of the invention, the standard value and the standard value of different value ratios of key words of the service response message are analyzed by sample training calculation in a normal environment, then the interval deviation comparison analysis is carried out on the response message result obtained by the test version and the standard value, and whether the test result meets the expectations is automatically verified, so that the current situations of incomplete coverage of regression test cases, update lag, high case maintenance input cost and the like caused by service development change are solved. The following description and description will be made with reference to various embodiments.
Fig. 1 is a regression testing method based on fuzzy matching according to an embodiment of the present invention, including:
s1, inputting a service request message in a production environment into a stable version test environment, and obtaining a first service response message output by the stable version test environment; calculating the keyword value ratio in the first service response message, training by taking the keyword value ratio as a sample to obtain a mean value and a standard deviation value which accord with a Gaussian distribution rule, and constructing a key value ratio deviation interval based on the mean value and the standard deviation value;
s2, inputting the service request message into a test version test environment, obtaining a second service response message output by the test version test environment, judging whether the key value duty ratio in the second service response message is in the key value duty ratio deviation interval, if so, testing to pass, and if not, testing to be abnormal.
In this embodiment, step S1 is mainly for performing sample training, extracting a service request packet of a production environment, converting the service request packet to a stable version test environment with a stable version, simply configuring and cutting the keyword value content of a response packet to be tested, taking the response packet output by the stable version test environment as a training sample, calculating the number ratio of each keyword value to form a standard expected test result, analyzing the standard value and standard difference value of different value ratios of each keyword of the service response packet, comparing the number ratio of each keyword value obtained by the test version with the standard value in intervals to obtain a test conclusion, comparing the interval deviation of the response packet result obtained by the test version with the standard value, and automatically verifying whether the test result meets the expected requirement. The method for accurately comparing the test result with the expected result and judging the test conclusion in the past is broken through, and the regression test result is judged by adopting a data training method based on statistical analysis and a result interval matching comparison method. The problems of incomplete coverage, delayed updating, high case maintenance investment and the like of regression test cases caused by service development changes are solved, the test scene can be simply and rapidly extracted and updated from the production environment, manual design is not needed, interference and intervention of test personnel are not needed, and the fitting degree of the test scene and the reduction of human resources are greatly improved.
On the basis of the above embodiment, the method for inputting the service request message in the production environment into the stable version test environment, as shown in fig. 2, specifically includes:
s11, releasing the version of the test environment into a stable version consistent with the current production environment to obtain a stable version test environment;
s12, extracting a set number of service request messages from a production environment, and converting the service request messages into message formats matched with the input of a stable version test environment;
s13, inputting the service request message into the stable version test environment, and obtaining a first service response message output by the stable version test environment.
In this embodiment, the version of the test environment is issued into a stable version consistent with the current production environment, a certain time interval and a set number of service request messages are extracted from the production environment according to the requirement, the service request messages are converted into a message format which can be used by the test input of the test environment, the simulated service request messages are changed into the test environment, the corresponding service response messages are obtained, and when the regression case is required to be updated, the purpose can be achieved by simply extracting the service request messages from the production environment.
On the basis of the foregoing embodiments, calculating the keyword value ratio in the first service response packet, as shown in fig. 2, specifically includes:
s14, formatting the first service response message to form a key value pair sequence of message type, key words and values;
calculating a duty ratio combination matrix of various values of the keywords:
in the method, in the process of the invention,KEY in response message for first business i Various submatrices with value ratio v i1 ~v im Is KEY word KEY i M is KEY i Total number of values in the first service response message,/->Is KEY word KEY i The number of the occurrences of the value vik is the value duty ratio occupied by the corresponding first service response message, and n is the number of the keywords in the first service response message.
In this embodiment, the received corresponding response message (first service response message in this embodiment) needs to be formatted to form a KEY pair sequence of the message type, a KEY pair sequence of the KEY and a KEY pair sequence of the value, such as [ MessageType, (KEY) 1 ,value 11 ),(KEY 2 ,value 21 ),(KEY 3 ,value 31 ),…]Etc.
Calculation ofThe ratio combination matrix of each value of the key word is calculated, namely the ratio combination matrix T of each value of the key word in the response message corresponding to the test of the round is calculated (KEY) The expression is as follows:
on the basis of the above embodiments, training with the keyword value ratio as a sample to obtain a mean value and a standard deviation value conforming to a gaussian distribution rule, and constructing a key value ratio deviation interval based on the mean value and the standard deviation value, as shown in fig. 2, specifically including:
s15, calculatingAnd constructing a key value occupation ratio deviation interval (mu-3 sigma, mu+3 sigma) based on the mean value mu and the standard deviation sigma, and writing the mean value mu and the standard deviation sigma into a deviation standard library for storage.
In this embodiment, the received keyword value duty ratio of multiple rounds of testing is used as a sample to calculate that the keyword value duty ratio conforms to the gaussian distribution law N (μ, σ) 2 ) The average value mu and the standard deviation sigma of the key words can be calculated to obtain the ratio combination matrix T of various values of each key word in the test environment output response message when the service request message extracted from the production environment under normal condition is used as the simulation test input ((KEY) All elements obey the mean mu and standard deviation sigma of the Gaussian distribution law; and writing the mean mu and the standard deviation sigma into a standard deviation library for storage.
After the steps are finished, the corresponding service request message can be used in multiple tests, corresponding training is not needed before each test, and only when the scene of a test case is updated or the format of the service message is changed, the test is needed to perform parameter configuration, sample training and calculate the corresponding mathematical expected value mu and standard deviation sigma.
On the basis of the foregoing embodiments, before formatting the first service response packet, the method further includes:
and configuring the message type, the key word and the key word value to be tested in the first service response message.
In this embodiment, the configuration of the message type, the keyword of the message, and the value of the keyword, which need to be tested, in the response message is also needed in advance, where the value of the keyword can be flexibly configured according to the actual needs. For example, a key to enumerate values may be set as a default, i.e., each value is subject to statistical analysis; for the numerical key words, the numerical key words can be set to interval range values for statistical analysis; for character type keywords, statistical analysis can be performed by adopting a regular expression matching method of partial characters or a value method of character number statistics.
On the basis of the above embodiments, determining whether the key value duty ratio in the second service response message is within the key value duty ratio deviation interval specifically includes:
and calculating the value duty ratio of each keyword in the second service response message, and judging whether the value duty ratio of each keyword is in the key value duty ratio deviation interval.
Specifically, if the value ratio is within the key value ratio deviation interval, judging that the value ratio of the corresponding key word meets the test requirement, and passing the test;
if the value ratio is not in the key value ratio deviation interval, judging that the value ratio of the corresponding key word is not in accordance with the test requirement, and outputting a test failure result and related data.
In this embodiment, when testing is performed, different value ratios of each value of each keyword in the test response message of the present round are compared with standard ratio data corresponding to the values stored in the deviation standard library, if there is a test value outside a key value ratio deviation interval (μ -3σ, μ+3σ), it is indicated that there is an abnormality in the test result of the corresponding value of the keyword, a test failure result and related data are output to a tester for analysis, otherwise, the test is passed, a random deviation of the output result due to jitter variation of the test environment is compensated and corrected, and accuracy of the test conclusion is ensured.
Fig. 3 shows a regression testing apparatus based on fuzzy matching, which is based on the regression testing method based on fuzzy matching in the above embodiments, including a data acquisition generator 30, a key value calculator 40, and a deviation analyzer 50, wherein:
the data acquisition generator 30 inputs the service request message extracted from the production environment into the stable version test environment in the training stage, acquires the first service response message output by the stable version test environment, inputs the service request message extracted from the production environment into the test version test environment in the test stage, and acquires the second service response message output by the test version test environment;
the key value calculator 40 calculates the keyword value duty ratio in the first service response message in the training stage, and trains the sample with the keyword value duty ratio to obtain the average value and the standard deviation value which accord with the Gaussian distribution rule; calculating the keyword value duty ratio of the second service response message in the test stage;
the deviation analyzer 50 writes the mean value and the standard deviation value obtained in the training stage into a deviation standard library, and constructs a key value duty ratio deviation interval based on the mean value and the standard deviation value; and in the test stage, comparing whether the key value ratio in the two service response messages is in the key value ratio deviation interval, if so, judging that the test is passed, and if not, judging that the test is not passed.
Specifically, in this embodiment, the data acquisition generator 30 extracts service request messages with a certain time interval from the production environment according to the requirements of the testers, and performs simple target address conversion on the service request messages to change the service request messages into simulated service request message input of the test environment. The advantage of this is that when the regression case update is needed, the goal can be achieved by simply extracting the service request message from the production environment.
In this embodiment, the key value calculator 40 receives the service response message output by the test environment, calculates the duty ratio distribution of the values of the keywords in the test response message of the present round according to the detection configuration information, and outputs the duty ratio distribution to the deviation analyzer 50 for processing. The system comprises a detection configuration module 401, a message analysis module 402, a value duty ratio calculation module 403 and the like.
Specifically, the detection configuration module 401 is responsible for configuring the message type, the keyword of the message and the value of the keyword to be tested in the response message, where the value of the keyword can be flexibly configured according to the actual requirement. For example, a key to enumerate values may be set as a default, i.e., each value is subject to statistical analysis; for the numerical key words, the numerical key words can be set to interval range values for statistical analysis; for character type keywords, statistical analysis can be performed by adopting a regular expression matching method of partial characters or a value method of character number statistics.
The message parsing module 402 is responsible for formatting the received corresponding response message (first service response message in this embodiment) to form a KEY pair sequence of message types, a KEY pair sequence of keywords and a KEY pair sequence of values, such as [ MessageType, (KEY) 1 ,value 11 ),(KEY 2 ,value 21 ),(KEY 3 ,value 31 ),…]Etc.
Formatting the first service response message to form a key value pair sequence of message type, key words and value values;
the value-taking-ratio calculation module 403 calculates a combination matrix of the duty ratios in which various values of the keyword appear:
in the method, in the process of the invention,KEY in response message for first business i Various submatrices with value ratio v i1 ~v im Is KEY word KEY i M is KEY i At the first stageTotal number of values in service response message, < >>Is KEY word KEY i The number of the occurrences of the value vik is the value duty ratio occupied by the corresponding first service response message, and n is the number of the keywords in the first service response message.
In this embodiment, the deviation analyzer 50 is configured to calculate a duty matrix T of various values of each keyword in the test environment output response message when the service request message normally extracted from the production environment is used as the simulation test input (KEY) All elements obey the mean mu and standard deviation sigma of the Gaussian distribution law; under the test condition, if the keyword value duty ratio in the test result is outside the corresponding probability interval (mu-3 sigma, mu+3 sigma), the test is not passed, and otherwise, the test is passed. The deviation analyzer 50 includes four components, namely a mode switch 501, a deviation standard library 502, a distribution calculation module 503, and a deviation comparison module 504.
Specifically, the mode switch 501 is used to set the current functional state of the fuzzy matching regression testing device, and includes two modes, namely "training" and "testing". When the mode switch 501 is in a training and learning state, the device is in a training and learning state, and the deviation analyzer 50 inputs the value of each keyword of the current round test output by the key value calculator 40 as a training sample to the distribution calculation module 503 for processing; when the mode switch 501 is "test", the device is in a test state, and the deviation analyzer 50 inputs the value of each keyword of the current round of test output by the key value calculator 40 to the deviation comparison module 504 for comparison.
The standard deviation library 502 is used for storing the various values of the keywords of the measured response message calculated by the distribution calculation module 503Mean mu and standard deviation sigma of (c).
The distribution calculation module 503 is active when the mode switch 501 is set to "training" when it sums up the received key value calculator 40The duty ratio combination matrix T of each keyword value of the output multi-round test response message (KEY) Calculate each elementThe mean μ and standard deviation σ that conform to the gaussian distribution law are then written into the standard deviation library 502 for storage.
The deviation comparing module 504 takes effect when the mode switch 501 is set to "test", at this time, it receives different duty ratios of each keyword value of the test response message of the present round output by the key value calculator 40, compares the different duty ratios with the corresponding standard duty ratio data stored in the deviation standard library 502, and if the test value falls outside (μ -3σ, μ+3σ), it indicates that the keyword duty ratio does not meet the test requirement, and the test fails.
Specifically, in this embodiment, the training phase includes:
1) Setting the type of response message, the key words of the message and the value content of the key words to be tested in a detection configuration module 401 of the key value calculator 40;
2) Releasing the version of the test environment into a stable version consistent with the current production environment;
3) The data acquisition generator 30 extracts a number of service request messages from the production environment, converting them into a message format that can be used by the test environment test input;
4) The data acquisition generator 30 inputs the converted service request message into the test environment, the key value calculator 40 acquires the corresponding service response message, calculates the different value duty ratio matrix combinations of each keyword in the corresponding tested response message of the round of test, and outputs the duty ratio matrix combinations to the deviation analyzer 50;
5) Repeating the operation of the step 4) for a plurality of rounds;
6) The deviation analyzer 50 takes the ratio of the key values of the received multiple rounds of tests as a sample, and calculates that the key values accord with the Gaussian distribution law N (mu, sigma) 2 ) And the standard deviation sigma and write them into the standard deviation library 502 for storage.
After training, the corresponding service request message can be used in multiple tests, the corresponding training is not needed before each test, and only when the scene of a test case is updated or the format of the service message is changed, the test designer is required to intervene in parameter configuration, sample training and calculation of the corresponding mathematical expected value mu and standard deviation sigma.
As shown in fig. 4, the service testing phase specifically includes:
a tester issues a version of the test environment as a version to be tested;
the data acquisition generator 30 inputs the service request message which is extracted and converted previously into the test environment, the key value calculator 40 calculates the occupation ratio of different values of each keyword in the response message, and outputs the occupation ratio to the deviation analyzer 50;
the deviation analyzer 50 compares the obtained duty ratio value with the data stored in the deviation standard library 502, if the duty ratio value is outside (μ -3σ, μ+3σ) (i.e., probability interval in fig. 4), it indicates that the test result of the corresponding value of the keyword is abnormal, then the test failure result and related data are output to the tester for analysis, otherwise, the test is passed, and a test conclusion, an abnormal deviation list and an abnormal deviation key value list are generated and then output.
Fig. 5 is a schematic entity structure diagram of an electronic device according to an embodiment of the present invention, where, as shown in fig. 5, the electronic device may include: processor 810, communication interface (Communications Interface) 820, memory 830, and communication bus 840, wherein processor 810, communication interface 820, memory 830 accomplish communication with each other through communication bus 840. The processor 810 may call a computer program stored on the memory 830 and executable on the processor 810 to perform the fuzzy matching based regression testing method provided by the above embodiments, for example, including:
s1, inputting a service request message in a production environment into a stable version test environment, and obtaining a first service response message output by the stable version test environment; calculating the keyword value ratio in the first service response message, training by taking the keyword value ratio as a sample to obtain a mean value and a standard deviation value which accord with a Gaussian distribution rule, and constructing a key value ratio deviation interval based on the mean value and the standard deviation value;
s2, inputting the service request message into a test version test environment, obtaining a second service response message output by the test version test environment, judging whether the key value duty ratio in the second service response message is in the key value duty ratio deviation interval, if so, testing to pass, and if not, testing to be abnormal.
Further, the logic instructions in the memory 830 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art or a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Embodiments of the present invention also provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the fuzzy matching based regression testing method provided by the above embodiments, for example, including:
s1, inputting a service request message in a production environment into a stable version test environment, and obtaining a first service response message output by the stable version test environment; calculating the keyword value ratio in the first service response message, training by taking the keyword value ratio as a sample to obtain a mean value and a standard deviation value which accord with a Gaussian distribution rule, and constructing a key value ratio deviation interval based on the mean value and the standard deviation value;
s2, inputting the service request message into a test version test environment, obtaining a second service response message output by the test version test environment, judging whether the key value duty ratio in the second service response message is in the key value duty ratio deviation interval, if so, testing to pass, and if not, testing to be abnormal.
Embodiments of the present invention also provide that the present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions that, when executed by a computer, are capable of performing a fuzzy matching based regression testing method as described above, for example comprising:
s1, inputting a service request message in a production environment into a stable version test environment, and obtaining a first service response message output by the stable version test environment; calculating the keyword value ratio in the first service response message, training by taking the keyword value ratio as a sample to obtain a mean value and a standard deviation value which accord with a Gaussian distribution rule, and constructing a key value ratio deviation interval based on the mean value and the standard deviation value;
s2, inputting the service request message into a test version test environment, obtaining a second service response message output by the test version test environment, judging whether the key value duty ratio in the second service response message is in the key value duty ratio deviation interval, if so, testing to pass, and if not, testing to be abnormal.
In summary, according to the regression testing method and device based on fuzzy matching provided by the embodiment of the invention, the service request message of the production environment is extracted and converted and input to the environment with stable version test, the keyword value content of the response message to be tested is configured and cut, the first response message output by the stable version test environment is used as a training sample, the number ratio of the keyword value is calculated to form the expected test result of the standard, and then the interval comparison is carried out between the number ratio of the keyword value obtained by the test version and the standard value to obtain the test conclusion; the regression case updating and the actual business fitting with the production can be simply and rapidly realized, and the analysis and judgment of the test result can be automatically adjusted along with the input change, so that the business scene design of professional testers is not needed, and the test coverage degree and the case updating efficiency are improved.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (9)
1. A regression testing method based on fuzzy matching, comprising:
inputting a service request message in a production environment into a stable version test environment to obtain a first service response message output by the stable version test environment; calculating the keyword value ratio in the first service response message, training by taking the keyword value ratio as a sample to obtain a mean value and a standard deviation value which accord with a Gaussian distribution rule, and constructing a key value ratio deviation interval based on the mean value and the standard deviation value;
inputting the service request message into a test version test environment to obtain a second service response message output by the test version test environment, judging whether the value ratio of a key word in the second service response message is in the key value ratio deviation interval, if so, passing the test, and if not, testing abnormality;
the calculating the value ratio of the key words in the first service response message specifically includes:
formatting the first service response message to form a key value pair sequence consisting of a message type, a keyword and a value;
calculating a duty ratio combination matrix of various values of the keywords:
wherein T is (KEYi) KEY in response message for first business i Various submatrices with value ratio v i1 ~v im Is KEY word KEY i M is KEY i The total number of values in the first service response message,is KEY word KEY i Is of value v ik The number of occurrences is in the corresponding first service response messageThe value of the occupation is the occupation ratio, and n is the number of keywords in the first service response message.
2. The regression testing method based on fuzzy matching of claim 1, wherein the inputting the service request message in the production environment to the stable version testing environment specifically comprises:
releasing the version of the test environment into a stable version consistent with the current production environment to obtain a stable version test environment;
and extracting a set number of service request messages from the production environment, converting the service request messages into message formats matched with the input of the stable version test environment, and obtaining a first service response message output by the stable version test environment.
3. The regression testing method based on fuzzy matching according to claim 1, wherein the average value and the standard deviation value conforming to the gaussian distribution rule are obtained by training the sample with the keyword value ratio, and the key value ratio deviation interval is constructed based on the average value and the standard deviation value, specifically comprising:
4. The fuzzy matching based regression testing method of claim 1, further comprising, prior to formatting the first business response message:
and configuring the message type, the key word and the key word value to be tested in the first service response message.
5. The regression testing method based on fuzzy matching of claim 1, wherein determining whether the key value duty cycle in the second service response message is within the key value duty cycle deviation interval comprises:
and calculating the value duty ratio of each keyword in the second service response message, and judging whether the value duty ratio of each keyword is in the key value duty ratio deviation interval.
6. The regression testing method based on fuzzy matching of claim 5, wherein if the test is passed, if the test is abnormal, the method specifically comprises:
if the value ratio is within the key value ratio deviation interval, judging that the value ratio of the corresponding key word meets the test requirement, and passing the test;
if the value ratio is not in the key value ratio deviation interval, judging that the value ratio of the corresponding key word is not in accordance with the test requirement, and outputting a test failure result and related data.
7. Regression testing device based on fuzzy matching, characterized by comprising:
the data acquisition generator is used for inputting the service request message extracted from the production environment into the stable version test environment in the training stage, obtaining a first service response message output by the stable version test environment, and inputting the service request message extracted from the production environment into the test version test environment in the test stage, obtaining a second service response message output by the test version test environment;
the key value calculator is used for calculating the keyword value duty ratio in the first service response message in the training stage, and training the sample by taking the keyword value duty ratio as the sample to obtain the mean value and the standard deviation value which accord with the Gaussian distribution rule; calculating the keyword value duty ratio of the second service response message in the test stage;
the calculating the value ratio of the key words in the first service response message specifically includes:
formatting the first service response message to form a key value pair sequence consisting of a message type, a keyword and a value;
calculating a duty ratio combination matrix of various values of the keywords:
wherein T is (KEYi) KEY in response message for first business i Various submatrices with value ratio v i1 ~v im Is KEY word KEY i M is KEY i The total number of values in the first service response message,is KEY word KEY i Is of value v ik The number of occurrences is the value duty ratio occupied in the corresponding first service response message, and n is the number of keywords in the first service response message;
the deviation analyzer is used for writing the mean value and the standard deviation value obtained in the training stage into a deviation standard library, and constructing a key value duty ratio deviation interval based on the mean value and the standard deviation value; and in the test stage, comparing whether the key value ratio in the two service response messages is in the key value ratio deviation interval, if so, judging that the test is passed, and if not, judging that the test is not passed.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the fuzzy matching based regression testing method of any one of claims 1 to 6 when the program is executed.
9. A non-transitory computer readable storage medium, having stored thereon a computer program, which when executed by a processor, implements the steps of the fuzzy matching based regression testing method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811392842.0A CN111209180B (en) | 2018-11-21 | 2018-11-21 | Regression testing method and device based on fuzzy matching |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811392842.0A CN111209180B (en) | 2018-11-21 | 2018-11-21 | Regression testing method and device based on fuzzy matching |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111209180A CN111209180A (en) | 2020-05-29 |
CN111209180B true CN111209180B (en) | 2023-04-25 |
Family
ID=70788266
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811392842.0A Active CN111209180B (en) | 2018-11-21 | 2018-11-21 | Regression testing method and device based on fuzzy matching |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111209180B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111930612B (en) * | 2020-07-09 | 2024-03-19 | 北京皮尔布莱尼软件有限公司 | Code updating correctness detection method and device and computing equipment |
CN113553260B (en) * | 2021-07-22 | 2022-07-19 | 工银科技有限公司 | Test method, test apparatus, device, and medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2011034805A1 (en) * | 2009-09-17 | 2011-03-24 | Siemens Aktiengesellschaft | Supervised fault learning using rule-generated samples for machine condition monitoring |
CN104657248A (en) * | 2013-11-21 | 2015-05-27 | 中国移动通信集团山东有限公司 | Java thread stack analysis method and system |
CN105046045A (en) * | 2015-06-05 | 2015-11-11 | 河海大学 | Bayesian combination-based Web service QoS prediction method |
JP2017134682A (en) * | 2016-01-28 | 2017-08-03 | 株式会社Lifull | Information processing system and information processing method |
CN107066381A (en) * | 2017-02-27 | 2017-08-18 | 网易(杭州)网络有限公司 | Generate method, device and the equipment of the test analysis report based on image recognition |
CN107086935A (en) * | 2017-06-16 | 2017-08-22 | 重庆邮电大学 | Flow of the people distribution forecasting method based on WIFI AP |
CN108446711A (en) * | 2018-02-01 | 2018-08-24 | 南京邮电大学 | A kind of Software Defects Predict Methods based on transfer learning |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11494293B2 (en) * | 2014-11-18 | 2022-11-08 | King.Com Limited | Testing systems and methods |
-
2018
- 2018-11-21 CN CN201811392842.0A patent/CN111209180B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2011034805A1 (en) * | 2009-09-17 | 2011-03-24 | Siemens Aktiengesellschaft | Supervised fault learning using rule-generated samples for machine condition monitoring |
CN102498445A (en) * | 2009-09-17 | 2012-06-13 | 西门子公司 | Supervised fault learning using rule-generated samples for machine condition monitoring |
CN104657248A (en) * | 2013-11-21 | 2015-05-27 | 中国移动通信集团山东有限公司 | Java thread stack analysis method and system |
CN105046045A (en) * | 2015-06-05 | 2015-11-11 | 河海大学 | Bayesian combination-based Web service QoS prediction method |
JP2017134682A (en) * | 2016-01-28 | 2017-08-03 | 株式会社Lifull | Information processing system and information processing method |
CN107066381A (en) * | 2017-02-27 | 2017-08-18 | 网易(杭州)网络有限公司 | Generate method, device and the equipment of the test analysis report based on image recognition |
CN107086935A (en) * | 2017-06-16 | 2017-08-22 | 重庆邮电大学 | Flow of the people distribution forecasting method based on WIFI AP |
CN108446711A (en) * | 2018-02-01 | 2018-08-24 | 南京邮电大学 | A kind of Software Defects Predict Methods based on transfer learning |
Non-Patent Citations (2)
Title |
---|
吴定海, 张培林, 任国全, 傅建平.基于最大间隔超球分类器的柴油机异常检测研究.《兵工学报》.2011,第32卷(第7期),全文. * |
苏师师.基于元数据的DNS异常检测系统设计与实现.《中北大学 硕士学位论文集》.2018,(第10期),全文. * |
Also Published As
Publication number | Publication date |
---|---|
CN111209180A (en) | 2020-05-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112052172B (en) | Rapid test method and device for third-party channel and electronic equipment | |
CN109002391A (en) | The method of automatic detection embedded software interface testing data | |
CN112241360A (en) | Test case generation method, device, equipment and storage medium | |
CN112199293A (en) | Software quality evaluation method and device, terminal equipment and storage medium | |
US20240045752A1 (en) | Methods and apparatuses for troubleshooting a computer system | |
CN111209180B (en) | Regression testing method and device based on fuzzy matching | |
CN109344074B (en) | Cross-platform automatic testing method and system | |
CN113051180A (en) | Test task monitoring method, device, equipment and storage medium | |
CN112231229B (en) | Web UI automatic test method, system, electronic equipment and readable storage medium | |
CN112598326A (en) | Model iteration method and device, electronic equipment and storage medium | |
CN116431522A (en) | Automatic test method and system for low-code object storage gateway | |
CN109508204B (en) | Front-end code quality detection method and device | |
CN115168217A (en) | Defect discovery method and device for source code file | |
CN107229487B (en) | Code processing method and device | |
US11847393B2 (en) | Computing device and method for developing a system model utilizing a simulation assessment module | |
CN117472641B (en) | Data quality detection method and device, electronic equipment and storage medium | |
CN118394313B (en) | Application program rapid construction method suitable for various personnel | |
CN117112398B (en) | Incremental code coverage rate detection method and device, electronic equipment and storage medium | |
CN113010424B (en) | Interface automatic test processing method, system, computer equipment and storage medium | |
CN117193798A (en) | Application deployment method, apparatus, device, readable storage medium and program product | |
CN118672928A (en) | Automatic testing method and device for batch processing system and electronic equipment | |
CN116303029A (en) | Analysis method and device for test cases, processor and electronic equipment | |
CN110716855A (en) | Processor instruction set testing method and device | |
CN115878482A (en) | Product testing method and related device | |
CN116662148A (en) | Method, device and related equipment for generating test cases |
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 |