CN107229565A - Method of testing and device - Google Patents

Method of testing and device Download PDF

Info

Publication number
CN107229565A
CN107229565A CN201710399662.4A CN201710399662A CN107229565A CN 107229565 A CN107229565 A CN 107229565A CN 201710399662 A CN201710399662 A CN 201710399662A CN 107229565 A CN107229565 A CN 107229565A
Authority
CN
China
Prior art keywords
data
data markers
sequence
program
mentioned
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
CN201710399662.4A
Other languages
Chinese (zh)
Other versions
CN107229565B (en
Inventor
贺玉娇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710399662.4A priority Critical patent/CN107229565B/en
Publication of CN107229565A publication Critical patent/CN107229565A/en
Application granted granted Critical
Publication of CN107229565B publication Critical patent/CN107229565B/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/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

This application discloses method of testing and device.One embodiment of this method includes:The instruction that test program is tested is treated in reception, wherein, the program to be tested is the program with branched structure, each branch included by the program to be tested is previously provided with data markers, the instruction includes test data and expected result, and the expected result includes the first data markers sequence for it is expected that the data markers for the branch that the test data is flowed through are constituted;The test data is inputted into the program to be tested, run the program to be tested, so that the program to be tested generates implementation procedure information after end of run, wherein, the implementation procedure information includes the second data markers sequence that the data markers of the actual branch flowed through of the test data are constituted;The second data markers sequence is matched with the first data markers sequence, test result is generated based on matching result.This embodiment improves testing efficiency.

Description

Method of testing and device
Technical field
The application is related to field of computer technology, and in particular to Internet technical field, more particularly to method of testing and dress Put.
Background technology
At present, for program (the Distributed Application journey such as analyzing, calculate for big data with branched structure Sequence) method of testing be typically equivalence class classifying method, boundary analysis, cause effect graph etc..Typically by tested program in fortune Row terminate it is rear produced by actual result data be compared with expected results data, come judge the correct of actual result data and It is no, but it is difficult to orientation problem.
The content of the invention
The purpose of the application is to propose a kind of improved method of testing and device, carried to solve background section above The technical problem arrived.
In a first aspect, the embodiment of the present application provides a kind of method of testing, this method includes:Reception is treated test program and entered The instruction of row test, wherein, above-mentioned program to be tested is the program with branched structure, every included by above-mentioned program to be tested Individual branch is previously provided with data markers, and above-mentioned instruction includes test data and expected result, and above-mentioned expected result includes expecting The first data markers sequence that the data markers for the branch that above-mentioned test data is flowed through are constituted;Above-mentioned test data is inputted Above-mentioned program to be tested, runs above-mentioned program to be tested, so that above-mentioned program to be tested generates implementation procedure after end of run Information, wherein, the data markers of above-mentioned implementation procedure information including the actual branch flowed through of above-mentioned test data constituted the Two data markers sequences;Above-mentioned second data markers sequence is matched with above-mentioned first data markers sequence, based on matching As a result test result is generated.
In certain embodiments, it is above-mentioned by above-mentioned second data markers sequence and the progress of above-mentioned first data markers sequence Match somebody with somebody, test result is generated based on matching result, including:Determine above-mentioned second data markers sequence and above-mentioned first data markers sequence Whether the number for arranging the data markers included respectively is identical;If number is identical, above-mentioned second data markers sequence is further determined that Whether the data markers for the same position that row and above-mentioned first data markers sequence include respectively are identical;If above-mentioned second data mark Remember that sequence includes the target datas different from the data markers on the correspondence position in above-mentioned first data markers sequence and marked, then Test result is generated, wherein, above-mentioned test result is marked including above-mentioned target data.
In certain embodiments, when the number of the data markers included by above-mentioned second data markers sequence exceeds preset value When, above-mentioned test result also includes the positional information that above-mentioned target data is marked in above-mentioned second data markers sequence.
In certain embodiments, it is above-mentioned by above-mentioned second data markers sequence and the progress of above-mentioned first data markers sequence Match somebody with somebody, test result is generated based on matching result, including:In response to determining above-mentioned second data markers sequence and above-mentioned first data The number for the data markers that flag sequence includes respectively is differed, then is further determined that included by above-mentioned second data markers sequence Data markers number whether less than the data markers included by above-mentioned first data markers sequence number;If being less than, Generation includes the test result of loss of data prompt message.
In certain embodiments, when the number of the data markers included by above-mentioned second data markers sequence is less than above-mentioned the During the number of the data markers included by one data markers sequence, the test result generated also includes above-mentioned first data markers Data markers in sequence, being not included in above-mentioned second data markers sequence.
In certain embodiments, above-mentioned expected result also includes expected results data;And it is above-mentioned based on matching result life Into test result, including:In response to determining that above-mentioned second data markers sequence and above-mentioned first data markers sequence include respectively Same position data markers it is identical, then further determine that above-mentioned program to be tested after end of run produced by actual knot Whether fruit data are identical with above-mentioned expected results data;In response to determining above-mentioned actual result data and above-mentioned expected results data Identical, then generation includes at least one of following test result:Test by prompt message, above-mentioned second data markers sequence, Above-mentioned actual result data.
Second aspect, this application provides a kind of test device, the device includes:Receiving unit, is configured to reception pair The instruction that program to be tested is tested, wherein, above-mentioned program to be tested is the program with branched structure, above-mentioned journey to be tested Each branch included by sequence is previously provided with data markers, and above-mentioned instruction includes test data and expected result, above-mentioned expectation As a result the first data markers sequence for it is expected that the data markers for the branch that above-mentioned test data is flowed through are constituted is included;Program is transported Row unit, is configured to above-mentioned test data inputting above-mentioned program to be tested, above-mentioned program to be tested is run, so that above-mentioned treat Test program generates implementation procedure information after end of run, wherein, it is real that above-mentioned implementation procedure information includes above-mentioned test data The second data markers sequence that the data markers for the branch that border is flowed through are constituted;Generation unit, is configured to count above-mentioned second Matched according to flag sequence with above-mentioned first data markers sequence, test result is generated based on matching result.
In certain embodiments, above-mentioned generation unit includes:First determination subelement, is configured to determine above-mentioned second number Whether the number of the data markers included respectively according to flag sequence and above-mentioned first data markers sequence is identical;Second determines that son is single Member, if being configured to determine that number is identical, further determines that above-mentioned second data markers sequence and above-mentioned first data markers Whether the data markers for the same position that sequence includes respectively are identical;Subelement is generated, if being configured to determine above-mentioned second number Include the target data mark different from the data markers on the correspondence position in above-mentioned first data markers sequence according to flag sequence Note, then generate test result, wherein, above-mentioned test result is marked including above-mentioned target data.
In certain embodiments, when the number of the data markers included by above-mentioned second data markers sequence exceeds preset value When, above-mentioned test result also includes the positional information that above-mentioned target data is marked in above-mentioned second data markers sequence.
In certain embodiments, above-mentioned generation unit includes:3rd determination subelement, is configured to above-mentioned in response to determining The number for the data markers that second data markers sequence and above-mentioned first data markers sequence include respectively is differed, then further Determine whether the number of the data markers included by above-mentioned second data markers sequence is less than above-mentioned first data markers sequence institute Including data markers number;First generation subelement, if being configured to be less than, generation includes loss of data prompt message Test result.
In certain embodiments, when the number of the data markers included by above-mentioned second data markers sequence is less than above-mentioned the During the number of the data markers included by one data markers sequence, the test result generated also includes above-mentioned first data markers Data markers in sequence, being not included in above-mentioned second data markers sequence.
In certain embodiments, above-mentioned expected result also includes expected results data;And above-mentioned generation unit is further It is configured to:In response to determining the same position that above-mentioned second data markers sequence and above-mentioned first data markers sequence include respectively The data markers put are identical, then the actual result data produced by further determining that above-mentioned program to be tested after end of run are It is no identical with above-mentioned expected results data;In response to determining that above-mentioned actual result data are identical with above-mentioned expected results data, then Generation includes at least one of following test result:Test passes through prompt message, above-mentioned second data markers sequence, above-mentioned reality Result data.
The third aspect, the embodiment of the present application provides a kind of electronic equipment, and the electronic equipment includes:One or more processing Device;Storage device, for storing one or more programs;When said one or multiple programs are by said one or multiple processors Perform so that said one or multiple processors realize the method as described in any implementation in first aspect.
Fourth aspect, the embodiment of the present application provides a kind of computer-readable recording medium, is stored thereon with computer journey Sequence, it is characterised in that the method as described in any implementation in first aspect is realized when said procedure is executed by processor.
Method of testing and device that the embodiment of the present application is provided, by treating the finger that test program is tested receiving After order, the test data included by the instruction is inputted into the program to be tested, and runs the program to be tested, so that this is to be tested Program generates implementation procedure information after end of run.Then by by the second data markers included by the implementation procedure information Sequence is matched with the first data markers sequence included by the instruction, to generate test result based on matching result.Have Effect make use of the generation to above-mentioned second data markers sequence, clearly have recorded actual each point flowed through of the test data Branch, by the way that above-mentioned second data markers sequence is matched with above-mentioned first data markers sequence, so as in the above-mentioned second number According to the data markers included by the data markers included by flag sequence and above-mentioned first data markers sequence it is incomplete same when, Quickly locate out which branch there is a problem, so as to improve testing efficiency.
Brief description of the drawings
By reading the detailed description made to non-limiting example made with reference to the following drawings, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is that the application can apply to exemplary system architecture figure therein;
Fig. 2 is the flow chart of one embodiment of the method for testing according to the application;
Fig. 3 is the schematic diagram of the element branches of a program with branched structure;
Fig. 4 is the schematic diagram of an application scenarios of the method for testing according to the application;
Fig. 5 is the flow chart of another embodiment of the method for testing according to the application;
Fig. 6 is the structural representation of one embodiment of the test device according to the application;
Fig. 7 is adapted for the structural representation of the computer system of the electronic equipment for realizing the embodiment of the present application.
Embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that, in order to Be easy to description, illustrate only in accompanying drawing to about the related part of invention.
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phase Mutually combination.Describe the application in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1, which is shown, can apply the exemplary system architecture of the method for testing of the application or the embodiment of test device 100。
As shown in figure 1, system architecture 100 can include terminal device 101,102,103, network 104 and server 105. Medium of the network 104 to provide communication link between terminal device 101,102,103 and server 105.Network 104 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be interacted with using terminal equipment 101,102,103 by network 104 with server 105, to receive or send out Deliver letters breath etc..Various telecommunication customer end applications can be installed, such as web browser should on terminal device 101,102,103 With, shopping class application, game class application, Software Testing Tool etc..Terminal device 101,102,103 can be with local reception to be measured The instruction that examination program is tested, and the instruction is handled.
Terminal device 101,102,103 can be the various electronic equipments with display screen, include but is not limited to intelligent hand Machine, tablet personal computer, pocket computer on knee and desktop computer etc..
Server 105 can be to provide the server of various services, for example, be deployed with the journey to be tested with branched structure The server of sequence, the server (such as can be consumed the information generated after program end of run to be tested in running Time of expense etc.) write the storage location specified or be sent to terminal device 101,102,103.
It should be noted that the method for testing that the embodiment of the present application is provided typically is held by terminal device 101,102,103 OK, correspondingly, test device is generally positioned in terminal device 101,102,103.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only schematical.According to realizing need Will, can have any number of terminal device, network and server.
If can be with it is pointed out that program to be tested is not to dispose program on the server, in system architecture 100 Do not include server 105.
With continued reference to Fig. 2, the flow 200 of one embodiment of method of testing according to the application is shown.The test side Method, comprises the following steps:
Step 201, receive and treat the instruction that test program is tested.
In the present embodiment, method of testing operation thereon electronic equipment (such as terminal device 101 shown in Fig. 1, 102nd, the instruction that test program is tested 103) can be treated with local reception.Wherein, the program to be tested can have to divide The program of branch structure.As shown in figure 3, Fig. 3 shows the schematic diagram of the element branches of a program with branched structure.In figure In 3, the program " judges 1 ", " judges 2 ", " judge 3 ", " judge 4 ", " judge 5 ", " judge 6 ", " judge 7 " including condition.Its In, condition " judges 1 ", " judges 2 ", " judges that 3 " can correspond to Liang Ge branches respectively, i.e., ("Yes" in Fig. 3 can when condition is met To represent that condition is met) one branch of correspondence, ("No" in Fig. 3 can represent that condition is unsatisfactory for) correspondence one when condition is unsatisfactory for Individual branch." judge 4 " for condition, " judge 5 ", " judge 6 ", " judge that the branch corresponding to 7 " is not shown in figure 3.Here, Each branch included by above-mentioned program to be tested can be previously provided with data markers, the data markers can include numeral, The characters such as letter, Chinese character, additional character (such as " (", ") "), data markers may, for example, be " (YES) of mark 1 ", " mark 1 (Y) ", " mark 1 (no) ", " mark 1 (F) " etc..Above-mentioned instruction can include test data and expected result, and the expected result can With including expecting the first data markers sequence that the data markers for each branch that the test data is flowed through are constituted.Need Bright, above-mentioned program to be tested can be deployed in local program or be deployed in connected server (for example Server 105 shown in Fig. 1) on program, the present embodiment do not do any restriction to content in this respect.
In some optional implementations of the present embodiment, above-mentioned expected result can also include expected results data, The expected results data can be that tester expects result data of the above-mentioned program to be tested produced by after end of run.Example Such as, above-mentioned program to be tested can be used for shop matching, and whether determine two shops is same shop, produced number of results According to for " identical " or " differing ", if test data includes data set A and data set B, wherein, data set A includes " three inner villages 38 Number ", " western-style food ", " accommodate 40 people ", data set B includes " three inner villages 38 ", " western-style restaurant ", " 40 people ", then expected results number According to can be " identical ".
In some optional implementations of the present embodiment, above-mentioned test data can derive from a test case, A plurality of test case can also be derived from.When above-mentioned test data derives from a plurality of test case, it is meant that above-mentioned electronics is set It is standby disposably to perform a plurality of test case.It should be noted that test case is often referred to a specific software production Product carry out the description of test assignment, embody testing scheme, method, technology and strategy.Content can include test target, test wrapper Border, input data, testing procedure, expected results, test script etc..
Step 202, the test data included by instruction is inputted into program to be tested, program to be tested is run, so as to be measured Examination program generates implementation procedure information after end of run.
In the present embodiment, above-mentioned electronic equipment can input above-mentioned test data after above-mentioned instruction is received Program to be tested is stated, and runs above-mentioned program to be tested, so that above-mentioned program to be tested generates implementation procedure after end of run Information.Wherein, the data markers for the branch that the implementation procedure information can actually be flowed through including above-mentioned test data are constituted The second data markers sequence, each data markers in the second data markers sequence can be according to corresponding branch's quilt What the sequencing of execution was arranged.Here, above-mentioned electronic equipment, which can be locally provided with advance, possesses software and hardware resources Thread, above-mentioned electronic equipment can be by the thread so that above-mentioned test data is inputted into above-mentioned program to be tested, and runs above-mentioned Program to be tested, the present embodiment does not do any restriction to content in this respect.
In some optional implementations of the present embodiment, when above-mentioned test data derives from a plurality of test case, Above-mentioned implementation procedure information can include the second data markers sequence corresponding with the test data from each test case Row.Such as above-mentioned data to be tested include test data A and test data B, then above-mentioned implementation procedure information can include test The second data markers sequence that the data markers for the branch that data A is flowed through are constituted, and the branch that test data B is flowed through The second data markers sequence for being constituted of data markers.
Step 203, by the first data included by the second data markers sequence included by implementation procedure information and instruction Flag sequence is matched, and test result is generated based on matching result.
In the present embodiment, after above-mentioned implementation procedure information is generated, above-mentioned electronic equipment can be by above-mentioned implementation procedure The second data markers sequence included by information is matched with the first data markers sequence included by above-mentioned instruction, and is based on Matching result generates test result.As an example, above-mentioned electronic equipment can directly by the second data markers sequence and this The data markers of same position included by one data markers sequence are compared, for example, determine the second data markers sequence successively Whether each data markers in row are identical with the data markers on the correspondence position in the first data markers sequence;If in the presence of The data markers differed, then above-mentioned electronic equipment can generate test result, the test result can include second data Data markers in flag sequence, the first correspondence position with the first data markers sequence that is being determined are differed Data markers.
In some optional implementations of the present embodiment, above-mentioned electronic equipment can also be by above-mentioned second data markers Sequence and above-mentioned first data markers sequence enter number of lines comparison, to determine above-mentioned second data markers sequence and above-mentioned first number Whether the number of the data markers included respectively according to flag sequence is identical, if number is differed, and above-mentioned electronic equipment can enter one Step determines whether the number of the data markers included by above-mentioned second data markers sequence is less than above-mentioned first data markers sequence The number of included data markers, if being less than, above-mentioned electronic equipment, which can be generated, includes the test of loss of data prompt message As a result.Alternatively, the test result can also include above-mentioned first data markers sequence in, be not included in above-mentioned second data Data markers in flag sequence.So, tester or developer are by checking the test result, it is easy to orient by Leak the branch performed.
In some optional implementations of the present embodiment, if above-mentioned second data markers sequence and above-mentioned first data The number for the data markers that flag sequence includes respectively is identical, then above-mentioned electronic equipment may further determine that above-mentioned second data Whether the data markers for the same position that flag sequence and above-mentioned first data markers sequence include respectively are identical;If the same position The data markers put are identical, then produced by above-mentioned electronic equipment may further determine that above-mentioned program to be tested after end of run Actual result data it is whether identical with the expected results data included by above-mentioned instruction;In response to determining the actual result data Identical with the expected results data, then above-mentioned electronic equipment can be generated including at least one of following test data:Test is logical Cross prompt message, above-mentioned second data markers sequence, the actual result data.
In some optional implementations of the present embodiment, above-mentioned electronic equipment can also export above-mentioned implementation procedure letter Breath and above-mentioned test result, for example, export to the display screen of above-mentioned electronic equipment, or exports to the internal memory of above-mentioned electronic equipment Or on hard disk, or output, to the server being connected with above-mentioned electronic equipment telecommunication, the present embodiment is not to content in this respect Do any restriction.
With continued reference to Fig. 4, Fig. 4 is a schematic diagram of the application scenarios of the method for testing according to the present embodiment.Fig. 4's In application scenarios, program 401 to be tested is the distributed application program being deployed on server 402, and program 401 to be tested is wrapped The each branch included is previously provided with data markers.Support test data and the first data mark can be installed in client 403 Remember that sequence submits the client application of function, user can submit test data 404 and with testing number by the client application The instruction 406 that test program 401 is tested is treated to trigger according to 404 corresponding first data markers sequences 405, wherein, refer to Making 406 includes the data markers sequence 405 of test data 404 and first, and the first data markers sequence 405 includes data markers successively " (YES) of mark 1 ", " (YES) of mark 2 ", " (YES) of mark 4 ", " mark 9 (no) ".Client 403 can instruct 406 with local reception. Then, client 403 can input test data 404 program 401 to be tested, program 401 to be tested be run, so as to be tested Program 401 generates implementation procedure information after end of run, wherein, the implementation procedure information includes the actual stream of test data 404 The second data markers sequence 407 that the data markers of the branch of warp are constituted, it is assumed that the second data markers sequence 407 includes successively Data markers " (YES) of mark 1 ", " mark 2 (no) ", " (YES) of mark 5 ", " mark 10 (no) ";Finally, client 403 can be straight Connect and compared the data markers of the same position included by the second data markers sequence 407 and the first data markers sequence 405 Compared with, data markers " (YES) of mark 2 " and " mark 2 (no) " for comparing same position are different, data markers " (YES) of mark 4 " and " (YES) of mark 5 " is different, and data markers " mark 9 (no) " and " mark 10 (no) " difference, and client 403 can generate survey Test result 408, test result 408 can include the data markers " mark 2 (no) " in the second data markers sequence 407, that is, treat The data markers of the branch of first execution mistake in test program 401.
The method that above-described embodiment of the application is provided is effectively utilized the generation to above-mentioned second data markers sequence, clearly The actual each branch flowed through of the test data is have recorded clearly, by the way that above-mentioned second data markers sequence is counted with above-mentioned first Matched according to flag sequence, so as in the data markers included by above-mentioned second data markers sequence and above-mentioned first data mark When data markers included by note sequence are incomplete same, quickly locate out which branch there is a problem, so as to carry High testing efficiency.
With further reference to Fig. 5, it illustrates the flow 500 of another of method of testing embodiment.The stream of the method for testing Journey 500, comprises the following steps:
Step 501, receive and treat the instruction that test program is tested.
In the present embodiment, method of testing operation thereon electronic equipment (such as terminal device 101 shown in Fig. 1, 102nd, the instruction that test program is tested 103) can be treated with local reception.Wherein, the program to be tested can have to divide The program of branch structure, each branch included by the program to be tested can be previously provided with data markers, and the data markers can So that including characters such as numeral, letter, Chinese character, additional characters (such as " (", ") "), data markers may, for example, be " mark 1 (YES) ", " mark 1 (Y) ", " mark 1 (no) ", " mark 1 (F) " etc..Above-mentioned instruction can include test data and expected result, The expected result can include the first data mark for it is expected that the data markers for each branch that the test data is flowed through are constituted Remember sequence.It should be noted that above-mentioned program to be tested can be deployed in local program or be deployed in be connected Server (such as the server 105 shown in Fig. 1) on program, the present embodiment do not do any restriction to content in this respect.
Step 502, the test data included by instruction is inputted into program to be tested, program to be tested is run, so as to be measured Examination program generates implementation procedure information after end of run.
In the present embodiment, above-mentioned electronic equipment can input above-mentioned test data after above-mentioned instruction is received Program to be tested is stated, and runs above-mentioned program to be tested, so that above-mentioned program to be tested generates implementation procedure after end of run Information.Wherein, the data markers for the branch that the implementation procedure information can actually be flowed through including above-mentioned test data are constituted The second data markers sequence, each data markers in the second data markers sequence can be according to corresponding branch's quilt What the sequencing of execution was arranged.
Step 503, the first number included by the second data markers sequence and the instruction included by implementation procedure information is determined Whether the number of the data markers included respectively according to flag sequence is identical.
In the present embodiment, after above-mentioned implementation procedure information is generated, above-mentioned electronic equipment can be by above-mentioned second data The number for the data markers that flag sequence and above-mentioned first data markers sequence include respectively is compared, to determine that the number is It is no identical.If identical, above-mentioned electronic equipment can perform step 504.
Step 504, the number for the same position that the second data markers sequence and the first data markers sequence include respectively is determined It is identical according to marking whether.
In the present embodiment, above-mentioned second data markers sequence and above-mentioned first data markers are determined in response to step 503 The number for the data markers that sequence includes respectively is identical, then above-mentioned electronic equipment can be further by above-mentioned second data markers sequence The data markers for the same position that row and above-mentioned first data markers sequence include respectively are compared, to determine the same position Data markers it is whether identical.If above-mentioned second data markers sequence includes and the corresponding position in above-mentioned first data markers sequence The different target data mark of the data markers put, then above-mentioned electronic equipment can perform step 505.
Step 505, test result is generated.
In the present embodiment, in response to above-mentioned second data markers sequence include with above-mentioned first data markers sequence The different target data mark of data markers on correspondence position, then above-mentioned electronic equipment can generate test result, wherein, should Test result can include above-mentioned target data mark.Here, if data markers included by above-mentioned second data markers sequence Number exceed preset value (such as 30), the test result can also be marked at above-mentioned second data mark including above-mentioned target data Remember the positional information in sequence.It is pointed out that each data markers in above-mentioned second data markers sequence can have rope Quotation marks, the positional information can be the call number of above-mentioned target data.It should be noted that above-mentioned preset value is can be according to reality Border needs what is modified, and the present embodiment does not do any restriction to content in this respect.
From figure 5 it can be seen that compared with the corresponding embodiments of Fig. 2, the flow 500 of the method for testing in the present embodiment is dashed forward Go out in the same number of of the data markers included by above-mentioned second data markers sequence and above-mentioned first data markers sequence In the case of process step.Thus, the scheme of the present embodiment description can improve the comprehensive of test, and then can improve test Efficiency.
With further reference to Fig. 6, as the realization to method shown in above-mentioned each figure, this application provides a kind of test device One embodiment, the device embodiment is corresponding with the embodiment of the method shown in Fig. 2, and the device specifically can apply to various electricity In sub- equipment.
As shown in fig. 6, the test device 600 shown in the present embodiment includes:Receiving unit 601, the and of program running unit 602 Generation unit 603.Wherein, receiving unit 601, which is configured to receive, treats the instruction that test program is tested, wherein, it is above-mentioned Program to be tested is the program with branched structure, and each branch included by above-mentioned program to be tested is previously provided with data mark Note, above-mentioned instruction includes test data and expected result, and above-mentioned expected result includes point for it is expected that above-mentioned test data is flowed through The first data markers sequence that the data markers of branch are constituted;Program running unit 602 is configured to above-mentioned test data is defeated Enter above-mentioned program to be tested, above-mentioned program to be tested is run, so that above-mentioned program to be tested is generated after end of run and performed Journey information, wherein, what the data markers that above-mentioned implementation procedure information includes the actual branch flowed through of above-mentioned test data were constituted Second data markers sequence;Generation unit 603 is configured to above-mentioned second data markers sequence and above-mentioned first data markers Sequence is matched, and test result is generated based on matching result.
In the present embodiment, in test device 600:Receiving unit 601, program running unit 602 and generation unit 603 The specific technique effect for handling and its being brought can be respectively with reference to step 201, step 202 and the step in Fig. 2 correspondence embodiments 203 related description, will not be repeated here.
In some optional implementations of the present embodiment, above-mentioned generation unit 603 can include:First determines that son is single First (not shown), is configured to determine that above-mentioned second data markers sequence and above-mentioned first data markers sequence include respectively Data markers number it is whether identical;Second determination subelement (not shown), if being configured to determine that number is identical, Further determine that the data for the same position that above-mentioned second data markers sequence and above-mentioned first data markers sequence include respectively Mark whether identical;Generate subelement (not shown), if be configured to determine above-mentioned second data markers sequence include with The different target data mark of data markers on correspondence position in above-mentioned first data markers sequence, then generation test knot Really, wherein, above-mentioned test result include above-mentioned target data mark.
In some optional implementations of the present embodiment, when the data mark included by above-mentioned second data markers sequence When the number of note exceeds preset value, above-mentioned test result is also marked at above-mentioned second data markers sequence including above-mentioned target data In positional information.
In some optional implementations of the present embodiment, above-mentioned generation unit 603 can include:3rd determines that son is single First (not shown), is configured in response to determining above-mentioned second data markers sequence and above-mentioned first data markers sequence point The number for the data markers not included is differed, then further determines that the data markers included by above-mentioned second data markers sequence Number whether less than the data markers included by above-mentioned first data markers sequence number;First generation subelement is (in figure It is not shown), if being configured to be less than, generation includes the test result of loss of data prompt message.
In some optional implementations of the present embodiment, when the data mark included by above-mentioned second data markers sequence When the number of note is less than the number of the data markers included by above-mentioned first data markers sequence, the test result generated is also wrapped Include data markers in above-mentioned first data markers sequence, being not included in above-mentioned second data markers sequence.
In some optional implementations of the present embodiment, above-mentioned expected result also includes expected results data;And Above-mentioned generation unit 603 can be further configured to:In response to determining above-mentioned second data markers sequence and above-mentioned first number The data markers of the same position included respectively according to flag sequence are identical, then further determine that above-mentioned program to be tested is tied in operation Whether the actual result data produced by after beam are identical with above-mentioned expected results data;In response to determining above-mentioned actual result data Identical with above-mentioned expected results data, then generation includes at least one of following test result:Test passes through prompt message, above-mentioned Second data markers sequence, above-mentioned actual result data.
The device that above-described embodiment of the application is provided is effectively utilized the generation to above-mentioned second data markers sequence, clearly The actual each branch flowed through of the test data is have recorded clearly, by the way that above-mentioned second data markers sequence is counted with above-mentioned first Matched according to flag sequence, so as in the data markers included by above-mentioned second data markers sequence and above-mentioned first data mark When data markers included by note sequence are incomplete same, quickly locate out which branch there is a problem, so as to carry High testing efficiency.
Below with reference to Fig. 7, it illustrates suitable for for the computer system 700 for the electronic equipment for realizing the embodiment of the present application Structural representation.Electronic equipment shown in Fig. 7 is only an example, to the function of the embodiment of the present application and should not use model Shroud carrys out any limitation.
As shown in fig. 7, computer system 700 includes CPU (CPU) 701, it can be read-only according to being stored in Program in memory (ROM) 702 or be loaded into program in random access storage device (RAM) 703 from storage part 708 and Perform various appropriate actions and processing.In RAM 703, the system that is also stored with 700 operates required various programs and data. CPU 701, ROM 702 and RAM 703 are connected with each other by bus 704.Input/output (I/O) interface 705 is also connected to always Line 704.
I/O interfaces 705 are connected to lower component:Importation 706 including keyboard, mouse etc.;Penetrated including such as negative electrode The output par, c 707 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage part 708 including hard disk etc.; And the communications portion 709 of the NIC including LAN card, modem etc..Communications portion 709 via such as because The network of spy's net performs communication process.Driver 710 is also according to needing to be connected to I/O interfaces 705.Detachable media 711, such as Disk, CD, magneto-optic disk, semiconductor memory etc., are arranged on driver 710, in order to read from it as needed Computer program be mounted into as needed storage part 708.
Especially, in accordance with an embodiment of the present disclosure, the process described above with reference to flow chart may be implemented as computer Software program.For example, embodiment of the disclosure includes a kind of computer program product, it includes being carried on computer-readable medium On computer program, the computer program include be used for execution flow chart shown in method program code.In such reality Apply in example, the computer program can be downloaded and installed by communications portion 709 from network, and/or from detachable media 711 are mounted.When the computer program is performed by CPU (CPU) 701, limited in the system for performing the application Above-mentioned functions.
It should be noted that the computer-readable medium shown in the application can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer-readable recording medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, system, device or the device of infrared ray or semiconductor, or it is any more than combination.Meter The more specifically example of calculation machine readable storage medium storing program for executing can include but is not limited to:Electrical connection with one or more wires, just Take formula computer disk, hard disk, random access storage device (RAM), read-only storage (ROM), erasable type and may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only storage (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In this application, computer-readable recording medium can any include or store journey The tangible medium of sequence, the program can be commanded execution system, device or device and use or in connection.And at this In application, computer-readable signal media can be included in a base band or as the data-signal of carrier wave part propagation, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but not limit In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium beyond storage medium is read, the computer-readable medium, which can send, propagates or transmit, to be used for Used by instruction execution system, device or device or program in connection.Included on computer-readable medium Program code can be transmitted with any appropriate medium, be included but is not limited to:Wirelessly, electric wire, optical cable, RF etc., or above-mentioned Any appropriate combination.
Flow chart and block diagram in accompanying drawing, it is illustrated that according to the system of the various embodiments of the application, method and computer journey Architectural framework in the cards, function and the operation of sequence product.At this point, each square frame in flow chart or block diagram can generation The part of one module of table, program segment or code, a part for above-mentioned module, program segment or code is comprising one or more Executable instruction for realizing defined logic function.It should also be noted that in some realizations as replacement, institute in square frame The function of mark can also be with different from the order marked in accompanying drawing generation.For example, two square frames succeedingly represented are actual On can perform substantially in parallel, they can also be performed in the opposite order sometimes, and this is depending on involved function.Also It is noted that the combination of each square frame in block diagram or flow chart and the square frame in block diagram or flow chart, can use and perform rule Fixed function or the special hardware based system of operation realize, or can use the group of specialized hardware and computer instruction Close to realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard The mode of part is realized.Described unit can also be set within a processor, for example, can be described as:A kind of processor bag Include receiving unit, program running unit and generation unit.Wherein, the title of these units under certain conditions constitute pair The restriction of the unit in itself, for example, the first determining unit is also described as, " finger that test program is tested is treated in reception The unit of order ".
As on the other hand, present invention also provides a kind of computer-readable medium, the computer-readable medium can be Included in electronic equipment described in above-described embodiment;Can also be individualism, and without be incorporated the electronic equipment in. Above computer computer-readable recording medium carries one or more program, and when said one or multiple programs, by one, the electronics is set During standby execution so that the electronic equipment includes:The instruction that test program is tested is treated in reception, wherein, above-mentioned journey to be tested Sequence is the program with branched structure, and each branch included by above-mentioned program to be tested is previously provided with data markers, above-mentioned Instruction includes test data and expected result, and above-mentioned expected result includes expecting the data for the branch that above-mentioned test data is flowed through The first constituted data markers sequence of mark;Above-mentioned test data is inputted into above-mentioned program to be tested, run above-mentioned to be tested Program, so that above-mentioned program to be tested generates implementation procedure information after end of run, wherein, above-mentioned implementation procedure information includes The second data markers sequence that the data markers of the actual branch flowed through of above-mentioned test data are constituted;By above-mentioned second data mark Note sequence is matched with above-mentioned first data markers sequence, and test result is generated based on matching result.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.People in the art Member should be appreciated that invention scope involved in the application, however it is not limited to the technology of the particular combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, is carried out by above-mentioned technical characteristic or its equivalent feature Other technical schemes formed by any combination.Such as features described above has similar work(with (but not limited to) disclosed herein The technical characteristic of energy carries out technical scheme formed by replacement mutually.

Claims (10)

1. a kind of method of testing, it is characterised in that methods described includes:
The instruction that test program is tested is treated in reception, wherein, the program to be tested is the program with branched structure, institute State each branch included by program to be tested and be previously provided with data markers, the instruction includes test data and expects to tie Really, the expected result includes the first data markers for it is expected that the data markers for the branch that the test data is flowed through are constituted Sequence;
The test data is inputted into the program to be tested, the program to be tested is run, so that the program to be tested exists Implementation procedure information is generated after end of run, wherein, the implementation procedure information includes actual point flowed through of the test data The second data markers sequence that the data markers of branch are constituted;
The second data markers sequence is matched with the first data markers sequence, is generated and tested based on matching result As a result.
2. according to the method described in claim 1, it is characterised in that described by the second data markers sequence and described first Data markers sequence is matched, and test result is generated based on matching result, including:
Determining the number for the data markers that the second data markers sequence and the first data markers sequence include respectively is It is no identical;
If number is identical, further determine that the second data markers sequence and the first data markers sequence include respectively Same position data markers it is whether identical;
If the second data markers sequence includes and the data markers on the correspondence position in the first data markers sequence Different target data marks, then generate test result, wherein, the test result is marked including the target data.
3. method according to claim 2, it is characterised in that when the data mark included by the second data markers sequence When the number of note exceeds preset value, the test result is also marked at the second data markers sequence including the target data In positional information.
4. method according to claim 2, it is characterised in that described by the second data markers sequence and described first Data markers sequence is matched, and test result is generated based on matching result, including:
In response to determining the data markers that the second data markers sequence and the first data markers sequence include respectively Whether number is differed, then further determine that the number of data markers included by the second data markers sequence less than described The number of data markers included by first data markers sequence;
If being less than, generation includes the test result of loss of data prompt message.
5. method according to claim 4, it is characterised in that when the data mark included by the second data markers sequence When the number of note is less than the number of the data markers included by the first data markers sequence, the test result generated is also wrapped Include data markers in the first data markers sequence, being not included in the second data markers sequence.
6. method according to claim 2, it is characterised in that the expected result also includes expected results data;And
It is described that test result is generated based on matching result, including:
In response to determining the same position that the second data markers sequence and the first data markers sequence include respectively Data markers are identical, then further determine that the program to be tested after end of run produced by actual result data whether with The expected results data are identical;
In response to determining that the actual result data are identical with the expected results data, then generation include it is following at least one Test result:Test passes through prompt message, the second data markers sequence, the actual result data.
7. a kind of test device, it is characterised in that described device includes:
Receiving unit, is configured to receive and treats the instruction that test program is tested, wherein, the program to be tested is that have The program of branched structure, each branch included by the program to be tested is previously provided with data markers, and the instruction includes Test data and expected result, the expected result include expecting the data markers institute group for the branch that the test data is flowed through Into the first data markers sequence;
Program running unit, is configured to the test data inputting the program to be tested, runs the program to be tested, So that the program to be tested generates implementation procedure information after end of run, wherein, the implementation procedure information includes described The second data markers sequence that the data markers of the actual branch flowed through of test data are constituted;
Generation unit, is configured to be matched the second data markers sequence with the first data markers sequence, base Test result is generated in matching result.
8. device according to claim 7, it is characterised in that the generation unit includes:
First determination subelement, is configured to determine the second data markers sequence and the first data markers sequence difference Including data markers number it is whether identical;
Second determination subelement, if it is identical to be configured to number, further determines that the second data markers sequence and described Whether the data markers for the same position that the first data markers sequence includes respectively are identical;
Subelement is generated, if being configured to the second data markers sequence includes and pair in the first data markers sequence The target data mark that the data markers on position are different is answered, then generates test result, wherein, the test result includes described Target data is marked.
9. a kind of electronic equipment, it is characterised in that including:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are by one or more of computing devices so that one or more of processors are real The existing method as described in any in claim 1-6.
10. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that described program is processed The method as described in any in claim 1-6 is realized when device is performed.
CN201710399662.4A 2017-05-31 2017-05-31 Test method and device Active CN107229565B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710399662.4A CN107229565B (en) 2017-05-31 2017-05-31 Test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710399662.4A CN107229565B (en) 2017-05-31 2017-05-31 Test method and device

Publications (2)

Publication Number Publication Date
CN107229565A true CN107229565A (en) 2017-10-03
CN107229565B CN107229565B (en) 2020-05-01

Family

ID=59934327

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710399662.4A Active CN107229565B (en) 2017-05-31 2017-05-31 Test method and device

Country Status (1)

Country Link
CN (1) CN107229565B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688295A (en) * 2018-07-06 2020-01-14 北京京东尚科信息技术有限公司 Data testing method and device
CN111258882A (en) * 2020-01-03 2020-06-09 恩亿科(北京)数据科技有限公司 Test data acquisition method and device based on digital media system
CN113836021A (en) * 2021-09-24 2021-12-24 昆仑芯(北京)科技有限公司 Test method, test device, electronic apparatus, and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101625709A (en) * 2008-07-09 2010-01-13 华为技术有限公司 Method and device for collecting functional coverage
CN102323906A (en) * 2011-09-08 2012-01-18 哈尔滨工程大学 MC/DC test data automatic generation method based on genetic algorithm
CN102419728A (en) * 2011-11-01 2012-04-18 北京邮电大学 Method for determining software test process sufficiency based on coverage rate quantitative indicators
CN103365771A (en) * 2012-04-10 2013-10-23 阿里巴巴集团控股有限公司 Method and equipment for obtaining code coverage rate
US20150370695A1 (en) * 2014-02-14 2015-12-24 International Business Machines Corporation Testing optimized binary modules
CN105512021A (en) * 2014-09-25 2016-04-20 阿里巴巴集团控股有限公司 Method and device for Diff analysis used for software testing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101625709A (en) * 2008-07-09 2010-01-13 华为技术有限公司 Method and device for collecting functional coverage
CN102323906A (en) * 2011-09-08 2012-01-18 哈尔滨工程大学 MC/DC test data automatic generation method based on genetic algorithm
CN102419728A (en) * 2011-11-01 2012-04-18 北京邮电大学 Method for determining software test process sufficiency based on coverage rate quantitative indicators
CN103365771A (en) * 2012-04-10 2013-10-23 阿里巴巴集团控股有限公司 Method and equipment for obtaining code coverage rate
US20150370695A1 (en) * 2014-02-14 2015-12-24 International Business Machines Corporation Testing optimized binary modules
CN105512021A (en) * 2014-09-25 2016-04-20 阿里巴巴集团控股有限公司 Method and device for Diff analysis used for software testing

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688295A (en) * 2018-07-06 2020-01-14 北京京东尚科信息技术有限公司 Data testing method and device
CN111258882A (en) * 2020-01-03 2020-06-09 恩亿科(北京)数据科技有限公司 Test data acquisition method and device based on digital media system
CN111258882B (en) * 2020-01-03 2023-08-25 恩亿科(北京)数据科技有限公司 Test data acquisition method and device based on digital media system
CN113836021A (en) * 2021-09-24 2021-12-24 昆仑芯(北京)科技有限公司 Test method, test device, electronic apparatus, and medium

Also Published As

Publication number Publication date
CN107229565B (en) 2020-05-01

Similar Documents

Publication Publication Date Title
CN107330522A (en) Method, apparatus and system for updating deep learning model
CN108038469A (en) Method and apparatus for detecting human body
CN107168952A (en) Information generating method and device based on artificial intelligence
CN108197652A (en) For generating the method and apparatus of information
CN107395647A (en) Checking system, method and apparatus
CN107305579A (en) The method of testing and device of intelligent Answer System
CN110019782A (en) Method and apparatus for exporting text categories
CN108256591A (en) For the method and apparatus of output information
CN108958992A (en) test method and device
CN108427941A (en) Method, method for detecting human face and device for generating Face datection model
CN107578034A (en) information generating method and device
CN109389640A (en) Image processing method and device
CN107731229A (en) Method and apparatus for identifying voice
CN107229565A (en) Method of testing and device
CN106528393A (en) Method and device for Mock testing of WebService
CN108256476A (en) For identifying the method and apparatus of fruits and vegetables
CN108171275A (en) For identifying the method and apparatus of flowers
CN109359194A (en) Method and apparatus for predictive information classification
CN109634767A (en) Method and apparatus for detection information
CN111080633A (en) Screen defect detection method and device, terminal equipment and storage medium
CN106919711A (en) The method and apparatus of the markup information based on artificial intelligence
CN108595448A (en) Information-pushing method and device
CN107729249A (en) Browser compatibility method of testing, device, system and electronic equipment
CN109840192A (en) The method and apparatus of automatic test
CN108182457A (en) For generating the method and apparatus of information

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