CN109840196B - Method and device for testing business logic - Google Patents

Method and device for testing business logic Download PDF

Info

Publication number
CN109840196B
CN109840196B CN201711228914.3A CN201711228914A CN109840196B CN 109840196 B CN109840196 B CN 109840196B CN 201711228914 A CN201711228914 A CN 201711228914A CN 109840196 B CN109840196 B CN 109840196B
Authority
CN
China
Prior art keywords
preset processing
processing rule
rule
use case
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711228914.3A
Other languages
Chinese (zh)
Other versions
CN109840196A (en
Inventor
周雪梅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201711228914.3A priority Critical patent/CN109840196B/en
Publication of CN109840196A publication Critical patent/CN109840196A/en
Application granted granted Critical
Publication of CN109840196B publication Critical patent/CN109840196B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the application discloses a method and a device for testing service logic. One embodiment of the method comprises: acquiring a preset processing rule and a preset processing result corresponding to the preset processing rule; when a source data object is read by adopting a preset processing rule, adding a sampling use case of the source data object to a temporary object queue; after a source data object is processed by adopting a preset processing rule, adding a processed sampling case to a temporary object queue; calculating a difference set of the sampling use cases and the sampling use cases processed in the temporary object queue by adopting an asynchronous task, and marking the difference set as a use case processing result corresponding to a preset processing rule; and determining whether the business logic of the preset processing rule is accurate or not based on the case processing result and the preset processing result. The embodiment improves the accuracy of testing big data.

Description

Method and device for testing business logic
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to the technical field of computer networks, and particularly relates to a method and a device for testing business logic.
Background
At present, when testing whether the business logic of big data processed based on preset processing rules is accurate, the previous testing method is still used, for example, an equivalence class division method, a boundary value analysis method, a causal graph method and the like are adopted to build different testing data so as to cover the corresponding test cases.
Disclosure of Invention
The embodiment of the application provides a method and a device for testing service logic.
In a first aspect, an embodiment of the present application provides a method for testing a service logic, including: acquiring a preset processing rule and a preset processing result corresponding to the preset processing rule; when a source data object is read by adopting a preset processing rule, adding a sampling use case of the source data object to a temporary object queue; after a source data object is processed by adopting a preset processing rule, adding a processed sampling case to a temporary object queue; calculating a difference set of the sampling use cases and the sampling use cases processed in the temporary object queue by adopting an asynchronous task, and marking the difference set as a use case processing result corresponding to a preset processing rule; and determining whether the business logic of the preset processing rule is accurate or not based on the case processing result and the preset processing result.
In some embodiments, determining whether the business logic of the preset processing rule is accurate based on the case processing result and the preset processing result includes: if the case processing result is consistent with the preset processing result, determining that the service logic in the preset processing rule is accurate; and if the case processing result is inconsistent with the preset processing result, determining that the business logic in the preset processing rule is inaccurate.
In some embodiments, the preset processing rules include one or more of: query processing rules, filter processing rules, and filter processing rules.
In some embodiments, the method further comprises: and deleting the sampling use case of the source data object in the temporary object queue by adopting the asynchronous task to respond to the use case processing result of marking the difference set as the corresponding preset processing rule.
In some embodiments, the method further comprises: and adopting the asynchronous task to respond that only one temporary object is included in the temporary object queue, and ending the asynchronous task.
In some embodiments, the preset processing rules include: a plurality of serial preset processing rules; adding the sample use case of the source data object to the temporary object queue comprises: and if the preset processing rule is not the first preset processing rule in the plurality of serial preset processing rules, taking the sampling use case processed by the last preset processing rule in the temporary object queue as the sampling use case of the source data object of the current preset processing rule.
In a second aspect, an embodiment of the present application provides an apparatus for testing service logic, including: a rule result obtaining unit, configured to obtain a preset processing rule and a preset processing result corresponding to the preset processing rule; the sampling case adding unit is used for adding the sampling case of the source data object to the temporary object queue when the source data object is read by adopting a preset processing rule; the processing result adding unit is used for adding the processed sampling case to the temporary object queue after the source data object is processed by adopting a preset processing rule; the asynchronous task computing unit is used for computing a difference set of the sampling use cases and the sampling use cases processed in the temporary object queue by adopting an asynchronous task, and marking the difference set as a use case processing result corresponding to a preset processing rule; and the business logic determining unit is used for determining whether the business logic of the preset processing rule is accurate or not based on the use case processing result and the preset processing result.
In some embodiments, the service logic determination unit is further configured to: if the case processing result is consistent with the preset processing result, determining that the service logic in the preset processing rule is accurate; and if the case processing result is inconsistent with the preset processing result, determining that the business logic in the preset processing rule is inaccurate.
In some embodiments, the preset processing rule in the rule result obtaining unit includes one or more of: query processing rules, filter processing rules, and filter processing rules.
In some embodiments, the apparatus further comprises: and the asynchronous task deleting unit is used for deleting the sampling use cases of the source data objects in the temporary object queue by adopting the asynchronous task to respond to the use case processing result of marking the difference set as the corresponding preset processing rule.
In some embodiments, the apparatus further comprises: and the asynchronous task ending unit is used for adopting the asynchronous task to respond that only one temporary object is included in the temporary object queue and ending the asynchronous task.
In some embodiments, the preset processing rule in the rule result obtaining unit includes: a plurality of serial preset processing rules; the sampling use case adding unit is further used for: and if the preset processing rule is not the first preset processing rule in the plurality of serial preset processing rules, taking the sampling case processed by the last preset processing rule in the temporary object queue as the sampling case of the source data object of the current preset processing rule.
In a third aspect, an embodiment of the present application provides an apparatus, including: one or more processors; storage means for storing one or more programs; when executed by one or more processors, cause the one or more processors to implement a method of testing business logic as any one of above.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements a method for testing business logic as any one of the above.
According to the method and the device for testing the business logic, firstly, a preset processing rule and a preset processing result corresponding to the preset processing rule are obtained; then, when reading the source data object by adopting a preset processing rule, adding a sampling use case of the source data object to a temporary object queue; then, after the source data object is processed by adopting a preset processing rule, adding the processed sampling case to a temporary object queue; then, calculating a difference set of the sampling use cases and the sampling use cases processed in the temporary object queue by adopting an asynchronous task, and marking the difference set as a use case processing result corresponding to a preset processing rule; and finally, determining whether the service logic of the preset processing rule is accurate or not based on the case processing result and the preset processing result. In the process, whether the service logic of the preset processing rule is accurate is verified by judging whether the case processing result meets the preset processing result, so that the accuracy of testing the big data is improved.
Drawings
Other features, objects and advantages of embodiments of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, with reference to the accompanying drawings in which:
FIG. 1 illustrates an exemplary system architecture diagram of an embodiment of a method of testing business logic or an apparatus for testing business logic to which the present application may be applied;
FIG. 2 is a schematic flow chart diagram illustrating one embodiment of a method for testing business logic in accordance with an embodiment of the present application;
FIG. 3 is a schematic flow chart diagram of one application scenario of a method of testing business logic in accordance with an embodiment of the present application;
FIG. 4 is an exemplary block diagram of one embodiment of an apparatus for testing business logic in accordance with an embodiment of the present application;
fig. 5 is a schematic block diagram of a computer system suitable for implementing the terminal device or server of the present application.
Detailed Description
The embodiments of the present application will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present application, the embodiments and the features of the embodiments may be combined with each other without conflict. The embodiments of the present application will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
Fig. 1 illustrates an exemplary system architecture 100 to which embodiments of the method of testing business logic or the apparatus for testing business logic of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and servers 105, 106. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the servers 105, 106. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user 110 may use the terminal devices 101, 102, 103 to interact with the servers 105, 106 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a search engine application, a shopping application, an instant messaging tool, a mailbox client, social platform software, a video playing application, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg Audio Layer 4), laptop and desktop computers, and the like.
The servers 105, 106 may be servers providing various services, such as background servers providing support for the terminal devices 101, 102, 103. The background server can store or calculate the data of the terminal and push the storage or calculation result to the terminal device.
It should be noted that the method for testing the service logic provided in the embodiments of the present application is generally performed by the servers 105 and 106, and accordingly, the device for testing the service logic is generally disposed in the servers 105 and 106.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, FIG. 2 illustrates a flow 200 of one embodiment of a method of testing business logic according to the present application. The method for testing the service logic comprises the following steps:
in step 210, a preset processing rule and a preset processing result corresponding to the preset processing rule are obtained.
In this embodiment, when the electronic device (for example, the electronic devices 105 and 106 shown in fig. 1) running the method for testing the business logic obtains the preset processing rule in the real big data processing process, the preset processing result corresponding to the preset processing rule may be obtained.
Illustratively, the preset processing rules may include one or more of: query processing rules, filter processing rules, and filter processing rules.
In step 220, when the source data object is read by using the preset processing rule, the sampling use case of the source data object is added to the temporary object queue.
In this embodiment, the object type of the source data object may be various data sets, and is not limited to the elastic distributed data set RDD, the data frame Dataframe, the independent data set DataSet, and the like. When the electronic equipment of the method for operating the test service logic processes the big data by adopting the preset processing rule, the sampling case in the read source data object is added to the temporary object queue. The sampling case may be a sampling case extracted at random or a sampling case extracted according to a predetermined rule, and the present application does not limit this.
In step 230, after the source data object is processed by the preset processing rule, the processed sampling use case is added to the temporary object queue.
In this embodiment, after the electronic device running the method for testing the business logic processes the big data by using the preset processing rule, the processed sampling case is added to the temporary object queue.
In step 240, the asynchronous task is used to calculate the difference between the sample use case processed in the temporary object queue and the sample use case, and the difference is marked as the use case processing result.
In this embodiment, the asynchronous task may take a value from the temporary object queue, and when the processed sampling use case and the sampling use case are simultaneously obtained, a difference set between the processed sampling use case and the sampling use case is calculated and obtained, and the difference set is marked as a use case processing result, so as to test whether the service logic of the preset processing rule is accurate.
In some optional implementations of this embodiment, the method for testing service logic may further include: and deleting the sampling use case of the data source object in the temporary object queue by adopting the asynchronous task to respond to the use case processing result of marking the difference set as the corresponding preset processing rule.
In the implementation mode, the sampling use cases in the temporary object queue are emptied in time by adopting the asynchronous task, so that the system resources of the electronic equipment can be saved, and the system operation speed of the electronic equipment is improved.
In some optional implementations of this embodiment, the method for testing service logic may further include: and adopting the asynchronous task to respond that only one temporary object is included in the temporary object queue, and ending the asynchronous task.
In this implementation manner, after the electronic device running the method for testing the service logic processes the big data by using the preset processing rule, the electronic device notifies the asynchronous task of the event, and notifies that the asynchronous task is ended when the length of the temporary object queue is 1. And then, the asynchronous task responds to the fact that only one temporary object is included in the temporary object queue, and the asynchronous task is ended, so that the utilization rate of system resources of the electronic equipment is improved.
In step 250, it is determined whether the business logic of the preset processing rule is accurate based on the case processing result and the preset processing result.
In this embodiment, when it is found that a use case processing result with a preset processing rule is generated, whether the processing result of the preset processing rule on the source data object of the big data meets the business logic of the preset processing rule may be verified based on whether the use case processing result is consistent with the preset processing result.
In some optional implementation manners of this embodiment, determining whether the business logic of the preset processing rule is accurate based on the case processing result and the preset processing result may include: if the case processing result is consistent with the preset processing result, determining that the service logic in the preset processing rule is accurate; and if the case processing result is inconsistent with the preset processing result, determining that the business logic in the preset processing rule is inaccurate.
In some optional implementations of this embodiment, the preset processing rule may include: a plurality of serial preset processing rules; and adding the sample use case of the source data object to the temporary object queue may include: and if the preset processing rule is not the first preset processing rule in the plurality of serial preset processing rules, taking the sampling case processed by the last preset processing rule in the temporary object queue as the sampling case of the source data object of the current preset processing rule.
In this implementation manner, for a plurality of serial preset processing rules, the source data object processed by only the first preset processing rule is the read source data object, and the sampling case of the source data object is the sampling case extracted from the read source data object; from the second preset processing rule to the last preset processing rule, the source data object processed by each preset processing rule is the source data object processed by the last preset processing rule, and the sampling case of the source data object is the sampling case processed by the last preset processing rule in the temporary object queue.
The method for testing the service logic provided by the embodiment of the application can introduce the asynchronous task to obtain the difference set before and after the preset processing rule is processed under the scene that the calculation speed of the big data is not influenced, and verify whether the service logic of the preset processing rule is accurate according to whether the case processing result meets the preset processing result, so that the accuracy of testing the big data is improved.
An exemplary application scenario of the method of testing business logic of the present application is described below in conjunction with fig. 3.
As shown in fig. 3, fig. 3 shows a schematic flow chart of an application scenario of a method of testing business logic according to the present application.
As shown in fig. 3, a method 300 of testing business logic operates in an electronic device 320 and may include:
first, a preset processing rule 301 and a preset processing result 302 corresponding to the preset processing rule are obtained.
Thereafter, when the source data object 303 is read using the preset processing rule 301, the sampling use case 304 of the source data object 303 is added to the temporary object queue 305.
Illustratively, the source data object 303 is derived from a primary table (category) in which key records are as follows:
Figure BDA0001487814750000071
Figure BDA0001487814750000081
the categoryid represents the item id, the fastthercategoryid represents the parent id, and if the parent id is 0, the first-level item is represented. In this example, a set of 4-level categories may be used as the source data object, and the sampling use cases in the set of 4-level categories may be used as the sampling use cases of the source data object 303.
Thereafter, after sample use case 304 is processed using preset processing rules 301, processed sample use case 306 is added to temporary object queue 305.
Illustratively, after processing the original table by using the preset processing rule 301, a processed item relationship table (categoryRela) is obtained:
id1 id2 id3 level is_over id
1 null null 1 0 1
1 2 null 2 0 2
1 2 3 3 0 3
1 2 3 4 0 4
1 2 3 5 1 5
1 21 0 2 1 21
wherein id1, id2 and id3 respectively represent primary, secondary and tertiary class ids corresponding to the class id; level, which represents the grade number corresponding to the grade id, wherein the first grade is 1, the second grade is 2, the 3 grade is 3, the 4 grade is 4, and the 5 grade is 5; is _ over, which indicates whether the id class is the final class, if yes, it is 1, if not, it is 0; id denotes the item class id.
In this example, the 4-level category corresponding to the 5-level category in the 4-level category set is the source data object 303 processed by using the preset processing rule, and the sampling use case 306 processed by using the preset processing rule is the sampling use case of the 4-level category corresponding to the 5-level category, and the processed sampling use case 306 may be added to the temporary object queue 305.
Then, the asynchronous task 307 is used to calculate a difference set 308 between the sampling use case 306 and the sampling use case 304 processed in the temporary object queue 305, and the difference set 308 is marked as a use case processing result 309 corresponding to a preset processing rule.
It should be understood that, for the above-mentioned preset processing rule for generating the item class relationship table from the original table, the contents to be verified cover the final level category and the non-final level category. The final class may be a current class minus a current class corresponding to a next class, and a difference set of the current class minus the current class corresponding to the next class is the final class, for example, a 4-class set minus a 4-class set corresponding to a 5-class set is equal to a 4-class set corresponding to the final class. Then, when the preset processing rule is verified, a 4-level category set is set as a data source object, a 4-level category set to which a 5-level category belongs is set as a processed data source object, a difference set of sampling cases obtained before and after the 4-level category is processed by using the preset processing rule (i.e., a case processing result 309 obtained based on the sampling cases before and after the processing in the temporary object queue 305), whether the difference set meets the preset processing result or not is judged, that is, whether the difference set is a 4-level final-level category or not, and whether the service logic of the preset processing rule is accurate or not can be determined. Similarly, the method for testing the business logic can be extended and popularized to other adjacent categories.
Then, based on the use case processing result 309 and the preset processing result 302, it is determined whether the business logic 310 of the preset processing rule is accurate.
When determining whether the service logic 310 of the preset processing rule is accurate, if the case processing result is consistent with the preset processing result, determining that the service logic in the preset processing rule is accurate; and if the case processing result is inconsistent with the preset processing result, determining that the business logic in the preset processing rule is inaccurate.
It should be understood that the method for testing business logic illustrated in fig. 3 is only an exemplary embodiment of the method for testing business logic, and does not represent a limitation to the embodiments of the present application. For example, after obtaining the use case processing result 309 using the asynchronous task, the sampling use case of the data source object in the temporary object queue may be deleted in response to marking the difference set as the use case processing result corresponding to the preset processing rule. For another example, after deleting the sampling use case of the data source object in the temporary object queue, the asynchronous task may be ended in response to only one temporary object being included in the temporary object queue.
The method for testing the service logic provided in the application scenario of the embodiment of the application can introduce an asynchronous task to obtain a difference set before and after the preset processing rule is processed without influencing the scenario that the preset processing rule is adopted to process big data, and divides data according to a real result in the calculation process to verify whether the preset processing rule of the data meets an expected result, so that the difficulty coefficient of testing the service logic of the preset processing rule of the big data is reduced, and the test scenario in big data calculation is covered.
Further referring to fig. 4, as an implementation of the method, the present application provides an embodiment of a device for testing service logic, where the embodiment of the device for testing service logic corresponds to the embodiment of the method for testing service logic shown in fig. 1 to 3, and thus, the operations and features described above for the method for testing service logic in fig. 1 to 3 are also applicable to the device 400 for testing service logic and units included in the device 400 for testing service logic, and are not described again here.
As shown in fig. 4, the apparatus 400 for testing service logic may include: a rule result obtaining unit 410, configured to obtain a preset processing rule and a preset processing result corresponding to the preset processing rule; a sampling use case adding unit 420, configured to add a sampling use case of a source data object to a temporary object queue when the source data object is read by using a preset processing rule; a processing result adding unit 430, configured to add the processed sampling case to the temporary object queue after processing the source data object by using a preset processing rule; the asynchronous task calculating unit 440 is configured to calculate a difference set between the sampling use case and the sampling use case processed in the temporary object queue by using an asynchronous task, and mark the difference set as a use case processing result corresponding to a preset processing rule; the service logic determining unit 450 is configured to determine whether the service logic of the preset processing rule is accurate based on the use case processing result and the preset processing result.
In some optional implementations of the present embodiment, the service logic determining unit 450 is further configured to: if the case processing result is consistent with the preset processing result, determining that the service logic in the preset processing rule is accurate; and if the case processing result is inconsistent with the preset processing result, determining that the business logic in the preset processing rule is inaccurate.
In some optional implementations of the present embodiment, the preset processing rule in the rule result obtaining unit 410 includes one or more of the following: query processing rules, filter processing rules, and filter processing rules.
In some optional implementations of this embodiment, the apparatus further comprises: and an asynchronous task deleting unit 460, configured to delete the sampling use case of the source data object in the temporary object queue in response to the use case processing result that marks the difference set as the corresponding preset processing rule by using the asynchronous task.
In some optional implementations of this embodiment, the apparatus further comprises: an asynchronous task ending unit 470, configured to end the asynchronous task with the asynchronous task in response to only one temporary object being included in the temporary object queue.
In some optional implementations of the present embodiment, the preset processing rule in the rule result obtaining unit 410 includes: a plurality of serial preset processing rules; the sampling use case adding unit 420 is further configured to: and if the preset processing rule is not the first preset processing rule in the plurality of serial preset processing rules, taking the sampling case processed by the last preset processing rule in the temporary object queue as the sampling case of the source data object of the current preset processing rule.
The present application further provides an embodiment of an apparatus, comprising: one or more processors; storage means for storing one or more programs; when executed by one or more processors, cause the one or more processors to implement a method of testing business logic as described in any one of the above.
The present application further provides an embodiment of a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of testing business logic as set forth in any of the above.
Referring now to FIG. 5, a block diagram of a computer system 500 suitable for use in implementing a terminal device or server of an embodiment of the present application is shown. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, the processes described above with reference to the flow diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the method of the embodiment of the present application when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium described in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present application, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a unit, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a rule result acquisition unit, a sampling use case addition unit, a processing result addition unit, an asynchronous task calculation unit, and a business logic determination unit, the names of which do not in some cases constitute a limitation on the unit itself, for example, the rule result acquisition unit may also be described as a "unit that acquires a preset processing rule and a preset processing result corresponding to the preset processing rule".
As another aspect, an embodiment of the present application further provides a non-volatile computer storage medium, where the non-volatile computer storage medium may be a non-volatile computer storage medium included in the apparatus in the foregoing embodiment; or it may be a non-volatile computer storage medium that exists separately and is not incorporated into the terminal. The non-transitory computer storage medium stores one or more programs that, when executed by a device, cause the device to: acquiring a preset processing rule and a preset processing result corresponding to the preset processing rule; when a source data object is read by adopting a preset processing rule, adding a sampling use case of the source data object to a temporary object queue; after a source data object is processed by adopting a preset processing rule, adding a processed sampling case to a temporary object queue; calculating a difference set of the sampling use cases and the sampling use cases processed in the temporary object queue by adopting an asynchronous task, and marking the difference set as a use case processing result corresponding to a preset processing rule; and determining whether the business logic of the preset processing rule is accurate or not based on the case processing result and the preset processing result.
The above description is only a preferred embodiment of the embodiments of the present application and is intended to be illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention according to the embodiments of the present application is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept set forth above. For example, the above features and (but not limited to) the features with similar functions disclosed in the embodiments of the present application are mutually replaced to form the technical solution.

