Microservice testing method, device and computer equipment based on dual data

The dual-data-based microservice testing method addresses the limitations of traditional testing by employing real-time data collection and virtual light refraction principles to enhance accuracy, flexibility, and efficiency in evaluating microservice quality.

CN111475389BActive Publication Date: 2024-12-10CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010148246.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-05
Publication Date
2024-12-10
Estimated Expiration
2040-03-05

AI Technical Summary

Technical Problem

Traditional microservice testing methods suffer from insufficient accuracy, flexibility, and efficiency due to the use of single data and abstract data processing.

Method used

A microservice testing method based on dual data, involving real-time data collection, extraction of dynamic and static feature data, generation of a virtual medium layer with specific refractive index and thickness, and use of a virtual light source to determine light spot formation and distance, to assess microservice quality.

Benefits of technology

Improves the accuracy and flexibility of microservice testing, enhancing test efficiency by using comprehensive analysis of dynamic and static data and virtual light refraction principles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111475389B_ABST
    Figure CN111475389B_ABST
Patent Text Reader

Abstract

The present application discloses a microservice testing method, device, computer equipment and storage medium based on dual data, the method comprising: receiving a test instruction for testing a microservice; collecting data of the microservice in real time within a specified time, and extracting first characteristic data and second characteristic data; obtaining a specified refractive index corresponding to the first characteristic data, and obtaining a specified thickness corresponding to the second characteristic data; generating a virtual medium layer; generating a virtual light source, and using the virtual light source to emit a virtual light to the top of the virtual medium layer along a specified direction; if the bottom of the virtual medium layer presents a light spot formed by the virtual light, then obtaining the light spot position, and calculating the distance between the light spot position and a preset standard position; if the distance is not greater than a preset distance threshold, then determining that the microservice test has passed. This improves the accuracy and flexibility of the test and improves the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a microservice testing method, apparatus, computer equipment and storage medium based on dual data. Background Art

[0002] Microservices in the computer field are extremely small units that provide macro services. The quality of a computer service product is closely related to the quality of microservices. To obtain the quality of microservices, microservices need to be tested. At present, traditional testing of microservices is generally performed by obtaining information after users use microservices for analysis (for example, obtaining data changes before and after users use microservices, etc.). However, the above traditional microservice testing methods have the defects of single data and abstract data processing, which leads to the shortcomings of insufficient accuracy, insufficient flexibility and low efficiency of testing. Summary of the invention

[0003] The main purpose of this application is to provide a microservice testing method, device, computer equipment and storage medium based on dual data, aiming to improve the accuracy and flexibility of the test and improve the test efficiency.

[0004] In order to achieve the above-mentioned invention object, the present application proposes a microservice testing method based on dual data, comprising the following steps:

[0005] Receive test instructions for testing microservices;

[0006] According to the test instruction, the data of the microservice is collected in real time within a specified time, and according to a preset feature data extraction method, first feature data and second feature data are extracted from the data of the microservice, wherein the first feature data is dynamic data and the second feature data is static data;

[0007] According to the correspondence between the preset data and the refractive index, a specified refractive index corresponding to the first characteristic data is obtained, and according to the correspondence between the preset data and the thickness, a specified thickness corresponding to the second characteristic data is obtained;

[0008] In a preset virtual space, a virtual medium layer is generated, wherein the refractive index of the virtual medium layer is equal to the specified refractive index, the thickness of the virtual medium layer is equal to the specified thickness, the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, and the virtual space complies with the principle of light refraction;

[0009] Generate a virtual light source at a specified position above the top of the virtual medium layer, and use the virtual light source to emit a virtual light ray toward the top of the virtual medium layer along a specified direction, wherein the angle between the specified direction and the virtual medium layer is not a right angle;

[0010] Determining whether the bottom of the virtual medium layer presents a light spot formed by the virtual light;

[0011] If a light spot formed by the virtual light beam appears at the bottom of the virtual medium layer, the light spot position is acquired, and a distance between the light spot position and a preset standard position is calculated, wherein the standard position is located at the bottom of the virtual medium layer;

[0012] Determining whether the distance is greater than a preset distance threshold;

[0013] If the distance is not greater than a preset distance threshold, it is determined that the microservice test has passed.

[0014] Furthermore, the step of extracting the first feature data from the data of the microservice according to the preset feature data extraction method includes:

[0015] According to a preset dynamic data selection method, the specified dynamic data is selected from all the dynamic data of the microservice, and the specified dynamic data is divided into m first sub-dynamic data segments of equal length, where m is an integer greater than 1;

[0016] and calling pre-stored standard dynamic data, and dividing the standard dynamic data into m segments of second sub-dynamic data of equal duration, wherein the duration of the first sub-dynamic data is equal to that of the second sub-dynamic data, and the m segments of the first sub-dynamic data correspond to the m segments of the second sub-dynamic data one by one;

[0017] According to a preset sub-data similarity calculation method, the similarity between the first sub-dynamic data and the second sub-dynamic data is calculated accordingly, thereby obtaining m similarity values ​​accordingly;

[0018] Using a preset counter, counting the m similarity values ​​according to a preset counting rule;

[0019] A final count of the counter is read, and the final count is recorded as the first feature data.

[0020] Furthermore, the step of selecting the specified dynamic data from all the dynamic data of the microservice according to the preset dynamic data selection method includes:

[0021] Obtaining intermediate dynamic data from all dynamic data of the microservice, wherein a specified ratio of the intermediate dynamic data is greater than other dynamic data, and the specified ratio refers to a ratio obtained by dividing the maximum value of the dynamic data within the specified time by the average value of the corresponding dynamic data within the specified time;

