Detailed Description
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described in detail below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of protection.
In the prior art, in order to satisfy the sufficiency of the functional verification, a mode of simulating user behaviors is used in the test process of a service system, and the method generally includes two types: 1. the manual analysis mode is mainly based on the service requirement and the system implementation scheme, and the function points are manually analyzed; the scheme is limited by expert experience, and function omission caused by artificial omission easily occurs; 2. the flow playback mode is as follows: based on the production service flow logs in fixed time, the functional points are abstracted through the service keywords, and the scheme is limited by the limitation of the production service types in fixed time and the limitation of log information, so that the completeness coverage of the functional points cannot be achieved. Based on this, embodiments of the present specification provide a test scheme for a service system, so as to meet the sufficiency of functional verification and implement full coverage testing on a service scenario.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings. As shown in fig. 1, fig. 1 is a schematic flowchart of a method for testing a service system provided in an embodiment of this specification, where the flowchart specifically includes the following steps:
s101, acquiring a real data instance contained in the service data.
In particular, the way of acquiring business data should be collected from various aspects of the business. For example, the data of the service request can be collected so as to obtain the behavior characteristics of the client; collecting service storage data, namely data produced by a system based on a service request or service logic; and, in some service scenarios, the service function may also be related to the system configuration, and at this time, system configuration data, i.e. system configuration logic, needs to be collected; and collecting the code logic of the service system so as to obtain a corresponding real data example.
The real data instance may contain a plurality of business features, as shown in fig. 2, and fig. 2 is an exemplary schematic diagram of the real data instance provided by the embodiment of the present disclosure. In the schematic diagram, the service request instance includes service features "exchange code", "service type", "requestor", "transaction status", "return code", and "transaction recovery type", etc., and other system configuration instances and system code logic also each include different service features. Furthermore, in data instances from different sources, they may contain the same traffic characteristics. For example, a return code is included in both the service request and the system configuration. In practical applications, a full amount of data sources that fully cover the capabilities of the business system can be obtained by obtaining data from all aspects related to the functionality of the business system, and is not limited to the data sources shown in fig. 2.
S103, clustering the real data instances, and determining a service characteristic factor corresponding to each class, wherein the service characteristic factor is used for expressing an instance set with the same service characteristics.
Clustering of all real data instances can be performed based on various service characteristics in the real data instances. In fact, a real data instance itself can be regarded as a piece of code, and the purpose of clustering is to extract the common attributes from a plurality of similar codes. For example, based on "type of service" B01 "," type of service "B02" and "type of service" B10 "in the service request example in fig. 2, a" type of service feature factor "for characterizing the type of service is obtained by clustering. The business feature factor can be an abstract business code, and any business feature factor represents an instantiable class and can be instantiated. All instances obtained by instantiating the business feature factor have the same business feature. For example, the instances to which the "business type characteristic factors" are instantiated all contain the same business characteristic "business type".
And S105, instantiating the determined plurality of service characteristic factors to generate a plurality of expanded data instances, wherein one service characteristic factor corresponds to at least one expanded data instance.
Specifically, each service characteristic factor may be instantiated based on actual needs of the service system, so as to obtain an instance set corresponding to the service characteristic factor, where each instance set at least includes one augmented data instance, that is, one service characteristic factor corresponds to at least one augmented data instance.
In the instantiation process, instantiation may be performed according to the real data instance, for example, a "service type feature factor" is instantiated according to a value existing in the acquired real data instance to obtain a service type instance "B01", "B02", and "B10"; the instantiation can also be performed according to actual needs, for example, a related service with the service type "B11" is not on-line, and there is no related service request instance, but at this time, the instantiation can also be performed based on the "service type characteristic factor" to obtain the service type "B11" that does not exist in the real data, and cover more service function points. In other words, the specific instantiation method can be just in accordance with the specification of the service characteristic factor and the requirement of the actual service scene.
S107, generating corresponding scene examples based on the combination mode of the plurality of generated expansion data examples, and performing traversal test on the full amount of scene examples, wherein each scene example corresponds to one combination mode.
The scene instance may include a plurality of service features, and the difference of the scene instance represents that the included service features are different and the values of the service features are different. Each extended data instance expresses a certain value of a certain service characteristic, so that the scene instance can be expressed by different combinations of the extended data instances, and each scene instance corresponds to a combination.
All possible scene instances are contained in the combination mode of the expansion data instance. Therefore, the combination mode corresponding to the full scene instance may be a full combination mode of all the extended data instances; or, a certain condition may be screened according to actual needs, for example, the extended data instances included in the scenario instances are derived from instance sets respectively generated by some specified service feature factors, and one extended data instance is taken from each instance set to be combined to generate scenario instances that may be included in the service system.
The scene examples generated based on the service scene contain a certain form of specification or attribute, the correctness and the inaccuracy of the certain form of specification or attribute can be proved by using a mathematical method, further, all the scene examples can be subjected to traversal test, and the specific test mode can be subjected to formal traversal verification through manual use cases or drive automatic test cases.
The method comprises the steps of collecting multidimensional data sources of a service system, carrying out clustering analysis to obtain relevant service characteristic factors, carrying out expansion based on the service characteristic factors to obtain more expansion data examples, and further calculating to obtain full service scene examples, so that the effect of formal full verification is achieved by traversing and verifying the full service scene examples. By the scheme, the function point complete set can be output according to the extracted service characteristic factors without the limitation of experience, all states in the system operation process are exhausted to accurately verify the system functions, and the service function points are more completely covered.
In practical applications, when real data instances are clustered, the data types of the real data instances are different due to different data sources, and as shown in fig. 2, the data types of the service request instances, the system configuration instances, and the system code instances are different. However, in the clustering process, some service features of different data types may have the same or similar places. For example, the "synchronization" in the system configuration instance also exists in the system code logic, and it is only necessary to know whether the final result of the "synchronization" is "N" or "Y" in the system configuration instance. But in the system code logic, there is actually a further subdivision of "synchronize or not", where "AC, SM, CD, UN, SU, FA" corresponds to the states "initialized, sent, acknowledged, unknown, successful, failed", respectively. In order to avoid the mutual influence among different types of data examples in the clustering process, at the moment, the data examples of different data types can be clustered separately and then summarized. That is, the data types included in the real data instances can be determined, the real data instances of the same data type are clustered, and the business feature factor corresponding to each class is determined.
Further, when there are multiple data types and clustering is performed, repeated service characteristic factors may occur when aggregation is performed after the service characteristic factors corresponding to the real data instances. For example, after clustering the data instances of different data types in fig. 2, the service characteristic factors "return code", "flow template", etc. will repeatedly appear, and therefore, the repeatedly appearing service characteristic factors can also be filtered from the determined service characteristic factors.
In a specific embodiment, for the combination manner of the multiple generated augmented data instances in S105, generating the corresponding scene instance may adopt the following manner: establishing a business model based on the expansion data instance; and calculating and acquiring scene instances corresponding to the combination modes of all the extended data instances according to the service model. Specifically, an extended data instance set corresponding to each service characteristic factor may be determined, a service model including all the service characteristic factors is established, and then, according to the requirement of an actual service scene, a corresponding combination algorithm is determined, and extended data instances are selected from the extended data instance set according to the combination algorithm to be combined, so as to generate a scene instance. As shown in fig. 3, fig. 3 is a schematic diagram of a generation scenario example provided in an embodiment of the present specification. When the scene instance is generated by the service model containing the full-scale extended data instance, the service scene can be completely covered only according to a preset algorithm, and the full-scale scene instance is obtained. It is not necessary that all of the service features be included in a particular generated instance of a scene. By establishing the service model containing all service characteristic factors, an algorithm can be set to adjust the combination mode of the extended data instances in the model, and the scene instances are more convenient to generate.
In a specific embodiment, when generating a scene instance based on a combination manner of the extended data instances, a combination order of the extended data instances may be predetermined based on an actual situation of a service, and the corresponding scene instance is generated based on a combination manner that meets the combination order in all the combination manners of the extended data instances. For example, assuming that there are service feature factors "service type" and "sub-service type" in a service scenario, it may be predetermined that an augmented data instance generated by "service type" precedes an augmented data instance generated by "sub-service type" in a combined generation scenario instance. The combination sequence of the expansion book examples in the scene examples is predefined based on actual needs, so that some meaningless example combinations which do not conform to real logic can be avoided, and the testing workload is reduced.
Correspondingly, an embodiment of the present specification further provides a testing apparatus for a service system, as shown in fig. 4, fig. 4 is a schematic structural diagram of the testing apparatus for a service system provided in the embodiment of the present specification, and includes:
the obtaining module 401 obtains a real data instance included in the service data;
a clustering module 403, configured to cluster the real data instances, and determine a service characteristic factor corresponding to each class, where the service characteristic factor is used to express an instance set with the same service characteristics;
an instantiation module 405 for instantiating the determined plurality of service characteristic factors to generate a plurality of extended data instances, wherein one service characteristic factor corresponds to at least one extended data instance;
the testing module 407 generates corresponding scenario instances based on a combination manner of the generated multiple extended data instances, and performs traversal testing on the full amount of scenario instances, where each scenario instance corresponds to one combination manner.
Further, the obtaining module 401 obtains service request data, service storage data, system configuration data, and real data examples included in the system code logic of the service system.
Further, the clustering module 403 determines the data type included in the real data instance; and clustering real data examples of the same data type, and determining a service characteristic factor corresponding to each class.
Further, when there are multiple data types, the clustering module 403 determines the service characteristic factor corresponding to each real data instance of each data type; and filtering the repeated service characteristic factors from the determined service characteristic factors.
Further, the instantiation module 405 instantiates each determined service feature factor according to the real data instance included in the service data.
Further, the testing module 407 establishes a service model based on the extended data instance; and calculating and acquiring scene instances corresponding to the combination modes of all the extended data instances according to the service model.
Further, the test module 407 determines a combination order of the augmented data instances; and generating the corresponding scene instance based on the combination mode which accords with the combination sequence in all the combination modes of the expansion data instance.
The embodiment of the present specification further provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for testing the business system shown in fig. 1 when executing the program.
Fig. 5 is a schematic diagram illustrating a more specific hardware structure of a computing device according to an embodiment of the present disclosure, where the computing device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The embodiment of the present specification further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the business risk prevention and control method shown in fig. 1.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
From the above description of the embodiments, it is clear to those skilled in the art that the embodiments of the present disclosure can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments of the present specification.
The systems, methods, modules or units described in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the method embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to the partial description of the method embodiment for relevant points. The above-described method embodiments are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the functions of the modules may be implemented in one or more software and/or hardware when implementing the embodiments of the present specification. And part or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is only a specific embodiment of the embodiments of the present disclosure, and it should be noted that, for those skilled in the art, a plurality of modifications and decorations can be made without departing from the principle of the embodiments of the present disclosure, and these modifications and decorations should also be regarded as the protection scope of the embodiments of the present disclosure.