CN109558313B - Method and device for constructing abnormal test scene - Google Patents

Method and device for constructing abnormal test scene Download PDF

Info

Publication number
CN109558313B
CN109558313B CN201811329188.9A CN201811329188A CN109558313B CN 109558313 B CN109558313 B CN 109558313B CN 201811329188 A CN201811329188 A CN 201811329188A CN 109558313 B CN109558313 B CN 109558313B
Authority
CN
China
Prior art keywords
scene
exception
called object
called
calling
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
CN201811329188.9A
Other languages
Chinese (zh)
Other versions
CN109558313A (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.)
Koubei Shanghai Information Technology Co Ltd
Original Assignee
Koubei Shanghai 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 Koubei Shanghai Information Technology Co Ltd filed Critical Koubei Shanghai Information Technology Co Ltd
Priority to CN201811329188.9A priority Critical patent/CN109558313B/en
Publication of CN109558313A publication Critical patent/CN109558313A/en
Application granted granted Critical
Publication of CN109558313B publication Critical patent/CN109558313B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program

Abstract

The invention discloses a method and a device for constructing an abnormal test scene, wherein the method comprises the following steps: receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object; monitoring the current test process, when the called object is monitored to be called, carrying out corresponding interception processing according to the scene construction command, constructing an abnormal scene based on the called object, and returning the abnormal scene to the calling object. The method and the device realize that the called object can be intercepted through the scene construction command on the premise of not needing to restart the project on the basis of not changing the existing codes, and effectively avoid the problems of frequent test environment deployment, blockage of integral joint debugging test and the like caused by debugging the break point or directly modifying the project codes and redeploying in the prior art. The method and the device realize accurate interception by specifying the intercepted called object through the scene construction command.

Description