[0022] Obtaining the differential value of the intermediate dynamic data within the specified time, and obtaining the number of zero values ​​when the differential value is equal to 0, and determining whether the number of zero values ​​is greater than a preset number threshold;

[0023] If the number of zero values ​​is greater than a preset number threshold, the intermediate dynamic data is recorded as the designated dynamic data.

[0024] Furthermore, the step of correspondingly calculating the similarity between the first sub-dynamic data and the second sub-dynamic data includes:

[0025] Obtaining a time expression function f(t) of the first sub-dynamic data, and obtaining a corresponding time expression function F(t) of the second sub-dynamic data;

[0026] According to the formula:

[0027] Calculate the similarity evaluation function M(t), where min is the minimum function, L is a preset similarity evaluation parameter greater than 0, and t is time;

[0028] According to the formula: Similarity value = similarity time length / (similar time length + dissimilar time length), the similarity value of the first sub-dynamic data and the second sub-dynamic data is calculated, wherein the similarity time length refers to the time length when the similarity evaluation function M(t) is not equal to L, and the dissimilar time length refers to the time length when the similarity evaluation function M(t) is equal to L.

[0029] Furthermore, if the bottom of the virtual medium layer presents a light spot formed by the virtual light, then obtaining the light spot position, and calculating the distance between the light spot position and a preset standard position, wherein the standard position is located before the step of the bottom of the virtual medium layer, includes:

[0030] Emitting a virtual ray at the designated position along the designated direction toward the top of the virtual medium layer, wherein the virtual ray still maintains straight-line propagation between any media;

[0031] An intersection point between the virtual medium layer and the virtual ray is obtained, and the intersection point is recorded as the standard position.

[0032] Further, after the step of determining whether the distance is greater than a preset distance threshold, the following steps are included:

[0033] If the distance is greater than a preset distance threshold, acquiring a cut plane according to a preset plane acquisition method, wherein the cut plane is parallel to the bottom surface of the virtual medium layer, and the cut plane intersects with the virtual medium layer;

[0034] Obtaining a first intersection point between the intercepting plane and the virtual ray, and obtaining a second intersection point between the intercepting plane and the virtual ray;

[0035] Calculating the distance between the first intersection point and the second intersection point, and determining whether the distance between the first intersection point and the second intersection point is equal to the distance threshold;

[0036] If the distance between the first intersection point and the second intersection point is equal to the distance threshold, the distance value between the interception plane and the bottom surface of the virtual medium layer is obtained, and improvement reminder information for improving the microservice is generated, wherein the improvement reminder information is attached with the distance value.

[0037] The present application provides a microservice testing device based on dual data, comprising:

[0038] A test instruction receiving unit, used to receive a test instruction for testing a microservice;

[0039] A data collection unit, configured to collect data of the microservice in real time within a specified time according to the test instruction, and extract first feature data and second feature data from the data of the microservice according to a preset feature data extraction method, wherein the first feature data is dynamic data and the second feature data is static data;

[0040] a refractive index acquisition unit, configured to acquire a specified refractive index corresponding to the first characteristic data according to a correspondence between preset data and refractive index, and to acquire a specified thickness corresponding to the second characteristic data according to a correspondence between preset data and thickness;

[0041] A medium layer generating unit, configured to generate a virtual medium layer in a preset virtual space, wherein the refractive index of the virtual medium layer is equal to the specified refractive index, the thickness of the virtual medium layer is equal to the specified thickness, the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, and the virtual space complies with the principle of light refraction;

[0042] a light source generating unit, configured to generate a virtual light source at a designated position above the top of the virtual medium layer, and to emit a virtual light ray toward the top of the virtual medium layer along a designated direction using the virtual light source, wherein the angle between the designated direction and the virtual medium layer is not a right angle;

[0043] A light spot judging unit, used for judging whether the bottom of the virtual medium layer presents a light spot formed by the virtual light;

[0044] a light spot position acquisition unit, configured to acquire the light spot position if the bottom of the virtual medium layer presents the light spot formed by the virtual light, and calculate the distance between the light spot position and a preset standard position, wherein the standard position is located at the bottom of the virtual medium layer;

[0045] A distance threshold determination unit, used to determine whether the distance is greater than a preset distance threshold;

[0046] The test pass determination unit is used to determine that the microservice test has passed if the distance is not greater than a preset distance threshold.

[0047] The present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0048] The present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.

[0049] The dual-data-based microservice testing method, device, computer equipment and storage medium of the present application receive a test instruction for testing a microservice; collect the data of the microservice in real time within a specified time, and extract the first characteristic data and the second characteristic data; obtain the specified refractive index corresponding to the first characteristic data, and obtain the specified thickness corresponding to the second characteristic data; generate a virtual medium layer in a preset virtual space; generate a virtual light source at a specified position above the top of the virtual medium layer, and use the virtual light source to emit virtual light to the top of the virtual medium layer along a specified direction; if the bottom of the virtual medium layer presents a light spot formed by the virtual light, then obtain the light spot position, and calculate the distance between the light spot position and the preset standard position; if the distance is not greater than the preset distance threshold, then determine that the microservice test has passed. This improves the accuracy and flexibility of the test and improves the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 This is a flowchart of a dual-data-based microservice testing method according to an embodiment of the present application;

[0051] Figure 2 This is a schematic block diagram of the structure of a microservice testing device based on dual data according to an embodiment of the present application;

[0052] Figure 3 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.

[0053] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] Reference Figure 1 , the embodiment of the present application provides a microservice testing method based on dual data, comprising the following steps:

[0056] S1. Receive a test instruction for testing a microservice;

[0057] S2. According to the test instruction, the data of the microservice is collected in real time within a specified time, and according to a preset feature data extraction method, first feature data and second feature data are extracted from the data of the microservice, wherein the first feature data is dynamic data and the second feature data is static data;

