Test cases generation method, device, server and medium
Technical field
The present embodiments relate to field of computer technology more particularly to a kind of test cases generation methods, device, service
Device and medium.
Background technique
Test belongs to an important link in software development process.It is tested by case, exploitation software can be verified
Stability and compatibility find software error and defect.Only test passes through, and exploitation software just has an opportunity online popularization.
In the process of development, it will usually encounter the test for needing to be performed simultaneously multiple functions in a kind of test scene.If
In each test process, it is completely dependent on developer and carries out writing and combining for each test program, not only expend people
Power cost, and influence the testing efficiency of exploitation software.
Summary of the invention
The embodiment of the present invention provides a kind of test cases generation method, device, server and medium, to realize based on test
Demand automatically generates the effect of test cases.
In a first aspect, the embodiment of the invention provides a kind of test cases generation methods, this method comprises:
Testing requirement document based on acquisition, at least one test cases type that identification test process is related to;
According at least one described test cases type, it is corresponding that each test cases type is extracted from test cases library
Test sub- case;
According to testing requirement, the sub- case of each test of extraction is spliced, target detection case is obtained.
Second aspect, the embodiment of the invention also provides a kind of test cases generating means, which includes:
Test cases type identification module, for the testing requirement document based on acquisition, identify test process be related to
A few test cases type;
Sub- case abstraction module is tested, for being taken out from test cases library according at least one described test cases type
Take the corresponding sub- case of test of each test cases type;
Target detection case generation module, for according to testing requirement, the sub- case of each test of extraction to be spliced,
Obtain target detection case.
The third aspect, the embodiment of the invention also provides a kind of servers, 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 processing
Device realizes the test cases generation method as described in any embodiment of the present invention.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer
Program realizes the test cases generation method as described in any embodiment of the present invention when the program is executed by processor.
At least one test cases class that the embodiment of the present invention is related to by analysis testing requirement document, identification test process
Type, the corresponding sub- case of test of each test cases type is then extracted from test cases library will finally according to testing requirement
The sub- case of each test extracted carries out rational joint, just automatically generates the complete object test case for being applicable to currently test
Example, solves the problems, such as existing test cases generating process labor intensive cost, realizes and automatically generate survey based on testing requirement
The effect for trying case, reduces the consumption of human cost, and then improve testing efficiency.
Detailed description of the invention
Fig. 1 is the flow chart for the test cases generation method that the embodiment of the present invention one provides;
Fig. 2 is the flow chart of test cases generation method provided by Embodiment 2 of the present invention;
Fig. 3 is the structural schematic diagram for the test cases generating means that the embodiment of the present invention three provides;
Fig. 4 is a kind of structural schematic diagram for server that the embodiment of the present invention four provides.
Specific embodiment
The present invention 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 the present invention rather than limiting the invention.It also should be noted that in order to just
Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is the flow chart for the test cases generation method that the embodiment of the present invention one provides, and the present embodiment is applicable to base
In testing requirement generate test cases the case where, this method can be executed by test cases generating means, which can adopt
It is realized, and can be integrated on the server with the mode of software and/or hardware.
As shown in Figure 1, test cases generation method provided in this embodiment may include:
S110, the testing requirement document based on acquisition, at least one test cases type that identification test process is related to.
Testing requirement document is the specific test order current based on testing requirement description.The testing requirement document can be
The descriptive text that tester directly inputs according to testing requirement is also possible to after tester is inputted by voice through converting
Obtained text.Testing requirement document can be inputted when inputting according to preset text formatting, to improve subsequent knowledge
The efficiency of other test cases type.It may include specific separator in preset text formatting, to realize point of sentence
It cuts.Text formatting specifically can carry out flexible setting by tester, and the present embodiment is not especially limited.
By carrying out text analyzing to the testing requirement document of acquisition, at least one that current test process is related to is determined
Test cases type.In general, one test process of software or application program can be related to multiple according to different application and developments
Application function, therefore, one time test process is just related to multiple test subtasks, the corresponding test of each test subtask
Case type.It should be noted that the present embodiment method can obtain multiple testing requirement documents simultaneously, and synchronizes and identified
Processing, determines the corresponding test cases type of each testing requirement.
Optionally, the testing requirement document based on acquisition, at least one test cases type that identification test process is related to,
Include:
Extract the keyword in the testing requirement document obtained;
At least one test cases type that test process is related to is determined according to keyword.
In the present embodiment, any keyword extracting method can use, such as based on the reverse document-frequency (TF- of word frequency-
IDF keyword extracting method), the keyword extracting method based on topic model (Topic-model) and fast automatic key
Word extracts (Rapid Automatic Keyword Extraction, RAKE) method etc., analyzes testing requirement document,
At least one keyword is extracted, then in conjunction with document semantic, determines at least one test case that current test process is related to
Example type.
Illustratively, below for 618 financing activity testing requirements of certain financing application, to the test cases of the present embodiment
Type identification illustrates, and 618 financing activity testing requirements are as follows:
1) the purchase card A of 3 kinds of denominations is shared, the user for being all only limitted to the first sum of investment gets.Clicking to enter default is 50
The purchase card A of member, changes a gift in every two seconds.Financing user can replace gift by horizontally slipping.
2) regular pop-up can be popped up by clicking active rule, after clicking " financing is got ", need stepping on for judgement financing user first
Record state pops up login frame if financing user is not logged in, jumps directly to correspond to after the completion of financing user logs in or registers
Finance product is transferred to the page, and the minimum amount of gift is got in the user's input that helps to manage money matters automatically.
Tester is based on above-mentioned testing requirement can will be in following testing requirement document typing server: 1 | and 618 financings are lived
Dynamic demand | the purchase card A of 3 kinds of denominations is shared, the user for being all only limitted to the first sum of investment gets.Clicking to enter default is 50 yuan of purchases
Object card A, changes a gift in every two seconds.Financing user can replace gift by horizontally slipping.| rule can be popped up by clicking active rule
Then pop-up after clicking " financing is got ", needs the logging state of judgement financing user first, pops up and step on if financing user is not logged in
Frame is recorded, corresponding finance product is jumped directly to after the user that manages money matters logs in or registered is transferred to the page, and helps to manage money matters automatically
User inputs the minimum amount for getting gift.
Above-mentioned testing requirement document is analyzed, the keyword of extraction includes but is not limited to: financing activity, gift and being stepped on
Record, continues to classify to keyword, based on keyword classification as a result, can determine what current test process was related to based on semanteme
Test cases type includes that financing gift increasing send class testing case and user to log in class testing case.
S120, according at least one test cases type, it is corresponding that each test cases type is extracted from test cases library
The sub- case of test.
After determining test cases type, type matching is carried out in test cases library, if successful match, extract with
The corresponding sub- case of test of test cases type, for currently testing.Wherein, test cases library is according to test cases class
Type, after the history test cases that can be shared is split and classification storage is obtained or is carried out history test cases whole
Property stores to obtain.When the test cases type in test cases library there are current demand, the survey of respective type is directly therefrom transferred
Case frame is tried, tester can be saved and repeat to write the process of the test program, to reduce the work of tester
It measures.
S130, according to testing requirement, the sub- case of each test of extraction is spliced, target detection case is obtained.
The splicing of sub- case is tested, not only includes the corresponding test frame anabolic process of each sub- case of test, also
Including being based on testing requirement document, test parameter involved in each sub- case of test is updated to current test parameter, thus
Target detection case is obtained, current test assignment is executed.Wherein, the splicing sequence of each sub- case of test has no considered critical,
According to the target detection case that different splicing sequences obtain, available different test result, and then can send out with multi-angle
The problem of existing application development process.For example, being surveyed for 618 financing activity testing requirements of certain above-mentioned financing application
Financing gift increasing can be first carried out during examination send class testing case, rear to execute user's login sub- case of class testing;It can also
The sub- case of class testing is logged in so that user is first carried out, rear execution financing gift increasing send class testing case.
Further, according to testing requirement, the sub- case of each test of extraction is spliced, target detection case is obtained
Example, comprising:
According to testing requirement, the sub- case of each test of extraction is spliced, candidate test cases is obtained;
According to the keyword of extraction, candidate test cases is adjusted, obtains target detection case.
Wherein, by analyzing testing requirement document, keyword is not only obtained, is also analyzed corresponding to each type
Keyword test parameter, using the corresponding test parameter of keyword to candidate test cases carry out details adjustment, thus
To target detection case.For example, in the examples described above, corresponding to the test parameter packet of keyword " financing activity " and " gift "
It includes: date -618, gift object-purchase card A, -3 kinds of gift quantity etc..
Tester, which is needed not rely on, during generating due to target detection case writes test cases manually,
In face of a large amount of testing requirement, human cost can be saved, tester is saved and repeats to write the process of test program, Jin Eryou
Help improve testing efficiency.
Based on the above technical solution, optionally, according to testing requirement, the sub- case of each test of extraction is carried out
Splicing, obtains target detection case, comprising: and the sub- case of each test based on testing requirement and extraction is corresponding to execute sequence,
Each sub- case of test is spliced, target detection case is obtained.
The execution sequence for testing sub- case refers to that the normally execution of corresponding each application function in application development process is suitable
Sequence, such as under normal execution sequence, carry out user's login first and then get financing gift, therefore, user logs in class and surveys
The execution sequence of swab case will send class testing case earlier than financing gift increasing.Either splicing obtains target detection case also
It is that splicing obtains candidate test cases, can be spliced according to the corresponding execution sequence of each sub- case of test.
Optionally, this method further include: obtain user to the review result of target detection case, and be based on review result pair
Target detection case is adjusted.The user refers to tester, and user's evaluation is to further ensure that the mesh automatically generated
The logical correctness and stability of test cases are marked, the test result avoided is unreliable.Review result includes tester
Mistake or unreasonable place existing for scoring and target detection case to target detection case.Based on review result, obtain
The corresponding adjustment instruction for taking tester to input, which includes modifying, increasing newly or delete etc., to realize to target
The adjustment again of test cases.
The technical solution of the present embodiment identifies at least one test that test process is related to by analysis testing requirement document
Then case type extracts the corresponding sub- case of test of each test cases type, finally according to test from test cases library
The sub- case of each test of extraction is carried out rational joint, just automatically generates the complete object for being applicable to currently test by demand
Test cases solves the problems, such as existing test cases generating process labor intensive cost, realizes automatic based on testing requirement
The effect for generating test cases, reduces the consumption of human cost, and then improve testing efficiency.
Embodiment two
Fig. 2 is the flow chart of test cases generation method provided by Embodiment 2 of the present invention, and the present embodiment is in above-mentioned reality
Further progress optimizes and extends on the basis of applying example.As shown in Fig. 2, this method may include:
S210, the testing requirement document based on acquisition, at least one test cases type that identification test process is related to.
S220, according at least one test cases type, determine each test cases type in test cases library whether
There are the corresponding sub- cases of test.
Foundation is in the type matching in test cases library as a result, for there are the corresponding sub- cases of test in test cases library
The test cases type of example executes S230;For there is no the test cases of the corresponding sub- case of test in test cases library
Type executes S240.
S230, in test cases library, there are the test cases types of the corresponding sub- case of test, from test cases
The sub- case of test corresponding with the test cases type is extracted in library.
S240, it, there is no the target detection case type of the corresponding sub- case of test, is obtained in test cases library
The test cases segment corresponding with target detection case type of user's input.
I.e. when in test cases library there is no test sub- case accordingly when, just need tester to manually complete test case
The input of example segment.Test cases segment is used to complete the corresponding test subtask of target detection case type.
Optionally, this method further include: store test cases segment into test cases library, and by target detection case
Type is updated in the test cases type in test cases library.By storing user's test cases segment currently entered to survey
It tries that the update to test cases library content and perfect may be implemented in case library, when follow-up test needs same type in the process
Test cases when, can call directly.
S250, test cases segment is spliced with the sub- case of test extracted from test cases library, obtains target
Test cases.
Specifically, can be spliced according to the execution sequence of test cases segment and the sub- case of the test extracted, obtain
Complete test frame, the details for carrying out test frame then in conjunction with testing requirement document adjust, such as test parameter update etc., obtain
To the target detection case for being suitable for currently testing.
The technical solution of the present embodiment identifies at least one test that test process is related to by analysis testing requirement document
Case type;For in test cases library, there are the test cases types of the corresponding sub- case of test, from test cases library
The corresponding sub- case of test is extracted, there is no the target detection cases of the corresponding sub- case of test in test cases library
Example type, obtains the corresponding test cases segment of user's input;By the sub- case of the test of test cases segment and extraction
Rational joint is carried out, the complete object test cases for being suitable for currently testing is obtained, that is, passes through the extraction of the sub- case of partial test
It is combined with being manually entered for partial test case segment, solves asking for existing test cases generating process labor intensive cost
Topic, realizes automatically generating for complete test cases, reduces the consumption of human cost, and then improve testing efficiency;Meanwhile
Test cases fragment update by inputting tester realizes the update of test cases library content into test cases library
With it is perfect, be follow-up test task providing convenience property of execution.
Embodiment three
Fig. 3 is the structural schematic diagram for the test cases generating means that the embodiment of the present invention three provides, and the present embodiment is applicable
In based on testing requirement generate test cases the case where.The device can be realized by the way of software and/or hardware, and can collect
At on the server.
As shown in figure 3, test cases generating means provided in this embodiment may include test cases type identification module
310, sub- case abstraction module 320 and target detection case generation module 330 are tested, in which:
Test cases type identification module 310 identifies what test process was related to for the testing requirement document based on acquisition
At least one test cases type;
Sub- case abstraction module 320 is tested, for being extracted from test cases library according at least one test cases type
Each test cases type is corresponding to test sub- case;
Target detection case generation module 330, for according to testing requirement, the sub- case of each test of extraction to be spelled
It connects, obtains target detection case.
Optionally, test cases type identification module 310 includes:
Keyword extracting unit, for extracting the keyword in the testing requirement document obtained;
Test cases type determining units, for determining at least one test cases that test process is related to according to keyword
Type.
Optionally, target detection case generation module 330 includes:
Sub- case splicing subelement is tested, for according to testing requirement, the sub- case of each test of extraction to be spliced,
Obtain candidate test cases;
Candidate test cases adjustment subelement is adjusted candidate test cases, obtains for the keyword according to extraction
To target detection case.
Optionally, target detection case generation module 330 is specifically used for:
The sub- case of each test based on testing requirement and extraction is corresponding to execute sequence, and each sub- case of test is carried out
Splicing, obtains target detection case.
Optionally, the device further include:
Test cases segment obtains module, for in the test cases library, there is no the corresponding sub- cases of test
Target detection case type, obtain user input test cases segment corresponding with target detection case type;
Correspondingly, target detection case generation module 330 is also used to:
Test cases segment is spliced with the sub- case of test extracted from test cases library, obtains target detection case
Example.
Optionally, the device further include:
Test cases library type update module, for storing test cases segment into test cases library, and by target
Test cases type is updated in the test cases type in test cases library.
Optionally, the device further include:
Target detection case adjustment module, for obtaining user to the review result of target detection case, and based on evaluation
As a result target detection case is adjusted.
Survey provided by any embodiment of the invention can be performed in test cases generating means provided by the embodiment of the present invention
Case generation method is tried, has the corresponding functional module of execution method and beneficial effect.Not detailed description is interior in the present embodiment
Holding can be with reference to the description in embodiment of the present invention method.
Example IV
Fig. 4 is a kind of structural schematic diagram for server that the embodiment of the present invention four provides.Fig. 4, which is shown, to be suitable for being used to realizing
The block diagram of the exemplary servers 412 of embodiment of the present invention.The server 412 that Fig. 4 is shown is only an example, should not be right
The function and use scope of the embodiment of the present invention bring any restrictions.
As shown in figure 4, server 412 is showed in the form of generic server.The component of server 412 may include but not
Be limited to: one or more processor 416, storage device 428 connect different system components (including storage device 428 and processing
Device 416) bus 418.
Bus 418 indicates one of a few class bus structures or a variety of, including storage device bus or storage device control
Device processed, peripheral bus, graphics acceleration port, processor or total using the local of any bus structures in a variety of bus structures
Line.For example, these architectures include but is not limited to industry standard architecture (Industry Subversive
Alliance, ISA) bus, microchannel architecture (Micro Channel Architecture, MAC) bus is enhanced
Isa bus, Video Electronics Standards Association (Video Electronics Standards Association, VESA) local are total
Line and peripheral component interconnection (Peripheral Component Interconnect, PCI) bus.
Server 412 typically comprises a variety of computer system readable media.These media can be it is any being capable of bedding and clothing
The usable medium that business device 412 accesses, including volatile and non-volatile media, moveable and immovable medium.
Storage device 428 may include the computer system readable media of form of volatile memory, such as arbitrary access
Memory (Random Access Memory, RAM) 430 and/or cache memory 432.Server 412 can be further
Including other removable/nonremovable, volatile/non-volatile computer system storage mediums.Only as an example, storage system
System 434 can be used for reading and writing immovable, non-volatile magnetic media (Fig. 4 do not show, commonly referred to as " hard disk drive ").To the greatest extent
It is not shown in pipe Fig. 4, the disc driver for reading and writing to removable non-volatile magnetic disk (such as " floppy disk ") can be provided, with
And to removable anonvolatile optical disk, such as CD-ROM (Compact Disc Read-Only Memory, CD-ROM), number
Word optic disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical mediums) read-write CD
Driver.In these cases, each driver can be connected by one or more data media interfaces with bus 418.
Storage device 428 may include at least one program product, which has one group of (for example, at least one) program module,
These program modules are configured to perform the function of various embodiments of the present invention.
Program/utility 440 with one group of (at least one) program module 442 can store in such as storage dress
It sets in 428, such program module 442 includes but is not limited to operating system, one or more application program, other program moulds
It may include the realization of network environment in block and program data, each of these examples or certain combination.Program module
442 usually execute function and/or method in embodiment described in the invention.
Server 412 can also be with one or more external equipments 414 (such as keyboard, direction terminal, display 424 etc.)
Communication, can also be enabled a user to one or more terminal interact with the server 412 communicate, and/or with make the clothes
Any terminal (such as network interface card, modem etc.) that business device 412 can be communicated with one or more of the other computing terminal
Communication.This communication can be carried out by input/output (I/O) interface 422.Also, server 412 can also be suitable by network
Orchestration 420 and one or more network (such as local area network (Local Area Network, LAN), wide area network (Wide Area
Network, WAN) and/or public network, such as internet) communication.As shown in figure 4, network adapter 420 passes through bus 418
It is communicated with other modules of server 412.It should be understood that although not shown in the drawings, can be used in conjunction with server 412 other hard
Part and/or software module, including but not limited to: microcode, terminal driver, redundant processor, external disk drive array, magnetic
Disk array (Redundant Arrays of Independent Disks, RAID) system, tape drive and data backup
Storage system etc..
The program that processor 416 is stored in storage device 428 by operation, thereby executing various function application and number
According to processing, such as realize test cases generation method provided by any embodiment of the invention, this method may include:
Testing requirement document based on acquisition, at least one test cases type that identification test process is related to;
According at least one described test cases type, it is corresponding that each test cases type is extracted from test cases library
Test sub- case;
According to testing requirement, the sub- case of each test of extraction is spliced, target detection case is obtained.
Embodiment five
The embodiment of the present invention five additionally provides a kind of computer readable storage medium, is stored thereon with computer program, should
Realize that such as test cases generation method provided by any embodiment of the invention, this method can wrap when program is executed by processor
It includes:
Testing requirement document based on acquisition, at least one test cases type that identification test process is related to;
According at least one described test cases type, it is corresponding that each test cases type is extracted from test cases library
Test sub- case;
According to testing requirement, the sub- case of each test of extraction is spliced, target detection case is obtained.
The computer storage medium of the embodiment of the present invention, can be using any of one or more computer-readable media
Combination.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readable
Storage medium for example may be-but not limited to-the system of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, device or
Device, or any above combination.The more specific example (non exhaustive list) of computer readable storage medium includes: tool
There are electrical connection, the portable computer diskette, hard disk, random access memory (RAM), read-only memory of one or more conducting wires
(ROM), erasable programmable read only memory (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 this document, computer-readable storage
Medium can be any tangible medium for including or store program, which can be commanded execution system, device or device
Using or it is in connection.
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.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited
In wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof
Program code, described program design language include object oriented program language-such as Java, Smalltalk, C++,
It further include conventional procedural programming language-such as " C " language or similar programming language.Program code can be with
It fully executes, partly execute on the user computer on the user computer, being executed as an independent software package, portion
Divide and partially executes or executed on remote computer or terminal completely on the remote computer on the user computer.It is relating to
And in the situation of remote computer, remote computer can pass through the network of any kind --- including local area network (LAN) or extensively
Domain net (WAN)-be connected to subscriber computer, or, it may be connected to outer computer (such as provided using Internet service
Quotient is connected by internet).
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that
The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,
It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention
It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also
It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.