Test flow set acquisition method and device and storage medium
Patent Information
- Application Number
- CN202010108988.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-21
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2040-02-21
AI Technical Summary
[0010] One beneficial effect of this invention is that, since the production traffic is deduplicated based on two dimensions—feature and code coverage—and the remaining production traffic after deduplication constitutes the test traffic set for code testing, the test traffic set can be simplified as much as possible through deduplication, while ensuring that the remaining production traffic after deduplication can fully cover both features and code. Therefore, the testing efficiency is improved without sacrificing feature coverage and code coverage.
Smart Images

Figure CN113297054B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of testing technology, and in particular to a method, apparatus and storage medium for acquiring test traffic sets. Background Technology
[0002] In scenarios such as smoke testing and comparative testing, it is necessary to obtain test traffic sets from actual production traffic as test inputs for these scenarios in order to obtain test results.
[0003] Because of the massive scale of production traffic, it's common practice not to select all production traffic when acquiring test traffic sets. Instead, a portion of the production traffic is extracted. Traditional test traffic set acquisition techniques involve determining appropriate fields or combinations of fields based on the testing experience of test administrators and business needs. These fields or combinations represent characteristics, and production traffic is aggregated based on these characteristics. In other words, traffic containing specific characteristics with specific values is extracted from the production traffic, thus forming the required test traffic set.
[0004] It should be noted that the above description of the technical background is only for the purpose of providing a clear and complete explanation of the technical solutions of the present invention and facilitating understanding by those skilled in the art. It should not be assumed that these technical solutions are known to those skilled in the art simply because they have been described in the background section of this invention. Summary of the Invention
[0005] The inventors discovered that in traditional traffic acquisition techniques, features are determined based on specific business needs. Therefore, the identified features are relatively singular, and they change as the business evolves. Consequently, the production traffic extracted using this technique cannot comprehensively cover all possible features and lacks universality. Furthermore, this technique extracts production traffic based solely on features without considering the code covered by the extracted production traffic. Therefore, the production traffic extracted using this technique may not fully cover the code under test.
[0006] To address the aforementioned or similar issues, embodiments of the present invention provide a method, apparatus, and storage medium for acquiring test traffic sets, thereby improving testing efficiency without sacrificing feature coverage and code coverage.
[0007] According to a first aspect of the present invention, a method for obtaining a test traffic set is provided, wherein the method includes: aggregating the plurality of production traffic based on at least one feature contained in a plurality of production traffic to obtain at least one feature cluster of production traffic, wherein the production traffic in each feature cluster contains the same feature; performing feature deduplication on the production traffic in each feature cluster based on the similarity of the feature values of each production traffic in each feature cluster; obtaining the code covered by each production traffic remaining after feature deduplication in each feature cluster; and performing code deduplication on the production traffic remaining after feature deduplication in each feature cluster based on the code covered by each production traffic remaining after feature deduplication in each feature cluster, wherein the production traffic remaining after code deduplication in each feature cluster constitutes a test traffic set for code testing.
[0008] According to a second aspect of the present invention, a test traffic set acquisition apparatus is provided, wherein the apparatus includes: an aggregation unit that aggregates multiple production traffic sets based on at least one feature contained in each production traffic set to obtain at least one feature cluster of the production traffic sets, wherein the production traffic sets in each feature cluster contain the same feature; a feature deduplication unit that performs feature deduplication on the production traffic sets in each feature cluster based on the similarity of the feature values of each production traffic set in each feature cluster; a code acquisition unit that acquires the code covered by each production traffic set remaining after feature deduplication in each feature cluster; and a code deduplication unit that performs code deduplication on the remaining production traffic sets remaining after feature deduplication in each feature cluster based on the code covered by each production traffic set remaining after feature deduplication in each feature cluster, wherein the remaining production traffic sets remaining after code deduplication in each feature cluster constitute a test traffic set for code testing.
[0009] According to a third aspect of the present invention, a storage medium storing a processor-readable program is provided, the program causing the processor to perform the method according to the first aspect described above.
[0010] One beneficial effect of this invention is that, since the production traffic is deduplicated based on two dimensions—feature and code coverage—and the remaining production traffic after deduplication constitutes the test traffic set for code testing, the test traffic set can be simplified as much as possible through deduplication, while ensuring that the remaining production traffic after deduplication can fully cover both features and code. Therefore, the testing efficiency is improved without sacrificing feature coverage and code coverage.
[0011] Specific embodiments of the invention are disclosed in detail with reference to the following description and accompanying drawings, indicating how the principles of the invention can be employed. It should be understood that the embodiments of the invention are not therefore limited in scope. Within the spirit and scope of the appended claims, embodiments of the invention include many changes, modifications, and equivalents.
[0012] Features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, combined with features in other embodiments, or substituted for features in other embodiments.
[0013] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, whole, step, or component, but does not exclude the presence or addition of one or more other features, wholes, steps, or components. Attached Figure Description
[0014] The accompanying drawings, which form part of this specification, are used to provide a further understanding of the embodiments of the invention and illustrate implementation methods, and together with the textual description, explain the principles of the invention. Obviously, the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without creative effort. In the drawings:
[0015] Figure 1 This is a schematic diagram of the acquisition method in Embodiment 1 of the present invention.
[0016] Figure 2 This is a schematic diagram of the implementation method of step 105 in Embodiment 1 of the present invention.
[0017] Figure 3 This is a schematic diagram of the implementation method of step 107 in Embodiment 1 of the present invention.
[0018] Figure 4 This is a schematic diagram of the acquisition device in Embodiment 2 of the present invention.
[0019] Figure 5 This is another schematic diagram of the acquisition device in Embodiment 2 of the present invention.
[0020] Figure 6 This is a schematic diagram of the code deduplication unit in Embodiment 2 of the present invention.
[0021] Figure 7 This is another schematic diagram of the acquisition device in Embodiment 2 of the present invention.
[0022] Figure 8 This is a schematic diagram of an electronic device according to Embodiment 3 of the present invention. Detailed Implementation
[0023] Referring to the accompanying drawings, the foregoing and other features of the invention will become apparent from the following description. Specific embodiments of the invention are specifically disclosed in the description and drawings, illustrating partial implementations in which the principles of the invention can be employed. It should be understood that the invention is not limited to the described embodiments; rather, it includes all modifications, variations, and equivalents falling within the scope of the appended claims.
[0024] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the figures. The process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0025] In embodiments of the present invention, the terms "first," "second," etc., are used to distinguish different elements by name, but do not indicate the spatial arrangement or chronological order of these elements, and these elements should not be limited by these terms. The term "and / or" includes any one or more of the associated listed terms and all combinations thereof.
[0026] In embodiments of the present invention, the singular forms "a," "the," etc., including the plural forms, should be broadly understood as "a kind" or "a class" rather than limited to the meaning of "an"; furthermore, the term "the" should be understood to include both the singular and plural forms, unless the context clearly indicates otherwise. Additionally, the term "according to" should be understood as "at least partially based on…," and the term "based on" should be understood as "at least partially based on…," unless the context clearly indicates otherwise.
[0027] It should also be mentioned that in some alternative implementations, the functions / actions mentioned may occur in a different order than those shown in the figures. For example, depending on the functions / actions involved, the two figures shown successively may actually be executed substantially simultaneously or sometimes in reverse order.
[0028] Various embodiments of the present invention will now be described with reference to the accompanying drawings. These embodiments are merely exemplary and are not intended to limit the scope of the present invention.
[0029] Example 1
[0030] This embodiment 1 provides a method for obtaining a test traffic set.
[0031] Figure 1This is a schematic diagram of the acquisition method in this embodiment. For example... Figure 1 As shown, the method includes:
[0032] Step 101: Based on at least one feature contained in multiple production flows, aggregate the multiple production flows to obtain at least one feature cluster of the production flows, wherein the production flows in each feature cluster contain the same feature;
[0033] Step 103: Based on the similarity of the feature values of each production flow in each feature cluster, perform feature deduplication on the production flow in each feature cluster;
[0034] Step 105: Obtain the code covered by each production traffic that remains after feature deduplication in each feature cluster;
[0035] Step 107: Based on the code covered by each production traffic remaining after feature deduplication in each feature cluster, code deduplication is performed on the remaining production traffic in each feature cluster after feature deduplication. The remaining production traffic after code deduplication in each feature cluster constitutes a test traffic set for code testing.
[0036] In this embodiment, feature deduplication is performed on the production traffic based on features, while code deduplication is performed on the production traffic based on code.
[0037] In the above embodiments, since the production traffic is deduplicated based on two dimensions: feature and code coverage, the remaining production traffic after deduplication constitutes the test traffic set for code testing. Therefore, the test traffic set can be simplified as much as possible through deduplication, while ensuring that the remaining production traffic after deduplication can fully cover both features and code. Thus, the effect of improving testing efficiency is achieved without sacrificing feature coverage and code coverage.
[0038] In this embodiment, production traffic refers to traffic used for production. For example, the multiple production traffic streams could be a collection of external requests that the test code might receive in a real-world environment. Here, an external request refers to a request originating from outside the test code. For example, the external request could be an access request from a user.
[0039] In this embodiment, a feature is a functional characteristic associated with a certain function. Therefore, traffic aggregation based on a feature is equivalent to traffic aggregation based on a function. For example, a feature can be represented by a field or a combination of fields from an external request.
[0040] In this embodiment, step 101 may include: aggregating multiple production flows based on each of the at least one feature to obtain a feature cluster of the production flows. Thus, each production flow in the obtained feature cluster contains the feature on which the aggregation process is based. In other words, a feature cluster is a set of production flows obtained by aggregating production flows based on a single feature (i.e., extracting those flows that satisfy a predetermined condition based on that feature), and a feature cluster corresponds to a single feature.
[0041] In this embodiment, prior to step 103, the acquisition method may further include the step of: determining the similarity of the values of the features of each production flow in each feature cluster.
[0042] The similarity of feature values among production flows within a feature cluster refers to the degree of similarity between the feature values of each production flow for the feature corresponding to that cluster. Here, a feature value can be, for example, the value of a single field or a combination of values from different fields. For instance, if the feature corresponding to a feature cluster is represented by field A, the similarity of feature values among production flows in that cluster is the similarity of field A values among all production flows in that cluster. This similarity can be calculated using various known similarity algorithms, such as the simhash algorithm.
[0043] Step 103 above may include: removing a portion of multiple production flows whose feature values in each feature cluster have a similarity higher than a predetermined similarity threshold. In other words, in step 103, within each feature cluster, it can be determined which production flows have very similar feature values based on the determined similarity, and a portion of these production flows with very similar feature values can be removed, i.e., reducing the number of production flows with very similar feature values. This is because when multiple production flows with very similar feature values exist in a feature cluster, these flows also play very similar roles, and there is little need to retain all of them. The aforementioned similarity threshold can be set according to actual needs.
[0044] In step 103, the number of production traffic flows removed during the removal process can be set according to actual needs. For example, it can be set to remove a portion of the production traffic flows whose feature values in each feature cluster have a similarity higher than a predetermined similarity threshold, so that only one production traffic flow remains after the removal process. In other words, if there are n production traffic flows whose feature values in each feature cluster have a similarity higher than the predetermined similarity threshold, then (n-1) production traffic flows are removed from these n production traffic flows, thus minimizing the number of production traffic flows. However, keeping only one of the multiple production traffic flows with a similarity higher than the predetermined similarity threshold is not a limitation of this embodiment. It can also be set to retain two or other predetermined numbers of production traffic flows, or to set the proportion of the number of retained production traffic flows to the number of production traffic flows with a similarity higher than the similarity threshold, etc.
[0045] Furthermore, once the number of production flows to be removed from the aforementioned multiple production flows has been determined, that number of production flows can be randomly selected from the aforementioned multiple production flows for removal, or the number of production flows can be selected for removal according to preset rules based on actual needs.
[0046] In this embodiment, the code covered by the production traffic refers to the code that needs to be executed when processing the production traffic.
[0047] Figure 2 This is a schematic diagram illustrating the implementation method of step 105 in this embodiment. For example... Figure 2 As shown, step 105 above may include:
[0048] Step 201: Input the remaining production traffic from each feature cluster after feature deduplication into the test benchmark environment one by one.
[0049] Step 203: Based on the processing of each production traffic input in the test benchmark environment, determine the code covered by each production traffic.
[0050] In this embodiment, the test benchmark environment is a simulation of the actual business execution environment. In step 201, the remaining production traffic after feature deduplication in each feature cluster is input into the test benchmark environment one by one. For example, the remaining external requests after feature deduplication in each feature cluster are sent to the test benchmark environment one by one, so that each production traffic input in the test benchmark environment is processed. In step 203, based on this processing, the code covered by each production traffic is determined. Thus, the processing of each production traffic input in the business execution environment can be simulated, thereby obtaining the code corresponding to each production traffic.
[0051] Figure 3This is a schematic diagram illustrating the implementation method of step 107 in this embodiment. For example... Figure 3 As shown, step 107 above may include:
[0052] Step 301: Based on the code covered by each production traffic remaining after feature deduplication within each feature cluster, perform in-cluster code deduplication on the remaining production traffic after feature deduplication within each feature cluster;
[0053] Step 303: Based on the code covered by each production traffic after intra-cluster code deduplication within each feature cluster, inter-cluster code deduplication is performed on the remaining production traffic after intra-cluster code deduplication within each feature cluster.
[0054] In step 301 above, code deduplication is performed only within the feature clusters. In step 303, based on the deduplication result of step 301, code deduplication is further performed between feature clusters, that is, code deduplication is performed across all feature clusters. Thus, two rounds of code-based production traffic deduplication are performed, one within a feature cluster and one between feature clusters. This ensures comprehensive code coverage while simplifying the test traffic set, and the deduplication efficiency is high. However, the implementation of step 107 is not limited to the above implementation. For example, code deduplication can be performed directly across all feature clusters, but this implementation is less efficient than the two-step deduplication method described in steps 301 and 303.
[0055] In this embodiment, step 301 may include: removing a portion of the multiple production flows that cover the same code in the remaining production flows after feature deduplication within each feature cluster.
[0056] Step 303 above may include: for multiple production flows with identical code remaining after deduplication within each feature cluster, removing a portion of these multiple production flows. In steps 301 and 303 above, when removing a portion of the multiple production flows, the number of production flows to be removed and which specific production flows to remove can be referenced to the removal process described in step 103 above.
[0057] After step 105 and before step 107, the method of this embodiment may further include: preprocessing the code obtained in step 105, wherein the preprocessing retains only the core code of the obtained code to represent the obtained code. That is, removing parts from the obtained code that are not closely related to the core function, which can be omitted when considering code coverage. Furthermore, in step 107, code deduplication can be performed on the remaining production traffic after feature deduplication in each feature cluster obtained after the above preprocessing, based on the core code of the code covered by each production traffic after feature deduplication. Here, code deduplication based on the core code of the code covered by the production traffic may involve removing a portion of multiple production traffic with the same core code of the covered code.
[0058] Therefore, it is possible to deduplicate the core code, thereby removing interference from non-core parts of the code.
[0059] In addition, after step 105 above, the method of this embodiment may further include the following step: based on the code covered by each production flow remaining after feature deduplication in each feature cluster obtained in step 105, construct a mapping relationship between each feature cluster and the code covered by each feature cluster. Since one feature cluster corresponds to one feature, the mapping relationship between each feature cluster and the code covered by each feature cluster reflects the mapping relationship between each feature and the code covered by each feature. The execution order of this step and step 107 can be arbitrarily set, that is, this step can be executed before or after step 107, or it can be executed in parallel with step 107.
[0060] The mapping relationship established in this step corresponds to the test traffic set obtained in step 107. That is, this mapping relationship reflects the characteristics and code factors considered when obtaining the test traffic set. Therefore, this mapping relationship can serve as a description of the generation environment for the test traffic set, allowing test managers to refer to it for appropriate selection and use of the corresponding test traffic set.
[0061] This embodiment is not limited to the above implementation method. If the code obtained in step 105 has been preprocessed, the mapping relationship between each feature cluster and the core code of the code covered by each feature cluster can also be constructed based on the core code of each production flow that remains after feature deduplication in each feature cluster obtained after preprocessing.
[0062] The test traffic set acquisition method in this embodiment performs feature deduplication and code deduplication on the production traffic based on two dimensions: feature and code coverage. The remaining production traffic after deduplication constitutes the test traffic set for code testing. Therefore, it can simplify the test traffic set as much as possible through deduplication, and ensure that the remaining production traffic after deduplication can fully cover both features and code. Thus, it achieves the effect of improving testing efficiency without sacrificing feature coverage and code coverage.
[0063] Example 2
[0064] This embodiment 2 provides a device for acquiring test traffic sets. The contents of this embodiment 2 that are the same as those of embodiment 1 will not be repeated here; the following describes the differences between this embodiment 2 and embodiment 1.
[0065] Figure 4 This is a schematic diagram of the acquisition device in this embodiment. For example... Figure 4 As shown, the acquisition device 400 includes an aggregation unit 401, a feature deduplication unit 402, a code acquisition unit 403, and a code deduplication unit 404. The aggregation unit 401 aggregates multiple production flows based on at least one feature contained in them to obtain at least one feature cluster of the production flows, with each feature cluster containing the same feature. The feature deduplication unit 402 performs feature deduplication on the production flows in each feature cluster based on the similarity of the feature values of each production flow within each feature cluster. The code acquisition unit 403 acquires the code covered by each production flow remaining after feature deduplication in each feature cluster. The code deduplication unit 404 performs code deduplication on the remaining production flows in each feature cluster based on the code covered by each production flow remaining after feature deduplication in each feature cluster. The remaining production flows in each feature cluster constitute a test flow set for code testing.
[0066] The production flow, features, and feature clustering in this embodiment are the same as in Embodiment 1, and will not be repeated here.
[0067] In this embodiment, the feature deduplication unit 402 can remove a portion of multiple production traffic flows for each feature cluster where the similarity of feature values is higher than a predetermined similarity threshold.
[0068] Figure 5 This is another schematic diagram of the acquisition device in this embodiment. For example... Figure 5As shown, the acquisition device 500 may include an aggregation unit 501, a similarity determination unit 505, a feature deduplication unit 502, a code acquisition unit 503, and a code deduplication unit 504. The aggregation unit 501 is the same as the aggregation unit 401 described above, and will not be repeated here. The similarity determination unit 505 determines the similarity of the feature values of each production flow in each feature cluster. The first deduplication unit 502 performs feature deduplication on the production flows in each feature cluster based on the similarity of the feature values of each production flow in each feature cluster determined by the similarity determination unit 505. The code acquisition unit 503 and the code deduplication unit 504 are the same as the code acquisition unit 403 and the code deduplication unit 404 described above, and will not be repeated here.
[0069] Figure 6 This is a schematic diagram of the code deduplication unit in this embodiment. For example... Figure 6 As shown, the code deduplication unit 404 (or code deduplication unit 504) may include an intra-cluster code deduplication unit 601 and an inter-cluster code deduplication unit 602. Specifically, the intra-cluster code deduplication unit 601 performs intra-cluster code deduplication on the remaining production traffic within each feature cluster, based on the code covered by each production traffic after feature deduplication within each feature cluster; the inter-cluster code deduplication unit 602 performs inter-cluster code deduplication on the remaining production traffic between each feature cluster, based on the code covered by each production traffic after intra-cluster code deduplication within each feature cluster.
[0070] Figure 7 This is another schematic diagram of the acquisition device in this embodiment. For example... Figure 7 As shown, the acquisition device 700 includes an aggregation unit 701, a feature deduplication unit 702, a code acquisition unit 703, a code preprocessing unit 705, and a code deduplication unit 704. The aggregation unit 701, feature deduplication unit 702, and code acquisition unit 703 are the same as those described above (aggregation unit 401, feature deduplication unit 402, and code acquisition unit 403), and will not be repeated here. The code preprocessing unit 705 preprocesses the code acquired by the code acquisition unit 703, retaining only the core code of the acquired code to represent it. The code deduplication unit 704, based on the core code of the remaining production traffic in each feature cluster obtained after feature deduplication in each feature cluster obtained by the code preprocessing unit 705, performs code deduplication on the remaining production traffic in each feature cluster. The remaining production traffic in each feature cluster constitutes a test traffic set for code testing. The code preprocessing unit 705 can be omitted.
[0071] In addition, such as Figure 7As shown, the acquisition device 700 may further include a mapping relationship construction unit 706. The mapping relationship construction unit 706 constructs a mapping relationship between each feature cluster and the code covered by each feature cluster, based on the code covered by each production flow remaining after feature deduplication in each feature cluster acquired by the code acquisition unit 703. However, this embodiment is not limited to this. When the acquisition device 700 includes a code preprocessing unit 705, the mapping relationship construction unit 706 may also construct a mapping relationship between each feature cluster and the core code covered by each feature cluster, based on the core code of each production flow remaining after feature deduplication in each feature cluster obtained after preprocessing by the code preprocessing unit 705.
[0072] The test traffic set acquisition device in this embodiment performs feature deduplication and code deduplication on the production traffic based on two dimensions: feature and code coverage. The remaining production traffic after deduplication constitutes the test traffic set for code testing. Therefore, it can simplify the test traffic set as much as possible through deduplication, and ensure that the remaining production traffic after deduplication can fully cover both features and code. Thus, it achieves the effect of improving testing efficiency without sacrificing feature coverage and code coverage.
[0073] Example 3
[0074] This embodiment 3 provides an electronic device. The contents of this embodiment 3 that are the same as those of embodiment 1 or embodiment 2 will not be repeated. The following description focuses on the differences between this embodiment 3 and embodiment 1 or embodiment 2.
[0075] Figure 8 This is a schematic diagram of the electronic device in this embodiment. For example... Figure 8 As shown, the electronic device 800 may include a processor 801 and a memory 802, with the memory 802 coupled to the processor 801.
[0076] The memory 802 can store programs for implementing certain functions, such as programs for implementing the acquisition method of embodiment 1, and the programs are executed under the control of the processor 801. In addition, the memory 802 can also store various data, such as the similarity of feature values, the mapping relationship between features and codes, etc.
[0077] In one embodiment, the functions of the acquisition device in Embodiment 2 can be integrated into the processor 801 for execution.
[0078] In this embodiment, the processor 801 can be configured as follows:
[0079] Based on at least one feature contained in multiple production flows, the multiple production flows are aggregated to obtain at least one feature cluster of the production flows, wherein the production flows in each feature cluster contain the same feature;
[0080] Based on the similarity of the feature values of each production flow in each feature cluster, feature deduplication is performed on the production flow in each feature cluster;
[0081] Obtain the code covered by each production traffic that remains after feature deduplication in each of the aforementioned feature clusters;
[0082] Based on the code covered by each production traffic remaining after feature deduplication in each of the feature clusters, code deduplication is performed on the remaining production traffic in each of the feature clusters after feature deduplication, and the remaining production traffic in each of the feature clusters after code deduplication constitutes a test traffic set for code testing.
[0083] In this embodiment, the processor 801 can also be configured as follows:
[0084] For multiple production traffic flows in each feature cluster where the similarity of feature values is higher than a specified similarity threshold, a portion of those multiple production traffic flows are removed.
[0085] In this embodiment, the processor 801 can also be configured as follows:
[0086] The simhash algorithm is used to calculate the similarity of feature values.
[0087] In this embodiment, the processor 801 can also be configured as follows:
[0088] The remaining production traffic after feature deduplication in each of the feature clusters is input into the test benchmark environment one by one.
[0089] Based on the processing of each production flow input under the aforementioned test benchmark environment, the code covered by each production flow is determined.
[0090] In this embodiment, the processor 801 can also be configured as follows:
[0091] The code covered by each production traffic remaining after feature deduplication in each of the acquired feature clusters is preprocessed. This preprocessing retains only the core code of the acquired code to represent the acquired code.
[0092] In this embodiment, the processor 801 can also be configured as follows:
[0093] Based on the code covered by each production traffic remaining after feature deduplication within each feature cluster, code deduplication within each cluster is performed on the remaining production traffic after feature deduplication.
[0094] Based on the code covered by each production traffic remaining after the code deduplication within each of the aforementioned feature clusters, inter-cluster code deduplication is performed on the remaining production traffic after the code deduplication within each of the aforementioned feature clusters.
[0095] In this embodiment, the processor 801 can also be configured as follows:
[0096] For multiple production flows with the same code that remain in the production flows after feature deduplication within each feature cluster, remove a portion of these multiple production flows;
[0097] For multiple production traffic flows with the same code that remain after code deduplication within each of the aforementioned feature clusters, a portion of these multiple production traffic flows are removed.
[0098] In this embodiment, the processor 801 can also be configured as follows:
[0099] Based on the code covered by each production traffic remaining after feature deduplication in each feature cluster, a mapping relationship is constructed between each feature cluster and the code covered by each feature cluster.
[0100] like Figure 8 As shown, the electronic device 800 may further include a communication unit 803, a display unit 804, and an operation unit 805. The communication unit 803 can send or receive information via the Internet, such as receiving production traffic (external requests) or sending test traffic sets. The display unit 804 is used to display display objects such as images and text under the control of the processor 801, such as displaying a test management interface. The display unit 804 may be, for example, a liquid crystal display. The operation unit 805 is used by test management personnel to perform operations and provide operation information to the processor 801. The operation unit 805 may be, for example, a button or a touchpad.
[0101] It is worth noting that electronic equipment 800 is not necessarily required to include it. Figure 8 All components shown may be omitted as needed; for example, one or more of the communication unit 803, display unit 804, and operation unit 805 may be omitted. Furthermore, the electronic device 800 may also include… Figure 8 For components not shown, please refer to existing technologies.
[0102] In this embodiment of the invention, the term "electronic device" includes user equipment and network equipment. The user equipment includes, but is not limited to, smartphones, tablets, and personal computers; the network equipment includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing, which is a type of distributed computing consisting of a super virtual computer composed of a group of loosely coupled computers. The computer equipment can operate independently to implement this application, or it can connect to a network and implement this application through interaction with other computer equipment in the network. The network in which the computer equipment is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, and VPN network.
[0103] It should be noted that the user equipment, network equipment, and networks mentioned are merely examples. Other existing or future computer equipment or networks that are applicable to this application should also be included within the scope of protection of this application and are incorporated herein by reference.
[0104] The electronic device in this embodiment performs feature deduplication and code deduplication on production traffic based on two dimensions: feature and code coverage. The remaining production traffic after deduplication constitutes a test traffic set for code testing. Therefore, the test traffic set can be simplified as much as possible through deduplication, while ensuring that the remaining production traffic after deduplication can fully cover both features and code. Thus, the effect of improving testing efficiency is achieved without sacrificing feature coverage and code coverage.
[0105] This invention also provides a processor-readable program that causes the processor to execute the methods described in this invention.
[0106] This invention also provides a storage medium storing a processor-readable program that causes the processor to execute the methods described in this invention.
[0107] The methods / apparatus described above in this invention can be implemented in hardware or in combination with software. This invention relates to computer-readable programs that, when executed by a logic component, enable that logic component to implement the apparatus or constituent parts described above, or to implement the various methods or steps described above. Logic components include, for example, field-programmable logic devices (FPGAs), microprocessors, and processors used in computers. This invention also relates to storage media for storing the above programs, such as hard disks, magnetic disks, optical disks, DVDs, flash memory, etc.
[0108] The methods / apparatus described in conjunction with the embodiments of the present invention can be directly embodied in hardware, software modules executed by a processor, or a combination of both. For example, Figure 4One or more, and / or combinations of one or more, functional block diagrams shown can correspond to either software modules or hardware modules in a computer program flow. These software modules can respectively correspond to... Figure 1 The steps are shown in the diagram. These hardware modules can be implemented by embedding these software modules, for example, using a field-programmable gate array (FPGA).
[0109] The software module can reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art. A storage medium can be coupled to the processor, enabling the processor to read information from and write information to the storage medium; or the storage medium can be an integral part of the processor. The processor and storage medium can reside in an ASIC. The software module can be stored in the device's memory or in a memory card that can be inserted into the device. For example, if the device uses a high-capacity MEGA-SIM card or a high-capacity flash memory device, the software module can be stored in the MEGA-SIM card or the high-capacity flash memory device.
[0110] One or more and / or one or more combinations of functional blocks described in the accompanying drawings can be implemented as a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, or any suitable combination thereof for performing the functions described herein. One or more and / or one or more combinations of functional blocks described in the accompanying drawings can also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors in communication with a DSP, or any other such configuration.
[0111] The present application has been described above with reference to specific embodiments. However, those skilled in the art should understand that these descriptions are exemplary and not intended to limit the scope of protection of the present application. Those skilled in the art can make various modifications and variations to the present application based on its principles, and these modifications and variations are also within the scope of the present application.
Claims
1. A method for obtaining a test traffic set, wherein, The method includes: Based on at least one functional feature contained in multiple production flows, the multiple production flows are aggregated to obtain at least one feature cluster of the production flows, wherein the production flows in each feature cluster contain the same functional feature. Based on the similarity of the feature values of each production flow in each feature cluster, feature deduplication is performed on the production flow in each feature cluster; Obtain the code covered by each production traffic that remains after feature deduplication in each of the aforementioned feature clusters; Based on the code covered by each production traffic remaining after feature deduplication in each of the feature clusters, code deduplication is performed on the remaining production traffic in each of the feature clusters after feature deduplication, and the remaining production traffic in each of the feature clusters after code deduplication constitutes a test traffic set for code testing.
2. The method according to claim 1, wherein, The step of deduplicating features of production flows in each feature cluster based on the similarity of feature values of each production flow in each feature cluster includes: For multiple production traffic flows in each feature cluster where the similarity of feature values is higher than a specified similarity threshold, a portion of those multiple production traffic flows are removed.
3. The method according to claim 1 or 2, wherein, The similarity of the feature values is calculated using the simhash algorithm.
4. The method according to claim 1, wherein, Obtain the code covered by each production traffic remaining after feature deduplication in each of the aforementioned feature clusters, including: The remaining production traffic after feature deduplication in each of the aforementioned feature clusters is input into the test benchmark environment one by one. Based on the processing of each production flow input under the aforementioned test benchmark environment, the code covered by each production flow is determined.
5. The method according to claim 1, wherein, The step of deduplicating the code covered by each production traffic remaining after feature deduplication in each of the feature clusters includes: Based on the code covered by each production traffic remaining after feature deduplication within each feature cluster, code deduplication within each cluster is performed on the remaining production traffic after feature deduplication. Based on the code covered by each production traffic remaining after the code deduplication within each of the aforementioned feature clusters, inter-cluster code deduplication is performed on the remaining production traffic after the code deduplication within each of the aforementioned feature clusters.
6. The method according to claim 5, wherein, The step involves deduplicating the code covered by each production traffic remaining after feature deduplication within each feature cluster, and performing in-cluster code deduplication on the remaining production traffic within each feature cluster, including: For each of the aforementioned feature clusters, after feature deduplication, if multiple production traffic flows still contain the same code, a portion of these multiple production traffic flows are removed. Furthermore, based on the code covered by each production traffic remaining after intra-cluster code deduplication within each of the aforementioned feature clusters, inter-cluster code deduplication is performed on the remaining production traffic after intra-cluster code deduplication within each of the aforementioned feature clusters, including: For multiple production traffic flows with the same code that remain after code deduplication within each of the aforementioned feature clusters, a portion of these multiple production traffic flows are removed.
7. The method according to claim 1, wherein, After obtaining the code covered by each production traffic remaining after feature deduplication in each of the aforementioned feature clusters, the method further includes: Based on the code covered by each production traffic remaining after feature deduplication in each feature cluster, a mapping relationship is constructed between each feature cluster and the code covered by each feature cluster.
8. A device for acquiring a test traffic set, wherein, The device includes: An aggregation unit aggregates multiple production flows based on at least one functional feature contained therein to obtain at least one feature cluster of the production flows, wherein the production flows in each feature cluster contain the same functional feature. The feature deduplication unit performs feature deduplication on the production traffic in each of the feature clusters based on the similarity of the feature values of each production traffic in each feature cluster; The code acquisition unit acquires the code covered by each production traffic that remains after feature deduplication in each of the feature clusters. The code deduplication unit performs code deduplication on the remaining production traffic in each of the feature clusters after feature deduplication, based on the code covered by each production traffic remaining after feature deduplication in each feature cluster. The remaining production traffic in each feature cluster after code deduplication constitutes a test traffic set for code testing.
9. A storage medium storing a processor-readable program, said program causing the processor to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Screening method and device of test data
CN103218297A
Test case generation and test method and device, apparatus and system
CN110221965A