Method and device for constructing abnormal test scene
Technical Field
The invention relates to the field of software, in particular to a method and a device for constructing an abnormal test scene.
Background
Due to the complex logic inside the large software system, in the actual implementation and development process, a large software system is often divided into a plurality of systems according to the principle of high aggregation and low coupling. Wherein each system implements a specific function. The systems realize the mutual service provision between the systems by providing interfaces, monitoring messages and other modes. For a complete software system, it is often composed of several systems or even hundreds of systems, depending on the diversity and complexity of the service. These systems may be developed simultaneously by different teams after the definition of their respective business boundaries. Before release, strict inter-system joint debugging tests are required to ensure that the overall functions of the software application system are consistent with the expected implementation.
When the systems are jointly adjusted, a whole set of test environment needs to be built, and each system needs to be tested through real service call. Only through testing of all scenarios can it be ensured that the software system can provide the intended service after release. In the whole joint debugging process, the abnormal scenario test is a very important ring, and the timeout and no response of the intersystem call are important to be considered in the abnormal scenario test. The payment by using the payment code in the mobile payment is taken as an example for explanation, the user presents the payment code, after the merchant scans the payment code, the server needs to analyze the payment code, check the qualification of the merchant and the user, and finally carry out fund transfer, namely, transfer money from the account of the user to the account of the merchant. If the last fund transfer system is overtime, the upstream system calling the fund transfer system cannot know whether the user account deducts money or not and whether the merchant account receives the fund or not, and at the moment, the upstream system calling the fund transfer system needs to be executed according to a system design scheme, performs corresponding data processing and returns an abnormal code. Aiming at the scenes, very rigorous system design and development are needed, and the fund security of the user and the merchant can be ensured through sufficient tests. In a real software system, the above scenario may also involve multiple systems, making joint testing very time consuming.
In the prior art, a very simple and effective method for testing an abnormal scene with overtime calling between systems does not exist. There are two main types of methods often employed by testers:
1) and performing breakpoint debugging on the tested system in a remote debugging mode. And setting a breakpoint to block the system flow after the A system calls the action of the B system until the call of the A system to the B system is overtime. Firstly, the method can only simulate the scene which succeeds in overtime, but cannot effectively simulate the scene which fails in overtime. The scene that the system A successfully calls the system B and the result can be successfully returned after the system B is overtime can be simulated, but the scene that the system A calls the system B and the result is not returned because the system B does not receive the request can not be simulated; secondly, the method is very troublesome to implement and is not feasible in most scenes, a plurality of systems are often tested in the whole joint debugging environment at the same time, and the breakpoint setting is carried out on a certain system, so that the joint debugging tests of all other systems can be blocked.
2) And embedding test codes of artificial abnormal scenes in the codes. The method tampers the code of the tested system, so that the test result is inaccurate; and the code needs to be modified again each time different exceptions are tested, and the test environment is very time-consuming to deploy.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a method and apparatus for constructing an exception test scenario that overcomes or at least partially solves the above mentioned problems.
According to an aspect of the present invention, there is provided a method for constructing an exception test scenario, including:
receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object;
monitoring the current test process, when the called object is monitored to be called, carrying out corresponding interception processing according to the scene construction command, constructing an abnormal scene based on the called object, and returning the abnormal scene to the calling object.
Optionally, the called object related information includes an object name and a method name of the called object; the scene construction command also comprises a specified constructed abnormal scene and/or a specified abnormal type; the abnormal scene comprises a timeout success scene and/or a timeout failure scene.
Optionally, monitoring a current test process, performing corresponding interception processing according to the scene construction command when it is monitored that the called object is called, constructing an abnormal scene based on the called object, and returning to the calling object further includes:
constructing an event monitor containing the object name and the method name of the called object to monitor the current test process;
judging whether the current test process calls the object name and the method name of the called object or not;
if yes, corresponding interception processing is carried out according to the scene construction command, an abnormal scene is constructed based on the called object, and the abnormal scene is returned to the calling object.
Optionally, performing corresponding interception processing according to the scene construction command, constructing an abnormal scene based on the called object, and returning to the calling object further includes:
intercepting a calling request of a called object or intercepting a return response of a processing result of the called object according to an appointed constructed abnormal scene contained in the scene construction command, and assembling to obtain a corresponding calling exception according to an appointed abnormal type contained in the scene construction command;
and returning the calling exception to the calling object.
Optionally, intercepting a call request to the called object or intercepting a return response of a processing result of the called object according to the specified constructed exception scenario included in the scenario construction command further includes:
judging whether the specified constructed abnormal scene is an overtime successful scene or not;
if yes, intercepting a return response of a processing result of the called object;
judging whether the specified constructed abnormal scene is an overtime failure scene or not;
if yes, intercepting a calling request of the called object.
Optionally, the call exceptions include null pointer exceptions, run exceptions, input output exceptions, and/or timeout exceptions.
Optionally, the method further comprises:
and setting a construction switch, and correspondingly constructing or closing the construction abnormal test scene according to the set construction switch.
According to another aspect of the present invention, there is provided an apparatus for constructing an exception test scenario, including:
the receiving module is suitable for receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object;
and the construction module is suitable for monitoring the current test process, carrying out corresponding interception processing according to the scene construction command when the called object is monitored to be called, constructing an abnormal scene based on the called object, and returning the abnormal scene to the calling object.
Optionally, the called object related information includes an object name and a method name of the called object; the scene construction command also comprises a specified constructed abnormal scene and/or a specified abnormal type; the abnormal scene comprises a timeout success scene and/or a timeout failure scene.
Optionally, the building module is further adapted to:
constructing an event monitor containing the object name and the method name of the called object to monitor the current test process;
judging whether the current test process calls the object name and the method name of the called object or not; if yes, corresponding interception processing is carried out according to the scene construction command, an abnormal scene is constructed based on the called object, and the abnormal scene is returned to the calling object.
Optionally, the building module is further adapted to:
intercepting a calling request of a called object or intercepting a return response of a processing result of the called object according to an appointed constructed abnormal scene contained in the scene construction command, and assembling to obtain a corresponding calling exception according to an appointed abnormal type contained in the scene construction command;
and returning the calling exception to the calling object.
Optionally, the building module is further adapted to:
judging whether the specified constructed abnormal scene is an overtime successful scene or not;
if yes, intercepting a return response of a processing result of the called object;
judging whether the specified constructed abnormal scene is an overtime failure scene or not;
if yes, intercepting a calling request of the called object.
Optionally, the call exceptions include null pointer exceptions, run exceptions, input output exceptions, and/or timeout exceptions.
Optionally, the apparatus further comprises:
and the switch module is suitable for setting a construction switch, and correspondingly constructing or closing the construction abnormal test scene according to the set construction switch.
According to still another aspect of the present invention, there is provided an electronic apparatus including: the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the method for constructing the abnormal test scenario.
According to still another aspect of the present invention, a computer storage medium is provided, where at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to perform an operation corresponding to the method for constructing an exception test scenario as described above.
According to the method and the device for constructing the abnormal test scene, a scene construction command which is input by a user and contains the related information of the called object is received, and the scene construction command is analyzed to obtain the related information of the called object; monitoring the current test process, when the called object is monitored to be called, carrying out corresponding interception processing according to the scene construction command, constructing an abnormal scene based on the called object, and returning the abnormal scene to the calling object. The method and the device realize that the called object can be intercepted through the scene construction command on the premise of not needing to restart the project on the basis of not changing the existing codes, and effectively avoid the problems of frequent test environment deployment, blockage of integral joint debugging test and the like caused by debugging the break point or directly modifying the project codes and redeploying in the prior art. The method and the device realize accurate interception by specifying the intercepted called object through the scene construction command. Furthermore, the test process of simulating the abnormal scene has no influence on other objects, and the problems of blocking and the like cannot be caused to the joint debugging test.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 illustrates a flow diagram of a method of constructing an exception test scenario, according to one embodiment of the invention;
FIG. 2 illustrates a flow diagram of a method of constructing an exception test scenario, according to another embodiment of the present invention;
FIG. 3a shows a flow diagram where a calling object normally calls a called object;
FIG. 3b shows a flowchart for a calling object to normally call a called object over time;
FIG. 3c shows a flow diagram of a calling object failing to invoke a called object overtime;
FIG. 4 shows a functional block diagram of an apparatus for constructing an exception test scenario, according to one embodiment of the present invention;
fig. 5 shows a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 shows a flow diagram of a method of constructing an exception test scenario, according to one embodiment of the invention. As shown in fig. 1, the method for constructing an abnormal test scenario specifically includes the following steps:
step S101, receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object.
The user can pre-imagine the abnormal scene to be tested according to the requirement of the current test. In this embodiment, an abnormal scene is described by taking a scene caused by timeout as an example. When the called object is called by the calling object, the called object returns a processing result after time out, and various time out scenes are caused.
If the scenario to be tested is currently assumed to be a test scenario in which the account verification is in a timeout condition. The called object is account number verification of the account system, and the calling object may be a system for calling an account verification function, such as a fund handling system, which needs to perform corresponding fund handling when the account verification is correct. Before the account number verification of the account system does not return a clear processing result, the fund handling system also needs to return information to an upstream system calling the fund handling system on the premise that the fund handling system cannot perform any fund operation, the upstream system determines that the next operation is to directly prompt the user that the payment fails or initiate retry under the condition that the user does not sense, and therefore the test of account number verification timeout of the account system is completed. The abnormal test scenario can be constructed by using the embodiment for the test scenario. When the abnormal test scene constructed by the embodiment is used for testing, normal mutual calling among other systems is not influenced, and the redeployment of the deployed systems is not needed.
Specifically, the user may select the called object first, and receive a scene building command including information related to the called object, which is input by the user. The called object related information comprises the object name and the method name of the called object, and the called object is convenient to locate. The related information of the called object can be obtained by analyzing the scene construction command. In order to facilitate the analysis of the scene construction command, the format of the scene construction command can be preset, and the related information of the called object is obtained according to the format analysis, so that corresponding interception processing can be adopted according to the related information of the called object subsequently. The interception processing is realized based on the related information of the called object, so that the calling object is not limited in the embodiment, and the calling test of the called object by the built abnormal test scene corresponding to different calling objects can be realized.
Step S102, monitoring the current test process and judging whether the called object is called.
Monitoring a currently executed test process, specifically, monitoring whether a called object is called or not, and executing the step S103 when the called object is called; otherwise, no processing is carried out, and the currently executed test process is continuously executed.
Monitoring is completed by adopting a newly-built independent event monitor without adding any modification to the existing code, the event monitor can accurately establish the event monitor aiming at the called object based on the called object and according to the related information of the called object, can accurately monitor the calling of the called object, and does not influence the execution of service, the service flow, the normal test and the like in the existing code.
And step S103, carrying out corresponding interception processing according to the scene construction command, constructing an abnormal scene for the called object, and returning the abnormal scene to the called object.
When the called object is monitored to be called, intercepting processing is carried out aiming at the calling requirement, the calling process of the called object is overtime, and correspondingly constructed exception is returned to the calling object, the calling object obtains a processing result of overtime, and the calling object can be continuously executed based on the processing result of overtime, so that whether the calling object can be continuously and normally executed when the processing result of overtime is obtained can be tested. The interception processing, overtime return, exception return and other processing are used for completing the construction of an exception test scene.
After the called object is monitored to be called, interception processing can be executed, corresponding assembly exception is returned, and the processing can be completely stripped from the existing code without changing in the existing code.
According to the method for constructing the abnormal test scene, the scene construction command which is input by a user and contains the related information of the called object is received, and the scene construction command is analyzed to obtain the related information of the called object; monitoring the current test process, when the called object is monitored to be called, carrying out corresponding interception processing according to the scene construction command, constructing an abnormal scene for the called object, and returning the abnormal scene to the calling object. The method and the device realize that the called object can be intercepted through the scene construction command on the premise of not needing to restart the project on the basis of not changing the existing codes, and effectively avoid the problems of frequent test environment deployment, blockage of integral joint debugging test and the like caused by debugging the break point or directly modifying the project codes and redeploying in the prior art. The method and the device realize accurate interception by specifying the intercepted called object through the scene construction command. Furthermore, the test process of simulating the abnormal scene has no influence on other objects, and the problems of blocking and the like cannot be caused to the joint debugging test.
FIG. 2 shows a flow diagram of a method of constructing an exception test scenario, according to another embodiment of the invention. As shown in fig. 2, the method for constructing an abnormal test scenario specifically includes the following steps:
step S201, a construction switch is set, and a construction abnormal test scene is constructed or closed correspondingly according to the set construction switch.
In order to conveniently control the construction of an abnormal test scene, a construction switch is arranged. When the construction switch is turned on, the calling of the called object can be monitored subsequently, and the construction of the abnormal scene is completed according to the scene construction command. When the construction switch is closed, the called object is not monitored and intercepted, so that the called object can be normally called and executed, and the execution logic of the called object is completed. The build switch may be turned on or off on command.
The step is an optional step, so that the construction switch can be turned on or off according to the test requirement during the test, and the abnormal test scene can be constructed or turned off correspondingly according to the set construction switch during the test.
Step S202, receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object.
The scene construction command comprises the related information of the called object and also comprises an abnormal scene which is specified to be constructed. The abnormal scenario in this embodiment includes a timeout success scenario and a timeout failure scenario. The timeout success scene shows that the called object successfully executes in the actual test process, but the timeout is returned due to the overlong execution time, so that the calling object considers that the called object does not successfully execute. The overtime failure scene shows that the called object fails to execute in the actual test process, and the call cannot return normally. Since the above abnormal situations do not occur frequently in practice, the test cannot be performed as required. Therefore, constructing an exception test scenario is particularly important for testing. According to the embodiment, a corresponding abnormal test scenario can be constructed according to the characteristics of the overtime success scenario and the overtime failure scenario shown in the actual test process. Further, the scene building command may also contain a specified exception type. The specified exception type is set according to exceptions that may occur in the actual test process, such as null pointer exception, operation exception, input/output exception, timeout exception, and the like, and is not specifically limited herein.
After receiving a scene construction command which is input by a user and contains related information of a called object, analyzing the scene construction command to obtain related information of the called object, a specified constructed abnormal scene, a specified abnormal type and other information. Alternatively, the build switch may be turned on or off by a scene build command. Such as a scene build instruction that includes an on build switch instruction entered at the user. The close build switch may input a close build switch command or close the build switch with a shortcut key, etc.
Step S203, an event monitor containing the object name and the method name of the called object is constructed to monitor the current test process, and whether the current test process calls the object name and the method name of the called object is judged.
According to the object name and the method name of the called object, a corresponding event listener can be constructed to monitor the current test process. An event listener for the object name and method name of the called object is constructed, such as with the EventWatchBuilder function. When a called object is called by a calling object, the method can accurately know that the current test process calls the object name and the method name of the called object, and execute step S204; otherwise, continuing the current testing process.
Further, constructing an event listener containing the object name and method name of the called object may avoid modifications to existing code based on a real-time non-intrusive AOP framework, such as Sandbox. The scene building command can contain different related information of the called object each time according to different testing requirements of the user. After a scene construction command is received, the related information of the called object obtained through analysis is transmitted to the EventWatchBuilder function as a parameter, an event monitor of different called objects can be constructed by using the EventWatchBuilder function, the called object is accurately determined, and therefore different testing requirements of users are met.
And step S204, carrying out corresponding interception processing according to the scene construction command, constructing an abnormal scene for the called object, and returning the abnormal scene to the called object.
According to the abnormal scene specified to be constructed included in the scene construction command, specific interception processing needs to be further determined. Taking the normal flow of the called object called by the calling object as an example, referring to fig. 3a, the calling object includes, for example, data calculation and conversion processing, calling the called object, analyzing the processing result returned by the called object, processing the call exception, outputting the assembly result, and the like. When an abnormal scene needs to be constructed in a normal flow, it needs to first determine what kind of scene the constructed abnormal scene is specified to be. When the specified constructed abnormal scene is judged to be a timeout successful scene, namely a scene which is required to be constructed and successfully executed by the called object but returns to timeout due to overlong execution time is required to be constructed, so that the calling object considers that the called object does not successfully execute. At this time, the interception process should be a return response of the processing result of the intercepted called object. As shown in fig. 3b, after the called object is called by the calling object, a response returned from the processing result of the called object is intercepted, a corresponding calling exception is assembled according to the specified exception type included in the scene construction command, and the calling exception is returned to the calling object, so that a scene which is overtime due to overlong execution time of the called object is caused to be returned, but the calling object can finally obtain a normal result returned by the called object, thereby constructing a scene which is successful in overtime. When the abnormal scene which is specified to be constructed is judged to be the overtime failure scene, namely, a scene which is not normally returned due to the execution failure of the called object needs to be constructed. At this time, the interception process should intercept a call request for the called object. As shown in fig. 3c, before the called object is called by the calling object, the calling request of the called object is intercepted, the calling request of the called object is not executed, the corresponding calling exception is directly assembled according to the specified exception type contained in the scene construction command, the calling exception is returned to the calling object, the execution of the called object fails, the scene which cannot be normally returned is caused, and the calling object cannot obtain the normal result returned by the called object, so that the overtime failure scene is constructed.
Further, the assembled call exception may include multiple exceptions such as null pointer exception, operation exception, input/output exception, timeout exception, and the like according to the specified exception type, which is not specifically limited herein.
According to the method for constructing the abnormal test scene, the construction switch is arranged, the abnormal test scene is constructed or closed correspondingly according to the construction switch, the use is convenient and quick, and the normal test flow of the existing code is not influenced. Furthermore, the construction of the abnormal test scene breaks through the test means which can be realized only by breaking points or directly modifying codes in the prior art, and avoids the modification of the codes and the influence on the whole joint debugging, so that the test can be accurately carried out. The abnormal test scene is constructed based on the called objects, so that the abnormal test scene can be suitable for a plurality of different called objects, and the abnormal test scene is not influenced with each other, and the joint debugging test is more convenient.
FIG. 4 shows a functional block diagram of an apparatus for constructing an exception test scenario, according to one embodiment of the present invention. As shown in fig. 4, the apparatus for constructing an abnormal test scenario includes the following modules:
the receiving module 410 is adapted to: and receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object.
The building module 420 is adapted to: monitoring the current test process, when the called object is monitored to be called, carrying out corresponding interception processing according to the scene construction command, constructing an abnormal scene based on the called object, and returning the abnormal scene to the calling object.
Optionally, the building module 420 is further adapted to: constructing an event monitor containing the object name and the method name of the called object to monitor the current test process; judging whether the current test process calls the object name and the method name of the called object or not; if yes, corresponding interception processing is carried out according to the scene construction command, an abnormal scene is constructed based on the called object, and the abnormal scene is returned to the calling object.
Optionally, the building module 420 is further adapted to: intercepting a calling request of a called object or intercepting a return response of a processing result of the called object according to an appointed constructed abnormal scene contained in the scene construction command, and assembling to obtain a corresponding calling exception according to an appointed abnormal type contained in the scene construction command; and returning the calling exception to the calling object.
Optionally, the building module 420 is further adapted to: judging whether the specified constructed abnormal scene is an overtime successful scene or not; if yes, intercepting a return response of a processing result of the called object; judging whether the specified constructed abnormal scene is an overtime failure scene or not; if yes, intercepting a calling request of the called object.
Optionally, the apparatus further comprises: a switch module 430.
The switch module 430 is adapted to: and setting a construction switch, and correspondingly constructing or closing the construction abnormal test scene according to the set construction switch.
The descriptions of the modules refer to the corresponding descriptions in the method embodiments, and are not repeated herein.
The application also provides a nonvolatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the method for constructing the abnormal test scenario in any method embodiment.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the electronic device.
As shown in fig. 5, the electronic device may include: a processor (processor)502, a Communications Interface 504, a memory 506, and a communication bus 508.
Wherein:
the processor 502, communication interface 504, and memory 506 communicate with one another via a communication bus 508.
A communication interface 504 for communicating with network elements of other devices, such as clients or other servers.
The processor 502 is configured to execute the program 510, and may specifically execute relevant steps in the above method embodiment for constructing an exception test scenario.
In particular, program 510 may include program code that includes computer operating instructions.
The processor 502 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention. The electronic device comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 506 for storing a program 510. The memory 506 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 510 may be specifically configured to enable the processor 502 to execute the method for constructing the exception test scenario in any of the method embodiments described above. For specific implementation of each step in the program 510, reference may be made to corresponding steps and corresponding descriptions in units in the above embodiment for constructing the exception test scenario, which are not described herein again. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described devices and modules may refer to the corresponding process descriptions in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the apparatus for constructing exception test scenarios according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (16)

1. A method of constructing an exception test scenario, comprising:
receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object;
monitoring the current test process, when the called object is monitored to be called, according to the scene construction command, intercepting the calling request of the called object or the return response of the processing result of the called object, assembling to obtain the corresponding calling exception, and returning the calling exception to the calling object.
2. The method of claim 1, wherein the called object related information includes an object name and a method name of a called object; the scene construction command also comprises a specified constructed abnormal scene and/or a specified abnormal type; wherein the exception scenario comprises a timeout success scenario and/or a timeout failure scenario.
3. The method according to claim 2, wherein the monitoring a current test process, performing corresponding interception processing according to the scene construction command when it is monitored that the called object is called, constructing an abnormal scene based on the called object, and returning to the calling object further comprises:
constructing an event monitor containing the object name and the method name of the called object to monitor the current test process;
judging whether the current test process calls the object name and the method name of the called object or not;
if so, intercepting a calling request of the called object or a return response of a processing result of the called object according to the scene construction command, assembling to obtain a corresponding calling exception, and returning the calling exception to the calling object.
4. The method according to claim 2 or 3, wherein the intercepting a call request of the called object or a return response of a processing result of the called object according to the scene construction command, and assembling to obtain a corresponding call exception, and returning the call exception to the calling object further comprises:
intercepting a calling request of the called object or intercepting a return response of a processing result of the called object according to an appointed constructed abnormal scene contained in the scene construction command, and assembling to obtain a corresponding calling exception according to an appointed exception type contained in the scene construction command;
and returning the calling exception to a calling object.
5. The method of claim 4, wherein intercepting a call request to the called object or intercepting a return response of a processing result of the called object according to the specified built exception scenario contained in the scenario building command further comprises:
judging whether the specified constructed abnormal scene is an overtime successful scene or not;
if yes, intercepting a return response of the processing result of the called object;
judging whether the specified constructed abnormal scene is an overtime failure scene or not;
if yes, intercepting a calling request of the called object.
6. The method of claim 4, wherein the call exception comprises a null pointer exception, a run exception, an input output exception, and/or a timeout exception.
7. The method according to any one of claims 1-3, wherein the method further comprises:
and setting a construction switch, and correspondingly constructing or closing the construction abnormal test scene according to the set construction switch.
8. A device to construct an exception test scenario, comprising:
the receiving module is suitable for receiving a scene construction command which is input by a user and contains the related information of the called object, and analyzing the scene construction command to obtain the related information of the called object;
and the construction module is suitable for monitoring the current test process, intercepting a calling request of the called object or a return response of a processing result of the called object according to the scene construction command when the called object is monitored to be called, assembling to obtain a corresponding calling exception, and returning the calling exception to the calling object.
9. The apparatus of claim 8, wherein the called object related information includes an object name and a method name of a called object; the scene construction command also comprises a specified constructed abnormal scene and/or a specified abnormal type; wherein the exception scenario comprises a timeout success scenario and/or a timeout failure scenario.
10. The apparatus of claim 9, wherein the build module is further adapted to:
constructing an event monitor containing the object name and the method name of the called object to monitor the current test process;
judging whether the current test process calls the object name and the method name of the called object or not; and if so, executing the construction module.
11. The apparatus of claim 9 or 10, wherein the building module is further adapted to:
intercepting a calling request of the called object or intercepting a return response of a processing result of the called object according to an appointed constructed abnormal scene contained in the scene construction command, and assembling to obtain a corresponding calling exception according to an appointed exception type contained in the scene construction command;
and returning the calling exception to a calling object.
12. The apparatus of claim 11, wherein the build module is further adapted to:
judging whether the specified constructed abnormal scene is an overtime successful scene or not;
if yes, intercepting a return response of the processing result of the called object;
judging whether the specified constructed abnormal scene is an overtime failure scene or not;
if yes, intercepting a calling request of the called object.
13. The apparatus of claim 11, wherein the call exception comprises a null pointer exception, a run exception, an input output exception, and/or a timeout exception.
14. The apparatus of any one of claims 8-10, wherein the apparatus further comprises:
and the switch module is suitable for setting a construction switch, and correspondingly constructing or closing the construction abnormal test scene according to the set construction switch.
15. An electronic device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the method for constructing the abnormal test scenario in any one of claims 1-7.
16. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the method of constructing an exception test scenario of any one of claims 1-7.
CN201811329188.9A 2018-11-09 2018-11-09 Method and device for constructing abnormal test scene Active CN109558313B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811329188.9A CN109558313B (en) 2018-11-09 2018-11-09 Method and device for constructing abnormal test scene

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811329188.9A CN109558313B (en) 2018-11-09 2018-11-09 Method and device for constructing abnormal test scene