[0058] S3, acquiring a specified refractive index corresponding to the first characteristic data according to a correspondence between preset data and refractive index, and acquiring a specified thickness corresponding to the second characteristic data according to a correspondence between preset data and thickness;

[0059] S4. In a preset virtual space, a virtual medium layer is generated, wherein the refractive index of the virtual medium layer is equal to the specified refractive index, the thickness of the virtual medium layer is equal to the specified thickness, the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, and the virtual space complies with the principle of light refraction;

[0060] S5, generating a virtual light source at a designated position above the top of the virtual medium layer, and using the virtual light source to emit a virtual light ray toward the top of the virtual medium layer along a designated direction, wherein the angle between the designated direction and the virtual medium layer is not a right angle;

[0061] S6, determining whether the bottom of the virtual medium layer presents a light spot formed by the virtual light;

[0062] S7. If a light spot formed by the virtual light beam appears at the bottom of the virtual medium layer, a light spot position is acquired, and a distance between the light spot position and a preset standard position is calculated, wherein the standard position is located at the bottom of the virtual medium layer;

[0063] S8. Determine whether the distance is greater than a preset distance threshold;

[0064] S9. If the distance is not greater than a preset distance threshold, it is determined that the microservice test has passed.

[0065] As described in step S1 above, a test instruction for testing a microservice is received. The microservice may be a single microservice or a set of multiple microservices. The purpose of the test instruction is to determine whether the quality of the microservice meets the standard.

[0066] As described in step S2 above, according to the test instruction, the data of the microservice is collected in real time within a specified time, and according to a preset feature data extraction method, first feature data and second feature data are extracted from the data of the microservice, wherein the first feature data is dynamic data and the second feature data is static data. The present application adopts a comprehensive analysis method of dynamic data and static data to avoid the possibility of inaccurate test results caused by single data. The preset feature data extraction method can be any feasible method, such as extracting pre-specified dynamic data and static data from the feature data, which are recorded as the first feature data and the second feature data, respectively. The first feature data is dynamic data, that is, it changes dynamically in time length, such as traffic value; the second feature data is static data, that is, it does not change in time length, such as the number of microservice code defects.

[0067] As described in step S3 above, according to the preset correspondence between data and refractive index, the specified refractive index corresponding to the first characteristic data is obtained, and according to the preset correspondence between data and thickness, the specified thickness corresponding to the second characteristic data is obtained. The specified refractive index and the specified thickness will be used as the refractive index and thickness of the virtual medium layer, so as to perform auxiliary data analysis to test the microservice. The preset correspondence between data and refractive index, for example, when the data is equal to the standard data, the corresponding refractive index is 1; when the data is extremely unequal to the standard data (for example, the difference is greater than the preset extreme value threshold), the corresponding refractive index is the pre-defined minimum refractive index; and then the interval between the minimum refractive index and 1 is divided into n equal-length intervals, which respectively correspond to data with similarity levels of 1 to n with the standard data (wherein the similarity level when the refractive index is the minimum refractive index is 0); wherein the similarity between data and standard data can be calculated by any feasible similarity method, for example, the absolute value of the difference between data and standard data is used as the similarity. The correspondence between data and refractive index, for example, conforms to a positive correlation; the correspondence between data and thickness, for example, conforms to a negative correlation.

[0068] As described in step S4 above, in a preset virtual space, a virtual medium layer is generated, wherein the refractive index of the virtual medium layer is equal to the specified refractive index, the thickness of the virtual medium layer is equal to the specified thickness, the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, and the virtual space conforms to the principle of light refraction. The present application adopts a concrete virtual medium layer to concretize the traditional abstract test method. Specifically, the refractive index of the virtual medium layer is equal to the specified refractive index, and the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, so that when the value of the refractive index of the virtual medium layer is too small (that is, the first characteristic data is too poor), total reflection will occur, and the test will fail at this time. Based on this, by observing whether total reflection occurs, a preliminary test can be achieved. Further, by setting the thickness of the virtual medium layer to be equal to the specified thickness to control the refractive optical path of the virtual light, the first characteristic data and the second characteristic data can be tested comprehensively (because the refractive optical path and the final spot position are related to the refractive index and thickness, that is, they are related to the first characteristic data and the second characteristic data).

[0069] As described in step S5 above, a virtual light source is generated at a specified position above the top of the virtual medium layer, and a virtual light source is used to emit virtual light to the top of the virtual medium layer along a specified direction, wherein the angle between the specified direction and the virtual medium layer is not a right angle. The specified direction can be any feasible direction. Due to the design consideration of total reflection, the specified direction is any direction other than a right angle. Since the refractive index of the virtual medium layer is set to be lower than the refractive index of the area outside the virtual medium layer, it is possible to use the total reflection or refraction characteristics of the virtual medium layer for auxiliary testing.

[0070] As described in the above step S6, it is determined whether the bottom of the virtual medium layer presents a light spot formed by the virtual light. If the bottom of the virtual medium layer does not present a light spot formed by the virtual light, it indicates that total reflection has occurred, that is, the first characteristic data is unqualified, resulting in failure of the microservice test; if the bottom of the virtual medium layer presents a light spot formed by the virtual light, it indicates that the refractive index is within the tolerance range, and therefore the preliminary test has passed.

[0071] As described in the above step S7, if the bottom of the virtual medium layer presents a light spot formed by the virtual light, the light spot position is obtained, and the distance between the light spot position and the preset standard position is calculated, wherein the standard position is located at the bottom of the virtual medium layer. The light spot position is affected by both the refractive index and the thickness, that is, it is directly related to the first characteristic data and the second characteristic data, and can therefore be used to evaluate the quality of microservices. Accordingly, by calculating the distance between the light spot position and the preset standard position, wherein the standard position is located at the bottom of the virtual medium layer, the concrete distance can be used as the analysis basis for the test of microservices. The standard position is the ideal position, that is, the position where the light spot should be when the first characteristic data and the second characteristic data are both ideal values.

[0072] As described in step S8 above, it is determined whether the distance is greater than a preset distance threshold. If the distance is greater than the preset distance threshold, it indicates that the microservice quality has not passed, and there is a problem with one or more of the first feature data and the second feature data; otherwise, it indicates that the microservice test has passed.

[0073] As described in step S9 above, if the distance is not greater than the preset distance threshold, the microservice test is determined to have passed. Since the distance represents the quality of the first feature data and the second feature data, if the distance is not greater than the preset distance threshold, that is, the quality of the first feature data and the second feature data are both within the qualified range, the microservice test is determined to have passed.

[0074] In one embodiment, the step S2 of extracting the first feature data from the data of the microservice according to a preset feature data extraction method includes:

[0075] S201. According to a preset dynamic data selection method, select designated dynamic data from all dynamic data of the microservice, and divide the designated dynamic data into m first sub-dynamic data segments of equal length, where m is an integer greater than 1;

[0076] S202, and retrieve pre-stored standard dynamic data, and divide the standard dynamic data into m segments of second sub-dynamic data of equal duration, wherein the duration of the first sub-dynamic data is equal to that of the second sub-dynamic data, and the m segments of the first sub-dynamic data correspond to the m segments of the second sub-dynamic data one by one;

[0077] S203, according to a preset sub-data similarity calculation method, the similarity between the first sub-dynamic data and the second sub-dynamic data is calculated accordingly, thereby obtaining m similarity values ​​accordingly;

[0078] S204, using a preset counter to count the m similarity values ​​according to a preset counting rule;

[0079] S205: Read the final count of the counter, and record the final count as the first feature data.

[0080] As described above, the first feature data is extracted from the data of the microservice according to the preset feature data extraction method. The present application selects the specified dynamic data from all the dynamic data of the microservice, and divides the specified dynamic data into m segments of first sub-dynamic data of equal duration; and retrieves the pre-stored standard dynamic data, and divides the standard dynamic data into m segments of second sub-dynamic data of equal duration; according to the preset sub-data similarity calculation method, the similarity of the first sub-dynamic data and the second sub-dynamic data is calculated accordingly to obtain the similarity between the specified dynamic data and the standard dynamic data. Then, the preset counter is used to count the m similarity values ​​according to the preset counting rule; the final count of the counter is read, and the final count is recorded as the first feature data. Thus, the first feature data is not only the standard dynamic data, but also special dynamic data, that is, dynamic data analyzed from the dynamic data, so the data is more refined and more accurate. The counting rule is any feasible rule, for example, judging whether the similarity value is greater than the preset similarity threshold, if greater, the counter count is increased by 1; if not greater, the counter remains unchanged.

[0081] In one embodiment, the step S201 of selecting specified dynamic data from all dynamic data of the microservice according to a preset dynamic data selection method includes:

[0082] S2011. Obtain intermediate dynamic data from all dynamic data of the microservice, wherein a specified ratio of the intermediate dynamic data is greater than that of other dynamic data, and the specified ratio refers to a ratio obtained by dividing the maximum value of the dynamic data within the specified time by the average value of the corresponding dynamic data within the specified time;

[0083] S2012, obtaining the differential value of the intermediate dynamic data within the specified time, and obtaining the number of zero values ​​when the differential value is equal to 0, and determining whether the number of zero values ​​is greater than a preset number threshold;

[0084] S2013: If the number of zero values ​​is greater than a preset number threshold, the intermediate dynamic data is recorded as the designated dynamic data.

[0085] As described above, it is realized that the specified dynamic data is selected from all the dynamic data of the microservice according to the preset dynamic data selection method. The present application obtains the intermediate dynamic data from all the dynamic data of the microservice; obtains the differential value of the intermediate dynamic data within the specified time, and obtains the number of zero values ​​when the differential value is equal to 0; if the number of zero values ​​is greater than the preset number threshold, the intermediate dynamic data is recorded as the specified dynamic data, so that the specified dynamic data is suitable for representing the microservice, thereby improving the accuracy of the test. Specifically, since the specified ratio of the intermediate dynamic data is greater than that of other dynamic data, and the number of zero values ​​is greater than the preset number threshold, the numerical volatility of the intermediate dynamic data is stronger than that of other dynamic data. Therefore, under normal circumstances, if the intermediate dynamic data can meet the standard, other dynamic data can also meet the standard, so that the intermediate dynamic data is most suitable for representing the microservice, and the intermediate dynamic data is recorded as the specified dynamic data accordingly.

[0086] In one embodiment, the step S203 of calculating the similarity between the first sub-dynamic data and the second sub-dynamic data includes:

[0087] S2031, obtaining an expression function f(t) of the first sub-dynamic data in time, and obtaining a corresponding expression function F(t) of the second sub-dynamic data in time;

[0088] S2032, according to the formula:

[0089] Calculate the similarity evaluation function M(t), where min is the minimum function, L is a preset similarity evaluation parameter greater than 0, and t is time;

[0090] S2033. Calculate the similarity value of the first sub-dynamic data and the second sub-dynamic data according to the formula: Similarity value = similarity time length / (similar time length + dissimilar time length), wherein the similarity time length refers to the time length when the similarity evaluation function M(t) is not equal to L, and the dissimilar time length refers to the time length when the similarity evaluation function M(t) is equal to L.

