CN109992515A - Test method and device, electronic equipment - Google Patents

Test method and device, electronic equipment Download PDF

Info

Publication number
CN109992515A
CN109992515A CN201910262073.0A CN201910262073A CN109992515A CN 109992515 A CN109992515 A CN 109992515A CN 201910262073 A CN201910262073 A CN 201910262073A CN 109992515 A CN109992515 A CN 109992515A
Authority
CN
China
Prior art keywords
time
time point
interface
point
test
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.)
Granted
Application number
CN201910262073.0A
Other languages
Chinese (zh)
Other versions
CN109992515B (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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201910262073.0A priority Critical patent/CN109992515B/en
Publication of CN109992515A publication Critical patent/CN109992515A/en
Application granted granted Critical
Publication of CN109992515B publication Critical patent/CN109992515B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software

Abstract

The invention discloses a kind of test method and devices, electronic equipment.Wherein, this method comprises: determining object time point, wherein object time point is for starting application test;According to object time point, the time for modifying system judges the time point of interface;After the modification of deadline point, invocation target logic execute interface, with simulation application test in target logic, obtain analog result, wherein analog result be used to indicate using test in target logic processing mode it is whether correct.The present invention solves in the related technology when carrying out target logic test, needs frequently to restart server, leads to the technical problem that testing efficiency is lower.

Description

Test method and device, electronic equipment
Technical field
The present invention relates to system testing technical fields, in particular to a kind of test method and device, electronic equipment.
Background technique
In the related technology, for development of games, it is important that a part be exactly using test, by application test can To find the BUG of game newly developed, defect, to be adjusted, currently, in application test more troublesome test content it One, be exactly across day test, if desired in gaming increase newly adding system, activity, version updating etc., often have at night 0 point or The statistics such as consumption number, weight are supplemented in across the day process flow of 6:00 AM equi-time point, such as resetting number of activities, resetting with money daily Set some activity data states of server, various system ranking list clearing, the logics such as various activities reward clearing granting.
Across day test content in need of consideration, including server data resetting and player's reset data, wherein player's data Resetting across day test, it is also necessary to consider in the online situation of player across under day and the not online situation of player across day.Test When need to guarantee that data normally trigger across day processing logic at correct time point, related data is reset etc..
In the related art, test game in target logic normally whether when, common test method is as follows:
Method 1:, can be by restarting clothes after the modification window time if game has the server of window version Device be engaged in test.
But this test mode, the self-contained version for having window of game is needed, there is certain limitation, even if having, It is also required to before testing every time, after having modified the time, requires to restart server and client side, take a long time, to test institute There is across day situation, it may be necessary to restart five or six servers back and forth, cause testing efficiency low.
Method 2: if without the server of window version, it can be by restarting server after the modification linux time.
But this kind of test mode, it needs user to have the modification authority of Linux system lower time, just can be carried out using survey Examination, there is certain limitation, even if there is the permission of linux modification time, influence is also bigger, because on linux server also Many other systems, the server time that may cause other people disorderly fall, and after being completed, also it is easy to forget that changeing back Carry out the time.Meanwhile this method similarly there is a problem of frequently restarting and cause testing efficiency lower.
Method 3: not modification time is ready to after needing state to be tested, waits all night or second day referring again to after across day State it is whether correct.
But this kind of test mode, it needs all night or spends 2 day time, and may be because the incorrect of data preparation Or comprehensively do not need to wait one day again when needing to retest, it also results in low using testing efficiency.
For above-mentioned problem, currently no effective solution has been proposed.
Summary of the invention
The embodiment of the invention provides a kind of test method and devices, electronic equipment, at least to solve to exist in the related technology When carrying out target logic test, needs frequently to restart server, lead to the technical problem that testing efficiency is lower.
According to an aspect of an embodiment of the present invention, a kind of test method is provided, comprising: determine object time point, In, the object time point is for starting application test;According to the object time point, the time for modifying system judges interface Time point;After the modification for completing the time point, invocation target logic executes interface, to simulate the mesh in the application test Logic is marked, analog result is obtained, wherein the analog result is used to indicate the target logic processing mode in the application test It is whether correct.
Optionally, according to the object time point, the step of modifying time of system and judge the time point of interface, comprising: According to the current point in time of the object time point and the system, time difference is calculated;According to the time difference and time Coefficient is modified, determines duration to be modified;After the current point in time is increased the duration to be modified, replace in the system Multiple times judge the time pending in interface function, complete the modification for judging the time time point of interface.
Optionally, after the modification for completing time point, the step of invocation target logic executes interface, comprising: pass through Call instruction calls the entrance function of the target logic, executes interface with invocation target logic;Alternatively, described regenerating After the timer of system, the timer is initialized, and calls the entrance function of the target logic, is held with invocation target logic Line interface.
Optionally, after the modification for completing time point, the step of invocation target logic executes interface, further includes: obtain Take data mark, wherein the data mark is used for time point when log history performance objective logic;Complete the time After the modification of point, whether the time point for determining that the time judges that the time point of interface and the data mark record is consistent;? When the time point for determining that the time judges that the time point of interface and the data mark record is inconsistent, the target is called to patrol It collects and executes interface.
Optionally, before determining object time point, the method also includes: back up the current point in time of the system; After obtaining analog result, the method also includes: according to the current point in time of backup, restores the time judgement and connect The time point of mouth.
Optionally, the target logic includes: across day execution logic, wherein across the day execution logic is used to indicate In the first preset time period to the second preset time period after the object time point before the object time point Test logic.
According to another aspect of an embodiment of the present invention, a kind of test device is additionally provided, comprising: determination unit, for true It sets the goal time point, wherein the object time point is for starting application test;Unit is modified, when for according to the target Between point, the time for modifying system judges the time point of interface;Call unit, for adjusting after the modification for completing the time point Interface is executed with target logic, to simulate the target logic in the application test, obtains analog result, wherein the simulation Whether the target logic processing mode being as a result used to indicate in the application test is correct.
Optionally, the modification unit includes: computing module, for working as according to the object time point and the system Preceding time point calculates time difference;Determining module, for determining to be modified according to the time difference and time modification coefficient Duration;Replacement module, after the current point in time is increased the duration to be modified, when replacing multiple in the system Between judge the time pending in interface function, complete the modification for judging the time time point of interface.
Optionally, the call unit includes: the first calling module, for calling the target logic by call instruction Entrance function, with invocation target logic execute interface;Second calling module, in the timer for regenerating the system Afterwards, the timer is initialized, and calls the entrance function of the target logic, interface is executed with invocation target logic.
Optionally, the call unit further include: module is obtained, for obtaining data mark, wherein the data mark Time point when for log history performance objective logic;Determine submodule, for after the modification for completing time point, really Whether the time point that the fixed time judges that the time point of interface and the data mark record is consistent;Third calling module is used In when the time point for determining that the time judges that the time point of interface and the data mark record is inconsistent, the mesh is called It marks logic and executes interface.
Optionally, the test device further include: backup module, for before determining object time point, described in backup The current point in time of system;Recovery module, for according to the current point in time of backup, going back after obtaining analog result The former time judges the time point of interface.
Optionally, the target logic includes: across day execution logic, wherein across the day execution logic is used to indicate In the first preset time period to the second preset time period after the object time point before the object time point Test logic.
According to another aspect of an embodiment of the present invention, a kind of electronic equipment is additionally provided, comprising: processor;And storage Device, for storing the executable instruction of the processor;Wherein, the processor is configured to via the execution executable instruction To execute test method described in above-mentioned any one.
According to another aspect of an embodiment of the present invention, a kind of storage medium is additionally provided, the storage medium includes storage Program, wherein equipment perform claim where controlling the storage medium in described program operation requires above-mentioned any one The test method.
In embodiments of the present invention, using determining object time point, wherein object time point is tested for starting application, According to object time point, the time for modifying system judges the time point of interface, and after the modification of deadline point, invocation target is patrolled Volume execute interface, with simulation application test in target logic, obtain analog result, wherein analog result is used to indicate application Whether the target logic processing mode in test is correct.In this embodiment, it is only necessary to which modification can carry out the system using test Time judge time point of interface, that is, judge the object time point that verifying is wished at tester when allowing system to judge the time by accident, so After corresponding logic can be called to execute interface, to realize the target logic in Fast simulation game, target logic be across , can whether correct with across the day processing logic of fast verification when its processing logic, not needing to restart server can be completed target and patrols Volume verifying, realize automation, fast verification effect, improve application test efficiency, and then solve in the related technology into When row target logic is tested, needs frequently to restart server, lead to the technical problem that testing efficiency is lower.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes part of this application, this hair Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is a kind of flow chart of optional test method according to an embodiment of the present invention;
Fig. 2 is the schematic diagram of another optional test method according to an embodiment of the present invention;
Fig. 3 is a kind of schematic diagram of optional test device according to an embodiment of the present invention.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, " Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product Or other step or units that equipment is intrinsic.
To understand the present invention convenient for user, solution is made to part term or noun involved in various embodiments of the present invention below It releases:
Across day test is indicated in this application in application test, in the daily game that one or more time points are arranged Appearance is tested, when test, the game running logic that needs verification time point surrounding time section different.For example, being tested with game For, it needs to verify across the day process flow of 0 point of every night, such as resets number of activities, consumption number etc. is supplemented in resetting with money daily It counts, resets some activity data states of server, various system ranking lists clearing, various activities reward clearing granting etc. is patrolled Volume.
Daymark, data mark can refer to an integer for marking the date on the same day in game in this application, have Uniqueness.
The following every embodiments of the present invention, can be applied in various application tests, the present invention surveys specifically application Without limitation, can include but is not limited to: game application, VR application, AR application, office application etc. are preferably applied to swim for examination Across day test in play test, especially game test.The following every embodiments of the present invention with game test in across day test For schematically illustrated, should across day test, comprising: server data resetting and player's reset data, wherein server count According to resetting, instruction is when object time point arrives, to needing to carry out in server to reset across the data that day is simulated;Players number According to across the day test of resetting, need to consider in the online situation of player across under day and the not online situation of player across day.
When specifically carrying out game test, an object time point can be generally set, which can be work Personnel or other user's self-settinies, for example, setting object time point is 0 point or 6 points (making within 24 hours).In test, The embodiment of the present invention directly can judge that the time point of interface modifies to the time, when modification, often be modified to the object time The previous closer time point of point after then running some time, reaches object time point, and then to game running logic It is tested, for example, choosing object time point is, then can modify the time that the mesh time judges interface at 0 point (in other words 24 points) Point is 23:59:00, allows and carries out being mistakenly considered time point near object time point using the system of test, divides in this way in operation 1 Zhong Hou, so that it may confirm whether across the day processing logic in game is correct, thus realize the logic in Fast simulation game across day, It improves and applies test speed.Illustrate the present invention below by each embodiment.
According to embodiments of the present invention, a kind of test method embodiment is provided, it should be noted that in the flow chart of attached drawing The step of showing can execute in a computer system such as a set of computer executable instructions, although also, in flow chart In show logical order, but in some cases, shown or described step can be executed with the sequence for being different from herein Suddenly.
The following embodiments of the present invention are applied to carry out in the system using test, which may be selected to carry out game test Operating system.
Fig. 1 is a kind of flow chart of optional test method according to an embodiment of the present invention, as shown in Figure 1, this method packet Include following steps:
Step S102 determines object time point, wherein object time point is for starting application test;
Step S104, according to object time point, the time for modifying system judges the time point of interface;
Step S106, after the modification of deadline point, invocation target logic executes interface, is tested with simulation application Target logic obtains analog result, wherein just whether analog result be used to indicate using the target logic processing mode in test Really.
It through the above steps, can be using determining object time point, wherein object time point is used to start application test, According to object time point, the time for modifying system judges the time point of interface, and after the modification of deadline point, invocation target is patrolled Volume execute interface, with simulation application test in target logic, obtain analog result, wherein analog result is used to indicate application Whether the target logic processing mode in test is correct.In this embodiment, it is only necessary to which modification can carry out the system using test Time judge time point of interface, that is, judge the object time point that verifying is wished at tester when allowing system to judge the time by accident, so After corresponding logic can be called to execute interface, to realize the target logic in Fast simulation game, target logic be across , can whether correct with across the day processing logic of fast verification when its processing logic, mesh can be completed due to not needing to restart server The verifying of logic is marked, realizes the effect of automation, fast verification target logic, improves the efficiency of application test, and then solve phase In the technology of pass when carrying out target logic test, needs frequently to restart server, lead to the technical problem that testing efficiency is lower.
Above steps of the present invention is described in detail below.
Step S102 determines object time point, wherein object time point is for starting application test.
In embodiments of the present invention, every when being not per using across the day reset process for testing corresponding system or data Quarter is all judging, only after reaching object time point, can just trigger the trigger point of judgement.
, can be identical as the time point across day test for wishing to simulate for object time point, for example, when setting target Between point 23:59:00, or be directly disposed as, 6:00 AM (24 hours make), at 18 points in afternoon (making for 24 hours) at 0 point.Object time The time point across day test that point can also be simulated with hope is not identical, for example, setting is 24 points across the time point that day is tested, then It is 23:59:00 that object time point, which can be set, which can be developer, tester or other users The time point of self-setting is to be illustrated as example at the time point tested across day using object time point in the embodiment of the present invention. It when system reaches the object time point, can star using test, wherein in embodiments of the present invention, main using test Refer to across the day logic testing in game test.
The object time point can be to be instructed to obtain according to the testing time, is instructed by the testing time and is determined what hope was simulated Object time.
Optionally, before determining object time point, method further include: the current point in time of standby system.Pass through backup The current point in time of system, facilitates subsequent after the completion of test, goes back the actual time of original system, the current point in time meeting of the backup It is normal to promote, it not will receive the interference of test.In embodiments of the present invention, former time interface (such as old_time) can also be passed through To back up former time point.
Step S104, according to object time point, the time for modifying system judges the time point of interface.
The time of system judges that interface is to judge interface by the time for judging the first pipeline joint of time in system The time point of real-time acquisition system, and by the time point of the acquisition compared with object time point, it is confirmed whether to reach the object time.
In a kind of optional embodiment of the present invention, according to object time point, modify system time judge interface when Between the step of putting, comprising: according to the current point in time of object time point and system, calculate time difference;According to time difference and Time modification coefficient determines duration to be modified;Multiple times after current point in time is increased duration to be modified, in replacement system Judge the time pending in interface function, completes the modification for judging the time time point of interface.
The object time of simulation first can be jumped according to the hope of testing time instruction input in embodiments of the present invention Point, calculates the difference of object time point and current point in time, and by the time of system judge interface current point in time (such as The current specific time is obtained using time.location function) increase the time difference (DIFF, which can be used, to be indicated), it increases The time of time difference judges that interface is equivalent to and has rewritten time point, and system can thus be allowed to be determined in acquisition time at uncommon Hope the time point jumped.
Another optional, above-mentioned time modification coefficient, which can refer to, needs modification time interval time poor, for example, 1 point Clock, for example, current point in time is 18 points, and object time point is 24 points, and the time modification coefficient of setting is 1 minute, then can be with Calculating time difference is 6 hours, and binding time modifies coefficient, a length of 59 minutes 5 hours when determining to be modified;It thus can be with Current point in time is increased by 59 minutes 5 hours, reaches 23:59:00, thus multiple times in replacement system judge interface letter The pending time in number.Certainly, time modification coefficient can be adjusted voluntarily in the embodiment of the present invention, for example, it is also possible to Be arranged time modification coefficient be 3 minutes, 5 minutes, half a minute etc..
In the embodiment of the present invention, after modification time judges the time point of interface, server is not restarted.
Step S106, after the modification of deadline point, invocation target logic executes interface, is tested with simulation application Target logic obtains analog result, wherein just whether analog result be used to indicate using the target logic processing mode in test Really.
In an optional embodiment of the present invention, target logic includes: across day execution logic, wherein across day execution is patrolled It collects and is used to indicate in the first preset time period before object time point to the second preset time after object time point Test logic in section.
In embodiments of the present invention, if system detection can trigger decision logic, to call mesh to object time point is reached Mark logic and execute interface, the target logic of simulation, it is preferred that in this application can across day logic in simulation, to test Whether correct demonstrate,prove across day processing logic.
Optionally, after the modification of deadline point, invocation target logic execute interface the step of, comprising: pass through calling The entrance function of invocation target logic is instructed, interface is executed with invocation target logic;Alternatively, in the timer for regenerating system Afterwards, initialization timer, and the entrance function of invocation target logic execute interface with invocation target logic.
In embodiments of the present invention, in test, for different players, different test modes is had.It is played in test When family is across day data, at least need to test to three kinds of situations: 1) across day in the case that player is not online, confirmation can correctly execute across Its processing;2) across day in the case that player is online, confirmation can correctly execute across day processing;3) player is again offline heavy after line is across day On, or repeatedly it is offline it is heavy on, confirm that across day processing will not repeat.(such as reward clearing etc., repeating can repeat to send out Prize).
The first can pass through non-online player (i.e. when reaching object time point, player is simultaneously not logged in game) The entrance function of call instruction invocation target logic executes interface with invocation target logic, thus the mesh in simulation application test Logic is marked, analog result is obtained.Can user (or player) when logging in again, this primary across day logic will be triggered Judgement, after modification time judges the time point of interface, as long as user logs in across the day processing logic of i.e. analog again, at this time Whether the data for only needing to test after logging in again are consistent with the expected results handled across day, can be completed in non-online situation Simulate the test across day.I.e. if it is determined that across day interface can be convenient calling in game, touched by calling directly across day interface Across day logic is sent out, and does not have to trigger across day logic subsequently through original system timer is regenerated.
It second, for online player (i.e. when object time point reaches, player is still online), can regenerate After the timer of system, initialization timer, and the entrance function of invocation target logic, thus the target in simulation application test Logic obtains analog result.I.e. for the simulation test of online player, connect by a timer to execute across day reset logic Mouthful, for example, the daily resetting interface that (the different specific reset time points of game may be different) 0 point daily in game execute (should Different functions expression, such as daily_reset () function can be used in resetting interface).Optionally, in the embodiment of the present invention The set-up mode of line player may be equally applicable for the resetting of server state.
What is illustrated in the embodiment of the present invention regenerates timer, refers to the time for recalculating the execution of a timer, On the basis of judging interface by the time that dependent instruction is modified in front, the timer at this time regenerated is exactly In game false judgment current time be instruction input time point and the timer that generates.For example, some systems in game Across day logic is to calculate current time to 0 point of the time difference of morning when starting server, and one of generation determined after n hours When device, here if deleting original timer after modification time interface, reinitialize a timer again, and system judges It is object time point at the now time, a timer can be generated in this way, across day processing is executed by the timer, thus fastly Speed completes purpose of the simulation across day logic.
The third, for player after line is across day again it is offline it is heavy on, or repeatedly it is offline it is heavy on, confirm that across day processing will not It repeats, such as reward clearing etc., repeating can repeat to award prizes.It can be according to above-mentioned second mould for online player Quasi- test mode is handled.
It can also be by immediately after modification time judges the time point of interface as one optional embodiment of the present invention The primary interface daily across day resetting of triggering, carrys out processing of the simulation across day when, each system is when executing across day processing one As can all carry out it is secondary judge whether current time repeats across day, therefore the time interface modified before this just can By judgement here, system is allowed to think strictly across day, therefore can normally execute subsequent across day processing logic, To facilitate test whether consistent with expection across data various behind day.
In optionally a kind of embodiment of the invention, above-mentioned after the modification of deadline point, invocation target logic is executed The step of interface, further includes: obtain data mark, wherein data mark is used for time when log history performance objective logic Point;After the modification of deadline point, determine the time judge interface time point and data mark record time point whether one It causes;When the time point for determining that the time judges that the time point of interface and data mark record is inconsistent, invocation target logic is executed Interface.
In embodiments of the present invention, Daymark can be used to indicate in data mark, indicates the uniqueness of system time. When carrying out across day processing in game, one can be also stored simultaneously and records unique data mark that last time operates across day, mark is nearest Date once across day processing, that is, Daymark just judge today when going to across day processing logic interfacing every time Whether time point is consistent with the time point of last time, skips if consistent, inconsistent to carry out across day processing again, to avoid weight It is multiple to execute.Therefore, before calling across day logic, the time point that institute's having time judges interface can be first modified, original system is replaced In time interface function, after successfully modified, it is already possible to allow system determine the time be changed to desired time point, still Most of across day realization logic all writes on the timer to enter into force, therefore also needs on this basis, to regenerate across day Timer, or call the unified entrance function that executes across day directly in instruction, trigger across day logic to simulate, thus After triggering across day logic, judgement when understanding with reality across day is similar, and system will not be because of time check not by skipping across day Logic.
Through the foregoing embodiment, interface can be judged by modifying the time of system bottom, and execute across day logic letter Number, energy quickly interior across the day test of simulation, does not need modification system time, does not need to restart server, and test yet After complete can also automatic extensive recovery time without other adverse effects thus greatly reduce consuming required for across the day logic of test Time energy, effectively increase across the day testing efficiency in game.
Illustrate the present invention below by a specific embodiment.
In the following embodiments, concrete implementation method can be described so that python language (not limiting) is realized as an example. The embodiment of the present invention can realize across the day test of simulation by dependent instruction, can greatly improve across day testing efficiency.
In this embodiment, time point with object time point and across day test is identical to be illustrated.Example Such as, it is 24:00 that the time point tested across day, which is arranged, and it is 23:59 minutes that object time point, which is arranged, only modification time is needed to sentence in this way The time point of slave interrupt interface is 23:59 points can complete across the day test of simulation after one minute.
Fig. 2 is the schematic diagram of another optional test method according to an embodiment of the present invention, as shown in Fig. 2, it can be with Include:
21, start.
In this step, a global variable (old_time, old_localtime) can be defined in a test system Original old times interface (time.time () and time.datetime ()) is stored, to restore after the completion of testing.Its In, time.time () and time.datetime () refer to the interface for obtaining current specific system time, are connect by the two Mouth judges current time, such as on 2 21st, 2019 16:10.
22, the time point of original time interface is backed up.
23, the object time to be jumped point is inputted.
The object time point can be tester or developer input, pass through time command input wish simulate The time point jumped when across day test.
24, the time difference for needing to deviate is calculated.
According to the time point for the hope simulation that time command is passed to, the time difference for needing to deviate is calculated, for example, it is desirable to mould Across day logic at quasi- evening 12, can calculate phase between current time and object time according to the object time of input The specific duration of difference.
The object time inputted in the embodiment of the present invention can refer to specific time point to be simulated, such as want to test some When reset logic of the system at morning 0, object time of this input can input: on 2 21st, 2019 23:59 are in this way A specific time point, in this way instruction come into force after, the time in game will simulate the time point of this 23:59, about Execution will be simulated after one minutes across day.The object time is a parameter, can input any one following time Point.
25, time interface function is rewritten.
All relevant time interface, such as time.time () and time.datetime () can be rewritten, original On the basis of add the time difference, replace the former time interface function in system.
For example, indicating that time difference, that is, object time subtract the difference of current time by DIFF, use the second as list Position.It is similar with time.time () using time.localtime acquisition current specific time point, indicate current using ctime True time point is supported to repeat to jump the time by this instruction, so ctime is always the former time for passing through backup Interface old_time is obtained, to guarantee the correctness of this current actual time point.
After modification time judges the time point of interface, it is already possible to when system being allowed to determine that the time is changed to desired target Between put, but most of across day realizations logic all writes on the timer to enter into force, therefore also needs on this basis, to weigh The newly-generated timer across day, or the unified entrance function executed across day is called directly in instruction, to simulate triggering across day Logic.
What above-mentioned example illustrated regenerates timer, refers to the time for recalculating the execution of a timer, because Front is by the time interface of instruction modification, the timer at this time regenerated, be exactly in game false judgment it is current Time is the time point of instruction input and the timer that generates.For example, in game some systems across day logic, be starting take Be engaged in device when, calculate current time to the time difference at 0 point of morning (time point across day test), one of generation determines after n hours When device, modification time interface (for example, object time point is tonight 23:59) is afterwards if delete original timer, again here Reinitialize a timer, and it is 23:59 point now that system, which is judged into, so a timer after 1 minute will be generated, After namely 1 minute, the interface across day processing is carried out, simulates the purpose across day in one minute to realize.
If across day interface can be convenient calling in game, can also be patrolled to trigger across day by calling directly across day interface Volume, and do not have to trigger by regenerating original system timer.
26, across day execution function is called.
In embodiments of the present invention, in simulation when across day processing, record last time across a day behaviour can be stored simultaneously The unique data mark made records the last date across day processing, that is, daymark by the data mark, often Secondary whether the date for just judging today is consistent with the date of last time when going to across day processing logic interfacing, if consistent It skips, it is inconsistent to carry out across day processing again, to avoid repeating.
27, restore original time interface.
After being completed, the former time interface of above-mentioned backup is restored, thus caused by avoiding system time from modifying Other unknown problems.
28, terminate.
In this embodiment it is possible to the interface function that the time is commonly judged in server-side is rewritten by way of instruction, Such as the interface functions such as the time in python, datetime, erroneous judgement is wished at tester when allowing system judges the time in game The time point of verifying, across the day function interface executed when then calling across day by instruction, to realize in Fast simulation game Whether the logic across day facilitates across the day processing of verifying correct.It at the time point that interface is judged by this direct modification time, is not required to Frequently to restart server, so that it may across the day test of simulation be rapidly completed, improve testing efficiency.
Illustrate the present invention below by an alternative embodiment.
Fig. 3 is a kind of schematic diagram of optional test device according to an embodiment of the present invention, as shown in figure 3, the test fills Setting may include: determination unit 31, modify unit 33, call unit 35, wherein
Determination unit 31, for determining object time point, wherein object time point is for starting application test;
Unit 33 is modified, for according to object time point, the time for modifying system to judge the time point of interface;
Call unit 35, for after the modification of deadline point, invocation target logic execution interface to be surveyed with simulation application Target logic in examination, obtains analog result, wherein analog result is used to indicate using the target logic processing mode in test It is whether correct.
Above-mentioned test device can determine object time point by determination unit 31, wherein object time point is for starting Using test, by modification unit 33 according to object time point, the time for modifying system judges the time point of interface, passes through calling Unit 35 after the modification of deadline point, invocation target logic execute interface, with simulation application test in target logic, obtain To analog result, wherein whether analog result is used to indicate correct using the target logic processing mode in test.In the implementation In example, it is only necessary to which modification can carry out the time point for judging interface using the time of the system of test, that is, when allowing system to judge the time It judges into the object time point that tester wishes verifying by accident, corresponding logic then can be called to execute interface, to realize quick Target logic in simulation can be patrolled with fast verification across what day was handled when target logic is across day processing verifying logic It is volume whether correct, the verifying of target logic can be completed due to not needing to restart server, realize automation, fast verification logic Effect, improve the efficiency of application test, and then solve in the related technology when carrying out target logic test, need frequently to restart Server leads to the technical problem that testing efficiency is lower.
Optionally, modification unit includes: computing module, for the current point in time according to object time point and system, meter Evaluation time difference;Determining module, for determining duration to be modified according to time difference and time modification coefficient;Replacement module is used After current point in time is increased duration to be modified, when multiple times in replacement system judge pending in interface function Between, complete the modification that the time point of interface was judged the time.
Another optionally call unit includes: the first calling module, for passing through call instruction invocation target logic Entrance function executes interface with invocation target logic;Second calling module, for after regenerating the timer of system, just Beginningization timer, and the entrance function of invocation target logic execute interface with invocation target logic.
In embodiments of the present invention, call unit further include: module is obtained, for obtaining data mark, wherein date mark Time point when knowing for log history performance objective logic;Submodule is determined, for determining after the modification of deadline point Whether the time point that the time judges that the time point of interface and data mark record is consistent;Third calling module, for when determining Between judge interface time point and data mark record time point it is inconsistent when, invocation target logic execute interface.
It is another optionally, test device further include: backup module, for before determining object time point, backup system The current point in time of system;Recovery module, for after obtaining analog result, according to the current point in time of backup, recovery time Judge the time point of interface.
Optionally, target logic includes: across day execution logic, wherein across day execution logic was used to indicate in the object time The first preset time period before point is to the test logic in the second preset time period after object time point.
Above-mentioned test device can also include processor and memory, and above-mentioned determination unit 31 modifies unit 33, call Units 35 etc. store in memory as program unit, execute above procedure unit stored in memory by processor To realize corresponding function.
Include kernel in above-mentioned processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can be set One or more carrys out the target logic in simulation application test by adjusting kernel parameter, obtains analog result.
Above-mentioned memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM), memory includes extremely A few storage chip.
According to another aspect of an embodiment of the present invention, a kind of electronic equipment is additionally provided, comprising: processor;And storage Device, the executable instruction for storage processor;Wherein, processor is configured to execute via executable instruction is executed such as lower section The program of method step: object time point is determined, wherein object time point is for starting application test;According to object time point, repair The time for changing system judges the time point of interface;After the modification of deadline point, invocation target logic executes interface, with simulation Using the target logic in test, analog result is obtained, wherein analog result is used to indicate using at the target logic in test Whether reason mode is correct.
Optionally, the program of following method and step can also be performed when executing executable instruction in above-mentioned processor: according to The current point in time of object time point and system calculates time difference;According to time difference and time modification coefficient, determine to be repaired Change duration;After current point in time is increased duration to be modified, multiple times in replacement system judge pending in interface function Time, complete the time is judged interface time point modification.
Optionally, above-mentioned processor can also be performed the program of following method and step: passing through when executing executable instruction The entrance function of call instruction invocation target logic executes interface with invocation target logic;Alternatively, determining in the system that regenerates When device after, initialization timer, and the entrance function of invocation target logic executes interface with invocation target logic.
Optionally, the program of following method and step can also be performed when executing executable instruction in above-mentioned processor: obtaining Data mark, wherein data mark is used for time point when log history performance objective logic;In the modification of deadline point Afterwards, whether the time point for determining that the time judges that the time point of interface and data mark record is consistent;Determining that the time judges interface Time point and data mark record time point it is inconsistent when, invocation target logic execute interface.
Optionally, when executing executable instruction the program of following method and step can also be performed: true in above-mentioned processor It sets the goal before time point, the current point in time of standby system;Current time after obtaining analog result, according to backup Point, recovery time judge the time point of interface.
Optionally, target logic includes: across day execution logic, wherein across day execution logic was used to indicate in the object time The first preset time period before point is to the test logic in the second preset time period after object time point.
According to another aspect of an embodiment of the present invention, a kind of storage medium is additionally provided, storage medium includes the journey of storage Sequence, wherein equipment perform claim where control storage medium requires the test method of above-mentioned any one in program operation.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
In the above embodiment of the invention, it all emphasizes particularly on different fields to the description of each embodiment, does not have in some embodiment The part of detailed description, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed technology contents can pass through others Mode is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of the unit, Ke Yiwei A kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of unit or module It connects, can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple On unit.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words It embodies, which is stored in a storage medium, including some instructions are used so that a computer Equipment (can for personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or Part steps.And storage medium above-mentioned includes: that USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic or disk etc. be various to can store program code Medium.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (10)

1. a kind of test method characterized by comprising
Determine object time point, wherein the object time point is for starting application test;
According to the object time point, the time for modifying system judges the time point of interface;
After the modification for completing the time point, invocation target logic executes interface, to simulate the target in the application test Logic obtains analog result, wherein the target logic processing mode that the analog result is used to indicate in application test is It is no correct.
2. the method according to claim 1, wherein the time for modifying system is sentenced according to the object time point The step of time point of slave interrupt interface, comprising:
According to the current point in time of the object time point and the system, time difference is calculated;
According to the time difference and time modification coefficient, duration to be modified is determined;
After the current point in time is increased the duration to be modified, the multiple times replaced in the system judge interface function In pending time, complete the modification for judging the time time point of interface.
3. according to the method described in claim 2, it is characterized in that, invocation target is patrolled after the modification for completing the time point Collect the step of executing interface, comprising:
The entrance function of the target logic is called by call instruction, and interface is executed with invocation target logic;Alternatively, again After the timer for generating the system, the timer is initialized, and calls the entrance function of the target logic, to call mesh It marks logic and executes interface.
4. according to the method described in claim 2, it is characterized in that, invocation target is patrolled after the modification for completing the time point Collect the step of executing interface, further includes:
Obtain data mark, wherein the data mark is used for time point when log history performance objective logic;
After the modification for completing the time point, determine that the time judges what the time point of interface and the data mark recorded Whether time point is consistent;
When the time point for determining that the time judges that the time point of interface and the data mark record is inconsistent, described in calling Target logic executes interface.
5. according to the method described in claim 2, it is characterized in that,
Before determining object time point, the method also includes: back up the current point in time of the system;
After obtaining analog result, the method also includes: according to the current point in time of backup, restoring the time sentences The time point of slave interrupt interface.
6. method as claimed in any of claims 1 to 5, which is characterized in that the target logic includes: to hold across day Row logic, wherein the first preset time period that across the day execution logic is used to indicate before the object time point arrives Test logic in the second preset time period after the object time point.
7. a kind of test device characterized by comprising
Determination unit, for determining object time point, wherein the object time point is for starting application test;
Unit is modified, for according to the object time point, the time for modifying system to judge the time point of interface;
Call unit, for after the modification for completing the time point, invocation target logic to execute interface, to simulate the application Target logic in test, obtains analog result, wherein the target that the analog result is used to indicate in the application test is patrolled Whether correct collect processing mode.
8. device according to claim 7, which is characterized in that the modification unit includes:
Computing module calculates time difference for the current point in time according to the object time point and the system;
Determining module, for determining duration to be modified according to the time difference and time modification coefficient;
Replacement module, after the current point in time is increased the duration to be modified, when replacing multiple in the system Between judge the time pending in interface function, complete the modification for judging the time time point of interface.
9. a kind of electronic equipment characterized by comprising
Processor;And
Memory, for storing the executable instruction of the processor;
Wherein, the processor is configured to come any one of perform claim requirement 1 to 6 institute via the execution executable instruction The test method stated.
10. a kind of storage medium, which is characterized in that the storage medium includes the program of storage, wherein run in described program When control the storage medium where equipment perform claim require any one of 1 to 6 described in test method.
CN201910262073.0A 2019-04-02 2019-04-02 Test method and device and electronic equipment Active CN109992515B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910262073.0A CN109992515B (en) 2019-04-02 2019-04-02 Test method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910262073.0A CN109992515B (en) 2019-04-02 2019-04-02 Test method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109992515A true CN109992515A (en) 2019-07-09
CN109992515B CN109992515B (en) 2022-12-27

Family

ID=67132154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910262073.0A Active CN109992515B (en) 2019-04-02 2019-04-02 Test method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109992515B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110888815A (en) * 2019-12-09 2020-03-17 米哈游科技(上海)有限公司 Application program testing method, device, equipment and storage medium
CN111078525A (en) * 2019-10-11 2020-04-28 中国平安财产保险股份有限公司 Method and device for adjusting system running time, computer equipment and storage medium
WO2021003924A1 (en) * 2019-07-11 2021-01-14 平安普惠企业管理有限公司 Scheduled testing task control method, device, computer device, and storage medium
CN112925725A (en) * 2021-04-09 2021-06-08 网易(杭州)网络有限公司 Data testing method and device, readable storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6226784B1 (en) * 1998-10-14 2001-05-01 Mci Communications Corporation Reliable and repeatable process for specifying developing distributing and monitoring a software system in a dynamic environment
CN101477478A (en) * 2009-01-15 2009-07-08 福建星网锐捷网络有限公司 Test method and system for time-correlating events of built-in equipment
US20100281240A1 (en) * 2009-05-01 2010-11-04 Microsoft Corporation Program Code Simulator
CN104008046A (en) * 2013-02-26 2014-08-27 北京千橡网景科技发展有限公司 Method and device for testing programs
CN109445924A (en) * 2018-11-06 2019-03-08 网易(杭州)网络有限公司 Time virtual method, device, medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6226784B1 (en) * 1998-10-14 2001-05-01 Mci Communications Corporation Reliable and repeatable process for specifying developing distributing and monitoring a software system in a dynamic environment
CN101477478A (en) * 2009-01-15 2009-07-08 福建星网锐捷网络有限公司 Test method and system for time-correlating events of built-in equipment
US20100281240A1 (en) * 2009-05-01 2010-11-04 Microsoft Corporation Program Code Simulator
CN104008046A (en) * 2013-02-26 2014-08-27 北京千橡网景科技发展有限公司 Method and device for testing programs
CN109445924A (en) * 2018-11-06 2019-03-08 网易(杭州)网络有限公司 Time virtual method, device, medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱永光: "如何在单元测试过程中模拟日期和时间", 《HTTP://WWW.CNBLOG.COM/REDMOON//P/4433609.HTML》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021003924A1 (en) * 2019-07-11 2021-01-14 平安普惠企业管理有限公司 Scheduled testing task control method, device, computer device, and storage medium
CN111078525A (en) * 2019-10-11 2020-04-28 中国平安财产保险股份有限公司 Method and device for adjusting system running time, computer equipment and storage medium
CN110888815A (en) * 2019-12-09 2020-03-17 米哈游科技(上海)有限公司 Application program testing method, device, equipment and storage medium
CN112925725A (en) * 2021-04-09 2021-06-08 网易(杭州)网络有限公司 Data testing method and device, readable storage medium and electronic equipment
CN112925725B (en) * 2021-04-09 2024-03-15 网易(杭州)网络有限公司 Data testing method and device, readable storage medium and electronic equipment

Also Published As

Publication number Publication date
CN109992515B (en) 2022-12-27

Similar Documents

Publication Publication Date Title
CN109992515A (en) Test method and device, electronic equipment
Molyneaux The art of application performance testing: from strategy to tools
US9940225B2 (en) Automated error checking system for a software application and method therefor
US6993747B1 (en) Method and system for web based software object testing
Selby et al. Cleanroom software development: An empirical evaluation
JP2018139136A5 (en)
JP2018136985A5 (en)
CN110619210A (en) Simulator detection method and system
Vogel mRUBiS: An exemplar for model-based architectural self-healing and self-optimization
US20100115496A1 (en) Filter generation for load testing managed environments
CA2383919A1 (en) Method and system for web based software object testing
US9471454B2 (en) Performing automated system tests
CN110339571A (en) Event generation method and device, storage medium and electronic device
CN106959872A (en) Using loading method and device
CN109697164A (en) Test method, device, storage medium and the terminal of App have been adjusted in browser
CN107220169A (en) A kind of emulating server returns to the method and apparatus for customizing data
CN109815083B (en) Application crash monitoring method and device, electronic equipment and medium
Lewis et al. Runtime repair of software faults using event-driven monitoring
CN107203471B (en) Joint debugging method, service platform and computer storage medium
US20170039200A1 (en) Evaluating user experience
CN110389897A (en) SDK logic test method, device, storage medium and server
CN116089439A (en) Dynamic form modification method and device
CN115167896A (en) Method and device for updating software version, storage medium and electronic equipment
Jernberg Building a Framework for Chaos Engineering
Wolf et al. Automated testing for continuous delivery pipelines

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