Publications (2)

Publication Number Publication Date
CN109558313A CN109558313A (en) 2019-04-02
CN109558313B true CN109558313B (en) 2021-08-17

Family

ID=65865861

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811329188.9A Active CN109558313B (en) 2018-11-09 2018-11-09 Method and device for constructing abnormal test scene

Country Status (1)

Country Link
CN (1) CN109558313B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162455A (en) * 2019-04-09 2019-08-23 口碑(上海)信息技术有限公司 Joint debugging method and device, storage medium, the electronic device of software
CN112860502A (en) * 2019-11-26 2021-05-28 上海哔哩哔哩科技有限公司 Fault simulation method, equipment, server and storage medium
CN112506773A (en) * 2020-12-03 2021-03-16 安徽听见科技有限公司 Abnormal scene testing method, device, equipment and storage medium
CN113157593A (en) * 2021-05-24 2021-07-23 网易(杭州)网络有限公司 Performance data acquisition method, device, system, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104220993A (en) * 2012-04-20 2014-12-17 惠普发展公司,有限责任合伙企业 Testing system for an integrated software system
CN105786707A (en) * 2016-02-29 2016-07-20 腾讯科技(深圳)有限公司 Method and device for testing program
CN106875184A (en) * 2016-08-10 2017-06-20 阿里巴巴集团控股有限公司 Abnormal scene analogy method, device and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104767716B (en) * 2014-01-03 2018-05-25 腾讯科技(深圳)有限公司 Service request processing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104220993A (en) * 2012-04-20 2014-12-17 惠普发展公司,有限责任合伙企业 Testing system for an integrated software system
CN105786707A (en) * 2016-02-29 2016-07-20 腾讯科技(深圳)有限公司 Method and device for testing program
CN106875184A (en) * 2016-08-10 2017-06-20 阿里巴巴集团控股有限公司 Abnormal scene analogy method, device and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"GSM网络基站控制器故障管理分析系统的设计与实现";雷阳;《中国优秀硕士学位论文全文数据库电子期刊 信息科技辑》;20131215(第S2期);全文 *

