CN109901984A - The method and apparatus for generating big data test case - Google Patents
The method and apparatus for generating big data test case Download PDFInfo
- Publication number
- CN109901984A CN109901984A CN201711292433.9A CN201711292433A CN109901984A CN 109901984 A CN109901984 A CN 109901984A CN 201711292433 A CN201711292433 A CN 201711292433A CN 109901984 A CN109901984 A CN 109901984A
- Authority
- CN
- China
- Prior art keywords
- field name
- big data
- script
- conditions
- equal
- 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.)
- Pending
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of method and apparatus for generating big data test case, are related to field of computer technology.Wherein, this method comprises: static analysis is carried out to big data script, to obtain staticaanalysis results;The said conditions that mention in the staticaanalysis results are split according to preset fractionation rule, to obtain split result figure;The split result figure is traversed, to generate test use cases.By above step, test case can be automatically generated, saves test case time and human cost, reduces difficulty of test, so that test case covering is more comprehensively.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of method and apparatus for generating big data test case.
Background technique
Currently, tester is to first pass through code walk-through mode to understand in script when testing big data script
Code logic, then, further according to code logic and requirement documents requirement, engineer's test case.
In realizing process of the present invention, at least there are the following problems in the prior art: the first, code walk-through for inventor's discovery
Process is higher to the technical requirements of tester;The second, database, table involved in big data script, field are more, tester
Member's understanding is got up time-consuming and laborious;Third, Test Sample Design depend on the professional standards of tester, the survey of Different Individual design
Example on probation differs greatly;4th, the dispersion of Test Sample Design Comparision can not only waste the more energy of tester, and
And infull situation is covered it is easy to appear test case.
Summary of the invention
In view of this, the present invention provides a kind of method and apparatus for generating big data test case, survey can be automatically generated
Example on probation, saves test case time and human cost, reduces difficulty of test, so that test case covering is more comprehensively.
To achieve the above object, according to an aspect of the invention, there is provided a kind of side for generating big data test case
Method.
The method of generation big data test case of the invention includes: to carry out static analysis to big data script, to obtain
Staticaanalysis results;The said conditions that mention in the staticaanalysis results are split according to preset fractionation rule, to obtain
Split result figure;The split result figure is traversed, to generate test use cases.
Optionally, the method also includes: the script for reading configuration extracts keyword, crucial to be extracted according to the script
Word executes described the step of carrying out static analysis to big data script.
Optionally, it includes: select, from and where that the script of the configuration, which extracts keyword,;It is described to big data foot
This progress static analysis, to obtain staticaanalysis results the step of include: the mesh taken out in select clause from big data script
Mark field name;The source data table name in from clause is taken out from big data script;It is taken out in where clause from big data script
Propose said conditions;Incidence relation figure is constructed based on the aiming field name, the source data table name and the said conditions that mention.
Optionally, if the preset fractionation rule includes: that the said conditions that mention meet: the ratio between field name and value
It is " being equal to " compared with connector, then the said conditions that mention is split into " field name is equal to the value " and " field
Name is not equal to the value " two conditional branchings;If described propose said conditions satisfaction: field name connector compared between value
For " being greater than " or " being more than or equal to " or " being less than " or " being less than or equal to ", then the said conditions that mention are split into that " field name is big
In the value ", " field name be equal to the value " and " field name is less than the value " three conditional branchings;If
The said conditions satisfaction that mentions: field name connector compared with another field name is " being equal to ", then proposes said conditions for described
It splits into " one field name is equal to another field name " and " one field name is not equal to another field
Two conditional branchings of name ".
To achieve the above object, according to another aspect of the present invention, a kind of dress for generating big data test case is provided
It sets.
The device of generation big data test case of the invention includes: analysis module, quiet for carrying out to big data script
State analysis, to obtain staticaanalysis results;Module is split, for regular in the staticaanalysis results according to preset fractionation
The said conditions that mention split, to obtain split result figure;Generation module is surveyed for traversing the split result figure with generating
Try set of uses case.
Optionally, described device further include: read module, the script for reading configuration extracts keyword, so that described
Analysis module extracts keyword according to the script and carries out static analysis to big data script to described.
Optionally, it includes: select, from and where that the script of the configuration, which extracts keyword,;The analysis module pair
Big data script carries out static analysis, and to obtain staticaanalysis results, to include: the analysis module take out from big data script
Aiming field name in select clause;The analysis module takes out the source data table name in from clause from big data script;
The analysis module is taken out in where clause from big data script and proposes said conditions;The analysis module is based on the target word
Section name, the source data table name and the said conditions that mention construct incidence relation figure.
Optionally, if it is described split module according to the fractionation rule include: it is described mention said conditions meet: field name with
Comparison connector between value is " being equal to ", then by it is described mention said conditions split into " field name is equal to the value " with
And " field name is not equal to the value " two conditional branchings;If described propose said conditions satisfaction: between field name and value
Comparison connector be " being greater than " or " being more than or equal to " or " being less than " or " being less than or equal to ", then the said conditions that mention are split into
" field name is greater than the value ", " field name is equal to the value " and " field name is less than the value " three
A conditional branching;If the said conditions satisfaction that mentions: field name connector compared with another field name is " being equal to ", will
It is described to mention that said conditions split into " one field name be equal to another field name " and " one field name is not equal to institute
State another field name " two conditional branchings.
To achieve the above object, according to a further aspect of the invention, a kind of electronic equipment is provided.
Electronic equipment of the invention, comprising: one or more processors;And storage device, for storing one or more
A program;When one or more of programs are executed by one or more of processors, so that one or more of processing
The method that device realizes generation big data test case of the invention.
To achieve the above object, according to a further aspect of the invention, a kind of computer-readable medium is provided.
Computer-readable medium of the invention is stored thereon with computer program, real when described program is executed by processor
The method of existing generation big data test case of the invention.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that by carrying out static state to big data script
Analysis splits the said conditions that propose in staticaanalysis results according to preset fractionation rule, and passes through traversal split result
Figure and etc., test case can be automatically generated, test case time and human cost are saved, difficulty of test is reduced, makes
Obtain test case covering more comprehensively.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment
With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is the key step schematic diagram of the method according to an embodiment of the invention for generating big data test case;
Fig. 2 a is the key step schematic diagram of the method according to another embodiment of the present invention for generating big data test case;
Fig. 2 b is the schematic diagram of the incidence relation figure constructed in the embodiment of the present invention;
Fig. 3 is the signal of the main modular of the device according to an embodiment of the invention for generating big data test case
Figure;
Fig. 4 is the signal of the main modular of the device according to another embodiment of the present invention for generating big data test case
Figure;
Fig. 5 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 6 is adapted for the structural schematic diagram for the computer system for realizing the electronic equipment of the embodiment of the present invention.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention
Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize
It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together
Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
It should be pointed out that in the absence of conflict, the feature in embodiment and embodiment in the present invention can be with
It is combined with each other.
Before introducing the embodiment of the present invention, first to the present embodiments relate to portion of techniques term be illustrated.
Hadoop: one distributed system basic framework developed by Apache foundation.Based on this frame, Yong Huke
Without understanding the details of the distributed bottom layer, to develop distributed program.Hadoop is mainly by HDFS and MapReduce group
At.
Hive: it is a data warehouse architecture based on Hadoop, a series of tool is provided, for carrying out
Data are extracted, convert and are loaded.It can be mapped as Hadoop flowering structure data file the table in one Hive, and provide
Sql sentence dress can be changed to MapReduce task and run by class sql query function.
Fig. 1 is the key step schematic diagram of the method according to an embodiment of the invention for generating big data test case.
As shown in Figure 1, the method for the generation big data test case of the embodiment of the present invention includes:
Step S101, static analysis is carried out to big data script, to obtain staticaanalysis results.
Illustratively, the big data script can be the script based on Hadoop and Hive Development of Framework.In general,
Big data script can execute different processing logics by if branch, can pass through where clause, in each processing logic
The inquiries such as sentence meet the data for proposing said conditions.By carrying out static analysis to big data script, can obtain in big data script
The database name used, table name, field name and said conditions are proposed for inquire data.
Step S102, the said conditions that mention in the staticaanalysis results are split according to preset fractionation rule, with
Obtain split result figure.
Wherein, the split result figure can be dendrogram, comprising: conditional branching after source data table node, fractionation with
And expected results node.The expected results node can include: node 1 (data filtering that will be obtained), node 2 is (by what is obtained
Data are saved to result table).In addition, the split result figure may also include middle table (or being " interim table ") node.
Step S103, the split result figure is traversed, to generate test use cases.
Wherein, the test use cases are made of test case corresponding with each path in the split result figure.
The test case can include: operating procedure and expected results.For example, test case 1 includes: item in a specific example
Part n1, condition n6, condition n8, condition n12, expected results " saving obtained data to result table ";Test case 2 includes:
Condition n1, condition n7, condition n8, condition n13, expected results " data filtering that will be obtained ".In addition, in the specific implementation, it can
The test use cases of generation are stored in excel file.
In embodiments of the present invention, by carrying out static analysis to big data script, according to preset fractionation rule to quiet
The said conditions that mention in state analysis result are split, and by traversal split result figure, can be automatically generated test and be used
Example saves test case time and human cost, reduces difficulty of test, so that test case covering is more comprehensively.
Fig. 2 a is the key step schematic diagram of the method according to another embodiment of the present invention for generating big data test case.
As shown in Figure 2 a, the method for the generation big data test case of the embodiment of the present invention includes:
Step S201, the script for reading configuration extracts keyword.
Wherein, the script extracts keyword can include: select, from and where.It is closed in addition, the script extracts
Key word may also include that the everyday words that data query is used in the big datas scripts such as join, left outer join and on.
In the specific implementation, script can be set in configuration file in advance and extract keyword.Then, in this step, read
It takes the script in configuration file to extract keyword, and all scripts can be extracted keyword and form a list (list).
Step S202, keyword is extracted according to the script and static analysis is carried out to big data script, to obtain static point
Analyse result.
In this step, it needs to extract keyword according to all scripts of reading and static point is carried out to big data script
Analysis.Illustratively, when it includes select, from and where that the script in list, which extracts keyword, the step can include: from
Big data script takes out the aiming field name in select clause;The source data table in from clause is taken out from big data script
Name;It is taken out in where clause from big data script and proposes said conditions;Based on the aiming field name, the source data table name with
And the said conditions that mention construct incidence relation figure.In the specific implementation, when the script extract keyword may also include on etc. its
When his keyword, step S202 further include: take out the said conditions that propose on clause from big data script, it is (interim to take out middle table
Table) name, and, the content etc. taken out from big data script according to other keywords.In turn, all data based on extraction
Table, field mention the contents such as said conditions building incidence relation figure.
For example, if from the source data table extracted in big data script be Database1.table1 (table 1 in database 1,
Referred to as " T1 "), Database1.table2 (table 2 in database 1, referred to as " T2 "), data extraction process is carried out to table T1 and is obtained
Middle table (interim table) TempT1 arrived carries out middle table (interim table) TempT2 that data extraction process obtains to table T2, and
That extracts from big data script proposes said conditions are as follows: " 2 > value of T1. field 1=value 1And T1. field 2 ", " T2. field 1=value
3 ", and " on TempT1. field 1=TempT2. field 2 ", then it can construct incidence relation figure as shown in Figure 2 b.Such as Fig. 2 b
Shown, in the incidence relation figure: first layer is source data table T1 icon, source data table T2 icon, and the second layer is to propose said conditions
" 2 > value of T1. field 1=value 1And T1. field 2 " icon mentions said conditions " T2. field 1=value 3 " icon;Third layer is centre
Table TempT1 icon, middle table TempT2 icon;4th layer is to propose said conditions " on TempT1. field 1=TempT2. field
2";Layer 5 is for storing aiming field (literary name section extracted from the select clause in big data script) data
As a result sheet icon.Also, the incidence relation figure may also include the oriented arrow for indicating incidence relation between each layer icon.
In embodiments of the present invention, keyword is extracted by being pre-configured with script, and key is extracted according to the script of reading
Word carries out static analysis to big data script, convenient for quickly positioning the key procedure node in big data script, improves static point
The efficiency of analysis.In addition, by step S202 by the tables of data used in big data script, field, propose said conditions etc. and extract,
And with its incidence relation is illustrated, the difficulty for being familiar with big data script is reduced.Therefore, with existing code walk-through mode phase
Than the embodiment of the present invention is greatly saved human cost, improves work efficiency by automatically parsing big data script.
Step S203, the said conditions that mention in the staticaanalysis results are split according to preset fractionation rule, with
Obtain split result figure.
Wherein, the preset fractionation rule as shown in table 1, specifically includes: if described propose said conditions satisfaction: field name
Connector is " being equal to " compared between value, then the said conditions that mention is split into " field name is equal to the value "
And " field name is not equal to the value " two conditional branchings;If the said conditions satisfaction that mentions: field name and value it
Between comparison connector be " being greater than " or " being more than or equal to " or " being less than " or " being less than or equal to ", then the said conditions that mention are split into
" field name is greater than the value ", " field name is equal to the value " and " field name is less than the value " three
A conditional branching;If the said conditions satisfaction that mentions: field name connector compared with another field name is " being equal to ", will
It is described to mention that said conditions split into " one field name be equal to another field name " and " one field name is not equal to institute
State another field name " two conditional branchings.
Table 1
Step S204, the split result figure is traversed, to generate test use cases.
Wherein, the test use cases are made of test case corresponding with each path in the split result figure.
The test case can include: operating procedure and expected results.In the specific implementation, the test use cases of generation can be protected
There are in excel file.
In embodiments of the present invention, keyword is extracted by being pre-configured with script, and key is extracted according to the script of reading
Word carries out static analysis to big data script, convenient for quickly positioning the key procedure node in big data script, improves static point
The efficiency of analysis;It, can be automatic by being split to the said conditions that mention in staticaanalysis results, and by traversal split result figure
Test case is generated, improves test case to the coverage of code.
Fig. 3 is the signal of the main modular of the device according to an embodiment of the invention for generating big data test case
Figure.As shown in figure 3, the device 300 of the generation big data test case of the embodiment of the present invention includes: analysis module 301, splits mould
Block 302, generation module 303.
Analysis module 301, for carrying out static analysis to big data script, to obtain staticaanalysis results.
Illustratively, the big data script can be the script based on Hadoop and Hive Development of Framework.In general,
Big data script can execute different processing logics by if branch, can pass through where clause, in each processing logic
The inquiries such as sentence meet the data for proposing said conditions.Static analysis is carried out to big data script by analysis module 301, can be obtained big
The database name used in data script, table name, field name and said conditions are proposed for inquire data.
Module 302 is split, for carrying out according to preset fractionation rule to the said conditions that mention in the staticaanalysis results
It splits, to obtain split result figure.
Wherein, the split result figure can be dendrogram, comprising: conditional branching after source data table node, fractionation with
And expected results node.The expected results node can include: node 1 (data filtering that will be obtained), node 2 is (by what is obtained
Data are saved to result table).In addition, the split result figure may also include middle table (or being " interim table ") node.
Generation module 303, for traversing the split result figure, to generate test use cases.
Wherein, the test use cases are made of test case corresponding with each path in the split result figure.
The test case can include: operating procedure and expected results.In the specific implementation, the test use cases of generation can be protected
There are in excel file.
In the device of the embodiment of the present invention, static analysis is carried out to big data script by analysis module 301, by tearing open
Sub-module 302 splits the said conditions that propose in staticaanalysis results, and traverses split result figure by generation module 303
Deng can automatically generate test case, save test case time and human cost, reduce difficulty of test, so that test
Use-case covers more comprehensively.
Fig. 4 is the signal of the main modular of the device according to another embodiment of the present invention for generating big data test case
Figure.As shown in figure 4, the device 400 of the generation big data test case of the embodiment of the present invention includes: read module 401, analysis mould
Block 402 splits module 403, generation module 404.
Read module 401, the script for reading configuration extract keyword.
Wherein, the script extracts keyword can include: select, from and where.It is closed in addition, the script extracts
Key word may also include that the everyday words that data query is used in the big datas scripts such as join, left outer join and on.Having
When body is implemented, script can be set in configuration file in advance and extract keyword.Then, in this step, read in configuration file
Script extract keyword, and can by all scripts extract keyword form a list (list).
Analysis module 402 carries out static analysis to big data script for extracting keyword according to the script, to obtain
Staticaanalysis results.
Wherein, analysis module 402 needs to extract keyword according to all scripts of reading quiet to the progress of big data script
State analysis.Illustratively, when it includes select, from and where that the script in list, which extracts keyword, analysis module 402
Keyword is extracted according to the script, static analysis is carried out to big data script, to obtain staticaanalysis results can include: analysis
Module 402 takes out the aiming field name in select clause from big data script;It is taken out in from clause from big data script
Source data table name;Analysis module 402 is taken out in where clause from big data script and proposes said conditions;Analysis module 402 is based on institute
It states aiming field name, the source data table name and the said conditions that propose and constructs incidence relation figure.
For example, if the source data table that analysis module 402 is extracted from big data script is Database1.table1 (data
Table 1 in library 1, referred to as " T1 "), Database1.table2 (table 2 in database 1, referred to as " T2 "), carries out data to table T1
Middle table (interim table) TempT1 that extraction process obtains carries out the middle table (interim table) that data extraction process obtains to table T2
TempT2, and analysis module 402 extracted from big data script propose said conditions are as follows: " T1. field 1=value 1And T1. field 2
> value 2 ", " T2. field 1=value 3 ", and " on TempT1. field 1=TempT2. field 2 ", then analysis module 402 constructs
Incidence relation figure can meet: first layer is source data table T1 icon, source data table T2 icon, and the second layer is to mention said conditions " T1. word
2 > value of section 1=value 1And T1. field, 2 " icon mentions said conditions " T2. field 1=value 3 " icon;Third layer is middle table
TempT1 icon, middle table TempT2 icon;4th layer is to mention said conditions " on TempT1. field 1=TempT2. field 2 " figure
Mark, layer 5 are for storing aiming field (literary name section extracted from the select clause in big data script) data
As a result sheet icon.Also, the incidence relation figure may also include the oriented arrow for indicating incidence relation between each layer icon.
In embodiments of the present invention, preconfigured script is read by read module 401 and extracts keyword, and by dividing
It analyses module 402 and keyword is extracted to the progress static analysis of big data script, convenient in quickly positioning big data script according to script
Key procedure node, improve the efficiency of static analysis.In addition, the number that will be used in big data script by analysis module 402
It according to table, field, proposes said conditions etc. and extracts, and with its incidence relation is illustrated, reduce the difficulty for being familiar with big data script.
Therefore, compared with existing code walk-through mode, the embodiment of the present invention automatically parses big data script by analysis module 402,
Human cost is greatly saved, improves work efficiency.
Module 403 is split, for carrying out according to preset fractionation rule to the said conditions that mention in the staticaanalysis results
It splits, to obtain split result figure.
Wherein, the fractionation rule for splitting 403 bases of module specifically includes: if described propose said conditions satisfaction: field
Name connector compared between value is " being equal to ", then the said conditions that mention is split into that " field name is equal to described take
Value " and " field name is not equal to the value " two conditional branchings;If described propose said conditions satisfaction: field name and value
Between comparison connector be " being greater than " or " being more than or equal to " or " being less than " or " being less than or equal to ", then by it is described mention said conditions split
At " field name is greater than the value ", " field name is equal to the value " and " field name is less than the value "
Three conditional branchings;If the said conditions satisfaction that mentions: field name connector compared with another field name is " being equal to ",
Mention that said conditions split into " one field name be equal to another field name " and " one field name is not equal to for described
Two conditional branchings of another field name ".
Generation module 404, for traversing the split result figure, to generate test use cases.
Wherein, the test use cases are made of test case corresponding with each path in the split result figure.
The test case can include: operating procedure and expected results.In the specific implementation, the test use cases of generation can be protected
There are in excel file.
In the device of the embodiment of the present invention, script is read by read module 401 and extracts keyword, passes through analysis module
402, which extract keyword according to the script of reading, carries out static analysis to big data script, convenient in quickly positioning big data script
Key procedure node, improve the efficiency of static analysis;By split module 403 in staticaanalysis results mention said conditions into
Row is split, and traverses split result figure by generation module 404, can automatically generate test case, improves test case to generation
The coverage of code.
Fig. 5 is shown can survey using the method or generation big data of the generation big data test case of the embodiment of the present invention
The exemplary system architecture 500 of the device of example on probation.
As shown in figure 5, system architecture 500 may include terminal device 501,502,503, network 504 and server 505.
Network 504 between terminal device 501,502,503 and server 505 to provide the medium of communication link.Network 504 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 501,502,503 and be interacted by network 504 with server 505, to receive or send out
Send message etc..Terminal device 501,502,503 can be the various electronic equipments with display screen and supported web page browsing, packet
Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 505 can be to provide the server of various services, such as utilize terminal device 501,502,503 to user
Transmitted request provides the back-stage management server supported.Back-stage management server can analyze the request received
Deng processing, and processing result (such as test case of generation) is fed back into terminal device.
It should be noted that the method for the generation big data test case in the embodiment of the present invention is generally by server 505
It executes, correspondingly, the device for generating big data test case is generally positioned in server 505.
It should be understood that the number of terminal device, network and server in Fig. 5 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
In addition, in some cases it may using the method or life of the generation big data test case of the embodiment of the present invention
Exemplary system architecture at the device of big data test case can not also include terminal device 501,502,503 and network
504, that is, only include server 505.It should be understood that in these cases, server 505 can be with display screen and support
The various electronic equipments of program operation.
Fig. 6 shows the structural representation for being suitable for the computer system 600 for the electronic equipment for being used to realize the embodiment of the present invention
Figure.Electronic equipment shown in Fig. 6 is only an example, should not function to the embodiment of the present invention and use scope bring it is any
Limitation.
As shown in fig. 6, computer system 600 includes central processing unit (CPU) 601, it can be read-only according to being stored in
Program in memory (ROM) 602 or be loaded into the program in random access storage device (RAM) 603 from storage section 608 and
Execute various movements appropriate and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data.
CPU 601, ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to always
Line 604.
I/O interface 605 is connected to lower component: the importation 606 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 607 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 608 including hard disk etc.;
And the communications portion 609 of the network interface card including LAN card, modem etc..Communications portion 609 via such as because
The network of spy's net executes communication process.Driver 610 is also connected to I/O interface 605 as needed.Detachable media 611, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 610, in order to read from thereon
Computer program be mounted into storage section 608 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention
Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer
Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.?
In such embodiment, which can be downloaded and installed from network by communications portion 609, and/or from can
Medium 611 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 601, system of the invention is executed
The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter
Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not
Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter
The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires
Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage
Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,
Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey
The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this
In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited
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 other than storage medium is read, which can send, propagates or transmit and be used for
By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium
Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned
Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more
Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box
The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical
On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants
It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule
The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction
It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard
The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet
It includes analysis module, split module and generation module.Wherein, the title of these modules is not constituted under certain conditions to the module
The restriction of itself, for example, analysis module is also described as " carrying out the module of static analysis to big data script ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be
Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating
Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes
It obtains the equipment and executes following below scheme: static analysis being carried out to big data script, to obtain staticaanalysis results;It is torn open according to preset
Divider then splits the said conditions that propose in the staticaanalysis results, to obtain split result figure;Traverse the fractionation knot
Fruit figure, to generate test use cases.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright
It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any
Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention
Within.
Claims (10)
1. a kind of method for generating big data test case, which is characterized in that the described method includes:
Static analysis is carried out to big data script, to obtain staticaanalysis results;
The said conditions that mention in the staticaanalysis results are split according to preset fractionation rule, to obtain split result
Figure;
The split result figure is traversed, to generate test use cases.
2. the method according to claim 1, wherein the method also includes:
The script for reading configuration extracts keyword, and to be extracted according to the script, keyword execution is described to carry out big data script
The step of static analysis.
3. according to the method described in claim 2, it is characterized in that, the configuration script extract keyword include: select,
From and where;
Described to carry out static analysis to big data script, to obtain staticaanalysis results the step of includes: to take from big data script
Aiming field name in select clause out;The source data table name in from clause is taken out from big data script;From big data foot
Said conditions are proposed in this taking-up where clause;Based on the aiming field name, the source data table name and described propose said conditions
Construct incidence relation figure.
4. the method according to claim 1, wherein the preset fractionation rule includes:
If the said conditions satisfaction that mentions: field name connector compared between value is " being equal to ", proposes said conditions for described
Split into " field name is equal to the value " and " field name is not equal to the value " two conditional branchings;
If the said conditions satisfaction that mentions: field name connector compared between value is " being greater than " or " being more than or equal to " or " small
In " or " being less than or equal to ", then the said conditions that mention are split into " field name is greater than the value ", " described field name etc.
In the value " and " field name is less than the value " three conditional branchings;
If the said conditions satisfaction that mentions: field name connector compared with another field name is " being equal to ", is mentioned described
Said conditions split into " one field name is equal to another field name " and " one field name is not equal to described another
Two conditional branchings of field name ".
5. a kind of device for generating big data test case, which is characterized in that described device includes:
Analysis module, for carrying out static analysis to big data script, to obtain staticaanalysis results;
Module is split, for being split according to preset fractionation rule to the said conditions that mention in the staticaanalysis results, with
Obtain split result figure;
Generation module, for traversing the split result figure, to generate test use cases.
6. device according to claim 5, which is characterized in that described device further include:
Read module, the script for reading configuration extract keyword, close so that the analysis module is extracted according to the script
Key word carries out static analysis to big data script to described.
7. device according to claim 6, which is characterized in that the script of the configuration extract keyword include: select,
From and where;
The analysis module carries out static analysis to big data script, includes: the analysis module to obtain staticaanalysis results
The aiming field name in select clause is taken out from big data script;The analysis module takes out from clause from big data script
In source data table name;The analysis module is taken out in where clause from big data script and proposes said conditions;The analysis module
Incidence relation figure is constructed based on the aiming field name, the source data table name and the said conditions that mention.
8. device according to claim 5, which is characterized in that it is described split module according to the fractionation rule include:
If the said conditions satisfaction that mentions: field name connector compared between value is " being equal to ", proposes said conditions for described
Split into " field name is equal to the value " and " field name is not equal to the value " two conditional branchings;
If the said conditions satisfaction that mentions: field name connector compared between value is " being greater than " or " being more than or equal to " or " small
In " or " being less than or equal to ", then the said conditions that mention are split into " field name is greater than the value ", " described field name etc.
In the value " and " field name is less than the value " three conditional branchings;
If the said conditions satisfaction that mentions: field name connector compared with another field name is " being equal to ", is mentioned described
Said conditions split into " one field name is equal to another field name " and " one field name is not equal to described another
Two conditional branchings of field name ".
9. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
The now method as described in any in Claims 1-4.
10. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor
The method as described in any in Claims 1-4 is realized when row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711292433.9A CN109901984A (en) | 2017-12-08 | 2017-12-08 | The method and apparatus for generating big data test case |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711292433.9A CN109901984A (en) | 2017-12-08 | 2017-12-08 | The method and apparatus for generating big data test case |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109901984A true CN109901984A (en) | 2019-06-18 |
Family
ID=66940155
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711292433.9A Pending CN109901984A (en) | 2017-12-08 | 2017-12-08 | The method and apparatus for generating big data test case |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109901984A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114253851A (en) * | 2021-12-20 | 2022-03-29 | 中国工商银行股份有限公司 | Test data processing method, device, equipment and storage medium |
CN114721932A (en) * | 2021-01-06 | 2022-07-08 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and storage medium |
US11593358B2 (en) | 2020-03-13 | 2023-02-28 | International Business Machines Corporation | Generation of test datasets for guarded commands |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
US20140172512A1 (en) * | 2012-12-14 | 2014-06-19 | International Business Machines Corporation | Efficiently generating test cases |
CN105912595A (en) * | 2016-04-01 | 2016-08-31 | 华南理工大学 | Data origin collection method of relational databases |
CN106681903A (en) * | 2015-11-11 | 2017-05-17 | 阿里巴巴集团控股有限公司 | Method and device for generating test case |
CN107102941A (en) * | 2017-03-30 | 2017-08-29 | 腾讯科技(深圳)有限公司 | The generation method and device of a kind of test case |
CN107133174A (en) * | 2017-05-04 | 2017-09-05 | 浙江路港互通信息技术有限公司 | Test case code automatically generating device and method |
-
2017
- 2017-12-08 CN CN201711292433.9A patent/CN109901984A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101436128A (en) * | 2007-11-16 | 2009-05-20 | 北京邮电大学 | Software test case automatic generating method and system |
US20140172512A1 (en) * | 2012-12-14 | 2014-06-19 | International Business Machines Corporation | Efficiently generating test cases |
CN106681903A (en) * | 2015-11-11 | 2017-05-17 | 阿里巴巴集团控股有限公司 | Method and device for generating test case |
CN105912595A (en) * | 2016-04-01 | 2016-08-31 | 华南理工大学 | Data origin collection method of relational databases |
CN107102941A (en) * | 2017-03-30 | 2017-08-29 | 腾讯科技(深圳)有限公司 | The generation method and device of a kind of test case |
CN107133174A (en) * | 2017-05-04 | 2017-09-05 | 浙江路港互通信息技术有限公司 | Test case code automatically generating device and method |
Non-Patent Citations (3)
Title |
---|
张青,王囡囡: "《工程软件开发技术》", 31 August 2016, 北京:北京理工大学出版社 * |
武剑洁,陈传波,肖来元: "《软件测试技术基础》", 31 October 2008, 华中科技大学出版社 * |
青岛英谷教育科技股份有限公司: "《PHP程序设计及实践》", 31 December 2016, 西安:西安电子科技大学出版社 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11593358B2 (en) | 2020-03-13 | 2023-02-28 | International Business Machines Corporation | Generation of test datasets for guarded commands |
CN114721932A (en) * | 2021-01-06 | 2022-07-08 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and storage medium |
CN114721932B (en) * | 2021-01-06 | 2024-04-09 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and storage medium |
CN114253851A (en) * | 2021-12-20 | 2022-03-29 | 中国工商银行股份有限公司 | Test data processing method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20220198327A1 (en) | Method, apparatus, device and storage medium for training dialogue understanding model | |
CN109446099A (en) | Automatic test cases generation method, device, medium and electronic equipment | |
CN110472207A (en) | List generation method and device | |
CN109388637A (en) | Data warehouse information processing method, device, system, medium | |
CN109783562A (en) | A kind of method and device for business processing | |
CN109558134A (en) | The method and apparatus of business datum verification | |
CN109271403A (en) | A kind of operating method of data query, device, medium and electronic equipment | |
CN110347428A (en) | A kind of detection method and device of code similarity | |
CN106919711A (en) | The method and apparatus of the markup information based on artificial intelligence | |
CN112860744A (en) | Business process processing method and device | |
CN110275963A (en) | Method and apparatus for output information | |
CN110471848A (en) | A kind of method and apparatus of dynamic returned packet | |
CN107491382A (en) | Log-output method and device | |
CN109992766A (en) | The method and apparatus for extracting target word | |
CN109901984A (en) | The method and apparatus for generating big data test case | |
CN110119445A (en) | The method and apparatus for generating feature vector and text classification being carried out based on feature vector | |
CN108958744A (en) | Dispositions method, device, medium and the electronic equipment of big data distributed type assemblies | |
CN110162448A (en) | The method and apparatus of log collection | |
CN110309142A (en) | The method and apparatus of regulation management | |
CN109976999A (en) | The measure and measurement apparatus of test case coverage rate | |
CN113962597A (en) | Data analysis method and device, electronic equipment and storage medium | |
CN110399187A (en) | A kind for the treatment of method and apparatus of language resource | |
CN110321252A (en) | A kind of method and apparatus of craft services scheduling of resource | |
CN110209906A (en) | Method and apparatus for extracting webpage information | |
CN109814957A (en) | A kind of label addition method and device for IOS system |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190618 |
|
RJ01 | Rejection of invention patent application after publication |