Claims (14)

1. A method of testing business logic, comprising:
acquiring a preset processing rule and a preset processing result corresponding to the preset processing rule;
when a source data object is read by adopting the preset processing rule, adding a sampling use case of the source data object to a temporary object queue;
after the source data object is processed by the preset processing rule, adding the processed sampling use case to the temporary object queue;
calculating a difference set of the processed sampling use case and the sampling use case before processing in the temporary object queue by adopting an asynchronous task, and marking the difference set as a use case processing result corresponding to the preset processing rule;
and determining whether the service logic of the preset processing rule is accurate or not based on the use case processing result and the preset processing result.
2. The method according to claim 1, wherein the determining whether the business logic of the preset processing rule is accurate based on the use case processing result and the preset processing result comprises:
if the case processing result is consistent with the preset processing result, determining that the service logic in the preset processing rule is accurate;
and if the case processing result is inconsistent with the preset processing result, determining that the business logic in the preset processing rule is inaccurate.
3. The method of claim 1, wherein the preset processing rules include one or more of: query processing rules, filter processing rules, and filter processing rules.
4. The method of claim 1, wherein the method further comprises:
and deleting the sampling use case of the source data object in the temporary object queue by adopting the asynchronous task to respond to the use case processing result of marking the difference set as the corresponding preset processing rule.
5. The method of claim 4, wherein the method further comprises: and adopting the asynchronous task to respond that only one temporary object is included in the temporary object queue, and ending the asynchronous task.
6. The method according to any one of claims 1-5, wherein the preset processing rule comprises: a plurality of serial preset processing rules;
the adding the sample use case of the source data object to a temporary object queue comprises: and if the preset processing rule is not the first preset processing rule in the plurality of serial preset processing rules, taking the sampling case processed by the last preset processing rule in the temporary object queue as the sampling case of the source data object of the current preset processing rule.
7. An apparatus for testing business logic, comprising:
a rule result obtaining unit, configured to obtain a preset processing rule and a preset processing result corresponding to the preset processing rule;
the sampling use case adding unit is used for adding the sampling use case of the source data object to a temporary object queue when the source data object is read by adopting the preset processing rule;
a processing result adding unit, configured to add the processed sampling case to the temporary object queue after the source data object is processed by using the preset processing rule;
the asynchronous task computing unit is used for computing a difference set of the processed sampling use case and the sampling use case before processing in the temporary object queue by adopting an asynchronous task, and marking the difference set as a use case processing result corresponding to the preset processing rule;
and the business logic determining unit is used for determining whether the business logic of the preset processing rule is accurate or not based on the use case processing result and the preset processing result.
8. The apparatus of claim 7, wherein the business logic determination unit is further configured to:
if the case processing result is consistent with the preset processing result, determining that the service logic in the preset processing rule is accurate;
and if the case processing result is inconsistent with the preset processing result, determining that the business logic in the preset processing rule is inaccurate.
9. The apparatus according to claim 7, wherein the preset processing rule in the rule result obtaining unit includes one or more of: query processing rules, filter processing rules, and filter processing rules.
10. The apparatus of claim 7, wherein the apparatus further comprises:
and the asynchronous task deleting unit is used for deleting the sampling use case of the source data object in the temporary object queue by adopting the asynchronous task to respond to the use case processing result of marking the difference set as the corresponding preset processing rule.
11. The apparatus of claim 10, wherein the apparatus further comprises:
and the asynchronous task ending unit is used for adopting the asynchronous task to respond that only one temporary object is included in the temporary object queue and ending the asynchronous task.
12. The apparatus according to any one of claims 7 to 11, wherein the preset processing rule in the rule result obtaining unit includes: a plurality of serial preset processing rules;
the sampling use case adding unit is further used for: and if the preset processing rule is not the first preset processing rule in the plurality of serial preset processing rules, taking the sampling case processed by the last preset processing rule in the temporary object queue as the sampling case of the source data object of the current preset processing rule.
13. An apparatus for testing business logic, comprising:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of testing business logic as claimed in any one of claims 1-6.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of testing business logic of any one of claims 1 to 6.
CN201711228914.3A 2017-11-29 2017-11-29 Method and device for testing business logic Active CN109840196B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711228914.3A CN109840196B (en) 2017-11-29 2017-11-29 Method and device for testing business logic

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711228914.3A CN109840196B (en) 2017-11-29 2017-11-29 Method and device for testing business logic