[0091] As described above, the similarity between the first sub-dynamic data and the second sub-dynamic data is calculated accordingly. This application uses the formula:

[0092] Calculate the similarity evaluation function M(t) to accurately obtain the similarity between the first sub-dynamic data and the second sub-dynamic data. Dynamic data not only has numerical characteristics, but also has fluctuation characteristics. Therefore, the accuracy of evaluating the similarity between dynamic data based on ordinary numerical comparison methods is insufficient. Therefore, this application adopts the formula:

[0093] Not only the difference between the numerical values ​​but also the difference between the dynamic data fluctuations are evaluated, and then according to the formula: similarity value = similarity time length / (similar time length + dissimilar time length), the similarity value between the first sub-dynamic data and the second sub-dynamic data is calculated, thereby improving the accuracy of the similarity calculation.

[0094] In one embodiment, if the bottom of the virtual medium layer presents a light spot formed by the virtual light, obtaining the light spot position, and calculating the distance between the light spot position and a preset standard position, wherein the standard position is located before step S7 at the bottom of the virtual medium layer, includes:

[0095] S61, emitting a virtual ray at the designated position along the designated direction toward the top of the virtual medium layer, wherein the virtual ray still propagates in a straight line between any media;

[0096] S62: Obtain an intersection point between the virtual medium layer and the virtual ray, and record the intersection point as the standard position.

[0097] As described above, the acquisition of the standard position is achieved. The standard position represents the position where the virtual light should fall under an ideal state, so it needs to be accurately and uniquely positioned. The present application acquires the standard position by emitting a virtual ray toward the top of the virtual medium layer along the specified direction at the specified position, and the virtual ray still maintains straight-line propagation between any media; acquiring the intersection point of the virtual medium layer and the virtual ray, and recording the intersection point as the standard position. Among them, since the virtual ray propagates in a straight line, the virtual ray will not be refracted, that is, it will not be affected by the virtual medium layer, so that the intersection point of the virtual medium layer and the virtual ray is the spot position under an ideal state, thereby ensuring the credibility of the test.

[0098] In one embodiment, after step S8 of determining whether the distance is greater than a preset distance threshold, the following steps are performed:

[0099] S81, if the distance is greater than a preset distance threshold, obtaining a cut plane according to a preset plane obtaining method, wherein the cut plane is parallel to the bottom surface of the virtual medium layer, and the cut plane intersects the virtual medium layer;

[0100] S82, obtaining a first intersection point between the interception plane and the virtual ray, and obtaining a second intersection point between the interception plane and the virtual ray;

[0101] S83, calculating the distance between the first intersection point and the second intersection point, and determining whether the distance between the first intersection point and the second intersection point is equal to the distance threshold;

[0102] S84. If the distance between the first intersection point and the second intersection point is equal to the distance threshold, obtain the distance value between the interception plane and the bottom surface of the virtual medium layer, and generate improvement reminder information for improving the microservice, wherein the improvement reminder information is attached with the distance value.

[0103] As described above, the generation of improvement reminder information is realized, wherein the improvement reminder information is attached with the distance value. If the distance is greater than the preset distance threshold, it can be determined that the microservice test has not passed. However, there has been no qualitative analysis of how much difference the microservice is from passing the test. Therefore, the present application further adopts a preset plane acquisition method to obtain a cut plane; obtain the first intersection of the cut plane and the virtual ray, and obtain the second intersection of the cut plane and the virtual ray; calculate the distance between the first intersection and the second intersection; if the distance between the first intersection and the second intersection is equal to the distance threshold, then obtain the distance value between the cut plane and the bottom surface of the virtual medium layer, and generate improvement reminder information for improving the microservice, wherein the improvement reminder information is attached with the distance value. Thus, not only a qualitative conclusion of the test failure is given, but also a quantitative analysis of the improvement required to pass the test is given (that is, improvement reminder information requiring the thickness of the improved virtual medium layer to be shortened by at least the distance value is given).

[0104] The dual-data-based microservice testing method of the present application receives a test instruction for testing a microservice; collects the data of the microservice in real time within a specified time, and extracts the first characteristic data and the second characteristic data; obtains the specified refractive index corresponding to the first characteristic data, and obtains the specified thickness corresponding to the second characteristic data; generates a virtual medium layer in a preset virtual space; generates a virtual light source at a specified position above the top of the virtual medium layer, and uses the virtual light source to emit virtual light to the top of the virtual medium layer along a specified direction; if the bottom of the virtual medium layer presents a light spot formed by the virtual light, then obtains the light spot position, and calculates the distance between the light spot position and the preset standard position; if the distance is not greater than the preset distance threshold, it is determined that the microservice test has passed. This improves the accuracy and flexibility of the test and improves the test efficiency.

[0105] Reference Figure 2 , the embodiment of the present application provides a microservice testing device based on dual data, including:

[0106] A test instruction receiving unit 10 is used to receive a test instruction for testing a microservice;

[0107] The data collection unit 20 is used to collect the data of the microservice in real time within a specified time according to the test instruction, and extract the first feature data and the second feature data from the data of the microservice according to a preset feature data extraction method, wherein the first feature data is dynamic data and the second feature data is static data;

[0108] A refractive index acquisition unit 30, configured to acquire a specified refractive index corresponding to the first characteristic data according to a correspondence between preset data and refractive index, and to acquire a specified thickness corresponding to the second characteristic data according to a correspondence between preset data and thickness;

[0109] The medium layer generating unit 40 is used to generate a virtual medium layer in a preset virtual space, wherein the refractive index of the virtual medium layer is equal to the specified refractive index, the thickness of the virtual medium layer is equal to the specified thickness, the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, and the virtual space conforms to the principle of light refraction;

[0110] A light source generating unit 50, configured to generate a virtual light source at a specified position above the top of the virtual medium layer, and to emit a virtual light ray toward the top of the virtual medium layer along a specified direction using the virtual light source, wherein the angle between the specified direction and the virtual medium layer is not a right angle;

[0111] A light spot judging unit 60, used to judge whether the bottom of the virtual medium layer presents a light spot formed by the virtual light;

[0112] A light spot position acquisition unit 70, configured to acquire the light spot position if the bottom of the virtual medium layer presents a light spot formed by the virtual light, and calculate the distance between the light spot position and a preset standard position, wherein the standard position is located at the bottom of the virtual medium layer;

[0113] A distance threshold determination unit 80 is used to determine whether the distance is greater than a preset distance threshold;

[0114] The test pass determination unit 90 is configured to determine that the microservice test has passed if the distance is not greater than a preset distance threshold.

[0115] The operations performed by the above units correspond one-to-one to the steps of the microservice testing method based on dual data in the aforementioned implementation method, and will not be repeated here.

[0116] In one embodiment, the data acquisition unit 20 includes:

[0117] A designated dynamic data selection subunit is used to select designated dynamic data from all dynamic data of the microservice according to a preset dynamic data selection method, and divide the designated dynamic data into m first sub-dynamic data segments of equal length, where m is an integer greater than 1;

[0118] The standard dynamic data retrieving subunit is used to retrieve the pre-stored standard dynamic data and divide the standard dynamic data into m segments of second sub-dynamic data of equal duration, wherein the duration of the first sub-dynamic data is equal to that of the second sub-dynamic data, and the m segments of the first sub-dynamic data correspond to the m segments of the second sub-dynamic data one by one;

[0119] a similarity value obtaining subunit, used to calculate the similarity between the first sub-dynamic data and the second sub-dynamic data according to a preset sub-data similarity calculation method, thereby obtaining m similarity values ​​accordingly;

[0120] A counting subunit, used to count the m similarity values ​​using a preset counter according to a preset counting rule;

[0121] The first characteristic data acquisition subunit is used to read the final count of the counter and record the final count as the first characteristic data.

[0122] The operations performed by the above sub-units correspond one-to-one to the steps of the microservice testing method based on dual data in the aforementioned implementation method, and will not be repeated here.

[0123] In one embodiment, the specified dynamic data selection subunit includes:

[0124] An intermediate dynamic data acquisition module is used to acquire intermediate dynamic data from all dynamic data of the microservice, wherein a specified ratio of the intermediate dynamic data is greater than other dynamic data, and the specified ratio refers to a ratio obtained by dividing the maximum value of the dynamic data within the specified time by the average value of the corresponding dynamic data within the specified time;

[0125] A differential value acquisition module, used to acquire the differential value of the intermediate dynamic data within the specified time, and acquire the number of zero values ​​when the differential value is equal to 0, and determine whether the number of zero values ​​is greater than a preset number threshold;

[0126] The designated dynamic data marking module is used to mark the intermediate dynamic data as the designated dynamic data if the number of zero values ​​is greater than a preset number threshold.

[0127] The operations performed by the above modules respectively correspond one-to-one to the steps of the microservice testing method based on dual data in the aforementioned implementation method, and will not be repeated here.

[0128] In one embodiment, the similarity value obtaining subunit includes:

[0129] An expression function acquisition module, used to acquire the expression function f(t) of the first sub-dynamic data in time, and acquire the corresponding expression function F(t) of the second sub-dynamic data in time;

[0130] The minimum value function acquisition module is used according to the formula:

[0131] Calculate the similarity evaluation function M(t), where min is the minimum function, L is a preset similarity evaluation parameter greater than 0, and t is time;

[0132] The similarity value calculation module is used to calculate the similarity value of the first sub-dynamic data and the second sub-dynamic data according to the formula: similarity value = similarity time length / (similar time length+dissimilar time length), wherein the similarity time length refers to the time length when the similarity evaluation function M(t) is not equal to L, and the dissimilar time length refers to the time length when the similarity evaluation function M(t) is equal to L.

[0133] The operations performed by the above modules respectively correspond one-to-one to the steps of the microservice testing method based on dual data in the aforementioned implementation method, and will not be repeated here.

[0134] In one embodiment, the device comprises:

[0135] A virtual ray emitting unit, configured to emit a virtual ray at the specified position along the specified direction toward the top of the virtual medium layer, wherein the virtual ray still maintains straight-line propagation between any media;

[0136] The standard position acquisition unit is used to acquire the intersection point of the virtual medium layer and the virtual ray, and record the intersection point as the standard position.

[0137] The operations performed by the above units correspond one-to-one to the steps of the microservice testing method based on dual data in the aforementioned implementation method, and will not be repeated here.

[0138] In one embodiment, the device comprises:

[0139] a cut-plane acquisition unit, configured to acquire a cut-plane according to a preset plane acquisition method if the distance is greater than a preset distance threshold, wherein the cut-plane is parallel to the bottom surface of the virtual medium layer and intersects the virtual medium layer;

[0140] An intersection point acquisition unit, used for acquiring a first intersection point between the interception plane and the virtual ray, and acquiring a second intersection point between the interception plane and the virtual ray;

[0141] an intersection distance calculation unit, configured to calculate the distance between the first intersection and the second intersection, and determine whether the distance between the first intersection and the second intersection is equal to the distance threshold;

[0142] A reminder information generating unit is used to obtain the distance value between the interception plane and the bottom surface of the virtual medium layer if the distance between the first intersection point and the second intersection point is equal to the distance threshold, and generate improvement reminder information for improving the microservice, wherein the improvement reminder information is attached with the distance value.