Also Published As

Publication number Publication date
CN109558313A (en) 2019-04-02

Similar Documents

Publication Publication Date Title
CN109558313B (en) Method and device for constructing abnormal test scene
CN107562635B (en) Embedded software test auxiliary system
CN109302522B (en) Test method, test device, computer system, and computer medium
US20080209405A1 (en) Distributed debugging for a visual programming language
CN104765678A (en) Method and device for testing applications on mobile terminal
CN111414172A (en) Automatic deployment and release system and method for application software
CN109669873B (en) User interface automatic test method and device, electronic equipment and storage medium
CN111045756A (en) Method, apparatus, computing device, and medium for generating interface service
CN107045475B (en) Test method and device
US20160275000A1 (en) System and method of automated application screen flow generation for detecting aberration in mobile application
CN111858296A (en) Interface test method, device, equipment and storage medium
CN104346279A (en) Method and device for software testing
KR20190113050A (en) Method and system for automatic configuration test case generation of mobile application
CN111831542A (en) API application debugging method and device and storage medium
CN107220169B (en) Method and equipment for simulating server to return customized data
CN111538659A (en) Interface testing method and system for service scene, electronic device and storage medium
CN111159023A (en) Test method, test device, electronic equipment and computer readable storage medium
CN105354075B (en) A kind of synchronous method of software and hardware cooperating simulation
CN110971478B (en) Pressure measurement method and device for cloud platform service performance and computing equipment
CN105339974B (en) Analog sensor
CN113535580B (en) CTS test method, CTS test device and test equipment
CN116166525A (en) Method and device for generating test script
CN109656804A (en) Automated testing method, equipment, storage medium and device
CN110597736B (en) Test data generation method and device
CN111381836A (en) Switching method and device of application program deployment environment

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