Publications (2)

Publication Number Publication Date
CN109840196A CN109840196A (en) 2019-06-04
CN109840196B true CN109840196B (en) 2022-08-12

Family

ID=66882364

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711228914.3A Active CN109840196B (en) 2017-11-29 2017-11-29 Method and device for testing business logic

Country Status (1)

Country Link
CN (1) CN109840196B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145432A (en) * 2017-03-30 2017-09-08 华为技术有限公司 A kind of method and client for setting up model database

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8112742B2 (en) * 2008-05-12 2012-02-07 Expressor Software Method and system for debugging data integration applications with reusable synthetic data values
US8819488B1 (en) * 2011-06-15 2014-08-26 Amazon Technologies, Inc. Architecture for end-to-end testing of long-running, multi-stage asynchronous data processing services
US9298596B2 (en) * 2013-07-09 2016-03-29 International Business Machines Corporation Test framework for computing jobs
CN104765745B (en) * 2014-01-07 2018-03-27 国际商业机器公司 Loading data in database are carried out with the method and system of logic checking
US10140206B2 (en) * 2015-11-17 2018-11-27 Proov Systems Ltd. Computerized method and end-to-end “pilot as a service” system for controlling start-up/enterprise interactions
CN105787089B (en) * 2016-03-15 2019-02-26 国家电网公司 A kind of distribution network planning basic data integrated approach
US10268527B2 (en) * 2016-03-22 2019-04-23 Tata Consultancy Services Limited Systems and methods for generating real time events
CN106776280B (en) * 2016-11-24 2020-10-16 上海携程商务有限公司 Configurable performance testing device
CN107133342A (en) * 2017-05-16 2017-09-05 广州舜飞信息科技有限公司 A kind of IndexR real-time data analysis storehouse

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145432A (en) * 2017-03-30 2017-09-08 华为技术有限公司 A kind of method and client for setting up model database

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
YuriDemchenko等."Chapter 2 - Cloud Computing Infrastructure for Data Intensive Applications".《Big Data Analytics for Sensor-Network Collected Intelligence》.2017, *
汪璐."面向海量数据的实时计算一致性研究".《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》.2016,(第04期),I137-16. *