[0143] The operations performed by the above units correspond one-to-one to the steps of the microservice testing method based on dual data in the aforementioned implementation method, and will not be repeated here.

[0144] The dual-data-based microservice testing device of the present application receives a test instruction for testing a microservice; collects the data of the microservice in real time within a specified time, and extracts the first characteristic data and the second characteristic data; obtains the specified refractive index corresponding to the first characteristic data, and obtains the specified thickness corresponding to the second characteristic data; generates a virtual medium layer in a preset virtual space; generates a virtual light source at a specified position above the top of the virtual medium layer, and uses the virtual light source to emit virtual light to the top of the virtual medium layer along a specified direction; if the bottom of the virtual medium layer presents a light spot formed by the virtual light, then the light spot position is obtained, and the distance between the light spot position and the preset standard position is calculated; if the distance is not greater than the preset distance threshold, the microservice test is determined to be passed. This improves the accuracy and flexibility of the test and improves the test efficiency.

[0145] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided, which may be a server, and its internal structure may be as shown in the figure. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data used in a microservice testing method based on dual data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a microservice testing method based on dual data is implemented.

[0146] The above-mentioned processor executes the above-mentioned microservice testing method based on dual data, wherein the steps included in the method correspond one-to-one to the steps of executing the microservice testing method based on dual data in the aforementioned implementation method, and are not repeated here.

[0147] Those skilled in the art will appreciate that the structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.

[0148] The computer device of the present application receives a test instruction for testing a microservice; collects data of the microservice in real time within a specified time, and extracts first characteristic data and second characteristic data; obtains a specified refractive index corresponding to the first characteristic data, and obtains a specified thickness corresponding to the second characteristic data; generates a virtual medium layer in a preset virtual space; generates a virtual light source at a specified position above the top of the virtual medium layer, and uses the virtual light source to emit virtual light to the top of the virtual medium layer along a specified direction; if the bottom of the virtual medium layer presents a light spot formed by the virtual light, then obtains the light spot position, and calculates the distance between the light spot position and the preset standard position; if the distance is not greater than a preset distance threshold, then determines that the microservice test has passed. This improves the accuracy and flexibility of the test and improves the test efficiency.

[0149] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, a microservice testing method based on dual data is implemented. The steps included in the method correspond one-to-one to the steps of executing the microservice testing method based on dual data in the aforementioned implementation method, and are not repeated here.

[0150] The computer-readable storage medium of the present application receives a test instruction for testing a microservice; collects data of the microservice in real time within a specified time, and extracts first characteristic data and second characteristic data; obtains a specified refractive index corresponding to the first characteristic data, and obtains a specified thickness corresponding to the second characteristic data; generates a virtual medium layer in a preset virtual space; generates a virtual light source at a specified position above the top of the virtual medium layer, and uses the virtual light source to emit virtual light to the top of the virtual medium layer along a specified direction; if the bottom of the virtual medium layer presents a light spot formed by the virtual light, then obtains the light spot position, and calculates the distance between the light spot position and the preset standard position; if the distance is not greater than a preset distance threshold, then determines that the microservice test has passed. This improves the accuracy and flexibility of the test and improves the test efficiency.

[0151] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0152] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.

[0153] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A microservice testing method based on dual data, characterized in that: include: Receive test instructions for testing microservices; According to the test instruction, the data of the microservice is collected in real time within a specified time, and according to a preset feature data extraction method, first feature data and second feature data are extracted from the data of the microservice, wherein the first feature data is dynamic data and the second feature data is static data; According to the correspondence between the preset data and the refractive index, a specified refractive index corresponding to the first characteristic data is obtained, and according to the correspondence between the preset data and the thickness, a specified thickness corresponding to the second characteristic data is obtained; In a preset virtual space, a virtual medium layer is generated, wherein the refractive index of the virtual medium layer is equal to the specified refractive index, the thickness of the virtual medium layer is equal to the specified thickness, the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, and the virtual space complies with the principle of light refraction; Generate a virtual light source at a specified position above the top of the virtual medium layer, and use the virtual light source to emit a virtual light ray toward the top of the virtual medium layer along a specified direction, wherein the angle between the specified direction and the virtual medium layer is not a right angle; Determining whether the bottom of the virtual medium layer presents a light spot formed by the virtual light; If a light spot formed by the virtual light beam appears at the bottom of the virtual medium layer, the light spot position is acquired, and a distance between the light spot position and a preset standard position is calculated, wherein the standard position is located at the bottom of the virtual medium layer; Determining whether the distance is greater than a preset distance threshold; If the distance is not greater than a preset distance threshold, it is determined that the microservice test has passed.

2. The microservice testing method based on dual data according to claim 1 is characterized in that: The step of extracting the first feature data from the data of the microservice according to the preset feature data extraction method includes: According to a preset dynamic data selection method, the specified dynamic data is selected from all the dynamic data of the microservice, and the specified dynamic data is divided into m first sub-dynamic data segments of equal length, where m is an integer greater than 1; and calling pre-stored standard dynamic data, and dividing the standard dynamic data into m segments of second sub-dynamic data of equal duration, wherein the duration of the first sub-dynamic data is equal to that of the second sub-dynamic data, and the m segments of the first sub-dynamic data correspond to the m segments of the second sub-dynamic data one by one; According to a preset sub-data similarity calculation method, the similarity between the first sub-dynamic data and the second sub-dynamic data is calculated accordingly, thereby obtaining m similarity values ​​accordingly; Using a preset counter, counting the m similarity values ​​according to a preset counting rule; A final count of the counter is read, and the final count is recorded as the first feature data.

3. The microservice testing method based on dual data according to claim 2 is characterized in that: The step of selecting the specified dynamic data from all the dynamic data of the microservice according to the preset dynamic data selection method includes: Obtaining intermediate dynamic data from all dynamic data of the microservice, wherein a specified ratio of the intermediate dynamic data is greater than other dynamic data, and the specified ratio refers to a ratio obtained by dividing the maximum value of the dynamic data within the specified time by the average value of the corresponding dynamic data within the specified time; Obtaining the differential value of the intermediate dynamic data within the specified time, and obtaining the number of zero values ​​when the differential value is equal to 0, and determining whether the number of zero values ​​is greater than a preset number threshold; If the number of zero values ​​is greater than a preset number threshold, the intermediate dynamic data is recorded as the designated dynamic data.

4. The microservice testing method based on dual data according to claim 2 is characterized in that: The step of correspondingly calculating the similarity between the first sub-dynamic data and the second sub-dynamic data comprises: Obtaining a time expression function f(t) of the first sub-dynamic data, and obtaining a corresponding time expression function F(t) of the second sub-dynamic data; According to the formula: Calculate the similarity evaluation function M(t), where min is the minimum function, L is a preset similarity evaluation parameter greater than 0, and t is time; According to the formula: Similarity value = similarity time length / (similar time length + dissimilar time length), the similarity value of the first sub-dynamic data and the second sub-dynamic data is calculated, wherein the similarity time length refers to the time length when the similarity evaluation function M(t) is not equal to L, and the dissimilar time length refers to the time length when the similarity evaluation function M(t) is equal to L.

5. The microservice testing method based on dual data according to claim 1 is characterized in that: If the bottom of the virtual medium layer presents a light spot formed by the virtual light, the light spot position is obtained, and the distance between the light spot position and a preset standard position is calculated, wherein the standard position is located before the step of the bottom of the virtual medium layer, including: Emitting a virtual ray at the designated position along the designated direction toward the top of the virtual medium layer, wherein the virtual ray still maintains straight-line propagation between any media; An intersection point between the virtual medium layer and the virtual ray is obtained, and the intersection point is recorded as the standard position.

6. The microservice testing method based on dual data according to claim 5 is characterized in that: After the step of determining whether the distance is greater than a preset distance threshold, the method further comprises: If the distance is greater than a preset distance threshold, acquiring a cut plane according to a preset plane acquisition method, wherein the cut plane is parallel to the bottom surface of the virtual medium layer, and the cut plane intersects with the virtual medium layer; Obtaining a first intersection point between the intercepting plane and the virtual ray, and obtaining a second intersection point between the intercepting plane and the virtual ray; Calculating the distance between the first intersection point and the second intersection point, and determining whether the distance between the first intersection point and the second intersection point is equal to the distance threshold; If the distance between the first intersection point and the second intersection point is equal to the distance threshold, the distance value between the interception plane and the bottom surface of the virtual medium layer is obtained, and improvement reminder information for improving the microservice is generated, wherein the improvement reminder information is attached with the distance value.

7. A microservice testing device based on dual data, characterized in that: include: A test instruction receiving unit, used to receive a test instruction for testing a microservice; A data collection unit, configured to collect data of the microservice in real time within a specified time according to the test instruction, and extract first feature data and second feature data from the data of the microservice according to a preset feature data extraction method, wherein the first feature data is dynamic data and the second feature data is static data; a refractive index acquisition unit, configured to acquire a specified refractive index corresponding to the first characteristic data according to a correspondence between preset data and refractive index, and to acquire a specified thickness corresponding to the second characteristic data according to a correspondence between preset data and thickness; A medium layer generating unit, configured to generate a virtual medium layer in a preset virtual space, wherein the refractive index of the virtual medium layer is equal to the specified refractive index, the thickness of the virtual medium layer is equal to the specified thickness, the refractive index of the area other than the virtual medium layer in the virtual space is greater than the specified refractive index, and the virtual space complies with the principle of light refraction; a light source generating unit, configured to generate a virtual light source at a designated position above the top of the virtual medium layer, and to emit a virtual light ray toward the top of the virtual medium layer along a designated direction using the virtual light source, wherein the angle between the designated direction and the virtual medium layer is not a right angle; A light spot judging unit, used for judging whether the bottom of the virtual medium layer presents a light spot formed by the virtual light; a light spot position acquisition unit, configured to acquire the light spot position if the bottom of the virtual medium layer presents the light spot formed by the virtual light, and calculate the distance between the light spot position and a preset standard position, wherein the standard position is located at the bottom of the virtual medium layer; A distance threshold determination unit, used to determine whether the distance is greater than a preset distance threshold; The test pass determination unit is used to determine that the microservice test has passed if the distance is not greater than a preset distance threshold.

8. The dual-data based microservice testing device according to claim 7, characterized in that: The data acquisition unit comprises: A designated dynamic data selection subunit is used to select designated dynamic data from all dynamic data of the microservice according to a preset dynamic data selection method, and divide the designated dynamic data into m first sub-dynamic data segments of equal length, where m is an integer greater than 1; The standard dynamic data retrieving subunit is used to retrieve the pre-stored standard dynamic data and divide the standard dynamic data into m segments of second sub-dynamic data of equal duration, wherein the duration of the first sub-dynamic data is equal to that of the second sub-dynamic data, and the m segments of the first sub-dynamic data correspond to the m segments of the second sub-dynamic data one by one; a similarity value obtaining subunit, used to calculate the similarity between the first sub-dynamic data and the second sub-dynamic data according to a preset sub-data similarity calculation method, thereby obtaining m similarity values ​​accordingly; A counting subunit, used to count the m similarity values ​​using a preset counter according to a preset counting rule; The first characteristic data acquisition subunit is used to read the final count of the counter and record the final count as the first characteristic data.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.