Also Published As

Publication number Publication date
CN109840196A (en) 2019-06-04

Similar Documents

Publication Publication Date Title
CN107423085B (en) Method and apparatus for deploying applications
CN109582873B (en) Method and device for pushing information
CN108011949B (en) Method and apparatus for acquiring data
CN110019263B (en) Information storage method and device
CN111800513B (en) Method and device for pushing information and computer readable medium of electronic equipment
CN109829164B (en) Method and device for generating text
CN109862100B (en) Method and device for pushing information
CN111209347A (en) Method and device for clustering mixed attribute data
WO2020119173A1 (en) Information pushing method and apparatus
CN108512674B (en) Method, device and equipment for outputting information
CN109840196B (en) Method and device for testing business logic
CN115563942A (en) Contract generation method and device, electronic equipment and computer readable medium
CN113094415B (en) Data extraction method, data extraction device, computer readable medium and electronic equipment
CN111259194B (en) Method and apparatus for determining duplicate video
CN111125501B (en) Method and device for processing information
CN109308299B (en) Method and apparatus for searching information
CN107368597B (en) Information output method and device
CN111723274A (en) Method and apparatus for processing information
CN111460269B (en) Information pushing method and device
CN113362097B (en) User determination method and device
CN111857879B (en) Data processing method, device, electronic equipment and computer readable medium
CN113157828B (en) Method and device for pushing data
CN112200643B (en) Article information pushing method and device, electronic equipment and computer readable medium
CN111460274B (en) Information processing method and device
CN111782801B (en) Method and device for grouping keywords

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant