CN108268368A - A kind of method and apparatus for generating test case script - Google Patents
A kind of method and apparatus for generating test case script Download PDFInfo
- Publication number
- CN108268368A CN108268368A CN201611259648.6A CN201611259648A CN108268368A CN 108268368 A CN108268368 A CN 108268368A CN 201611259648 A CN201611259648 A CN 201611259648A CN 108268368 A CN108268368 A CN 108268368A
- Authority
- CN
- China
- Prior art keywords
- script
- annotation
- word frequency
- frequency vector
- recalls information
- 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.)
- Withdrawn
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present invention provides a kind of method and apparatus for generating test case script, this method includes:The recalls information for call unit function script is obtained, wherein, which includes scripted code and the script annotation for execution unit functional test;Selection unit function script is annotated according to the script of the corresponding maximum probability of the recalls information, the Elementary Function script of selection is assembled into test case script;Application program to be measured is tested using the test case script.The matching of Elementary Function script corresponding with Elementary Function script bank achievees the purpose that the natural language recognition inputted to tester after word segmentation processing by inputting text string to tester, the requirement of tester's code capacity is reduced, automatic test field is solved and does not meet the technical issues of tester's natural language is accustomed to, is high to tester's program capability requirement in the prior art.
Description
Technical field
The present invention relates to communication and computer realm, more particularly to a kind of method and apparatus for generating test case script.
Background technology
Automatic test has developed into more and more important means of testing because improving testing efficiency.But to test
The certain code development ability of personnel requirement, generalization ability is poor, and test case needs to develop again after sending variation, in order to subtract
The burden of light code development, needs a kind of method and system of Code automatic build.The prior art writes rule by formulating use-case
Model reaches appeal purpose including keyword definition, template definition, but tester is also required to need in strict accordance with design simultaneously
Specification writes test case, by inputting the test case of certain format generates test script.For example, by the way that test is allowed to use
The operational order of example is named with keyword in keyword and code mapping table, and use-case needs are write according to keyword to design.Or
Person, user will be according to certain format input test use-case files, for example, including at least template ID, message in test case file
Code.The prior art has strict requirements to case designing and description, needs to be grasped case designing specification, tester is proposed
New requirement, simultaneously as the limitation of case designing requirement, using underaction, does not meet the characteristic of Human Natural Language, also
Because application scenarios are fairly simple, field complicated and changeable can not be applied to, particularly there is more complicated logic business and scene,
Need different input parameters, requirement on flexibility higher.
Therefore, it does not meet tester's natural language custom for the prior art, develop during automatic test cases
The technical issues of interface of checking storehouse is more, and automatic test development efficiency is low, and ease for use is poor are currently without solution.
Invention content
The present invention provides a kind of method and apparatus for generating test case script therefore, not to be inconsistent for the prior art at least
The interface of checking storehouse is more during conjunction tester natural language custom, exploitation automatic test cases, automatic test exploitation effect
The technical issues of rate is low, and ease for use is poor.
One aspect of the present invention provides a kind of method for generating test case script, including:It obtains for call unit work(
The recalls information of energy script, wherein, which includes the scripted code and foot for execution unit functional test
This annotation;Selection unit function script is annotated according to the script of the corresponding maximum probability of the recalls information, by the unit of selection
Function script is assembled into test case script;Application program to be measured is tested using the test case script.
Further, it obtains and includes for the recalls information of call unit function script:The text string of natural language is obtained,
Word segmentation processing is carried out to text string and obtains multiple participles.
Further, script annotation is multiple participles, the wherein participle and the script generation of the execution unit functional test
The Elementary Function of code is corresponding.
Further, selection unit function script is annotated according to the script of the corresponding maximum probability of the recalls information to include:
The script annotation of an Elementary Function script is obtained, by multiple participles in the recalls information and multiple participles of script annotation
Composition participle set;The frequency that each participle according to the recalls information occurs in the participle set maps the recalls information
To call word frequency vector, the frequency that each participle annotated according to the script occurs in the participle set reflects script annotation
It penetrates as annotation word frequency vector;The calling of the Elementary Function script is calculated according to the calling word frequency vector sum annotation word frequency vector
Similarity value between word frequency vector and the annotation word frequency vector, according to the similarity value selection unit function foot calculated
This.
Further, the calling of the Elementary Function script is calculated according to the calling word frequency vector sum annotation word frequency vector
Similarity value between word frequency vector and the annotation word frequency vector includes:Calculating the calling word frequency vector sum according to the cosine law should
The cosine value of word frequency vector is annotated, and the similarity value is generated according to the cosine value.
Further, included according to the similarity value selection unit function script calculated:Choose maximum similarity value
Corresponding Elementary Function script, wherein, which is more than preset threshold value.
Another aspect of the present invention additionally provides a kind of device for generating test case script, including:Acquisition module, for obtaining
It takes in the recalls information of call unit function script, wherein, which is included for execution unit functional test
Scripted code and script annotation;Assembling module selects for being annotated according to the script of the corresponding maximum probability of the recalls information
Elementary Function script is taken, the Elementary Function script of selection is assembled into test case script;Test module, for using the survey
Case script on probation tests application program to be measured.
Further, which includes:Receiving unit, for obtaining the text string of natural language;Participle unit is used
Multiple participles are obtained in carrying out word segmentation processing to text string.
Further, the assembling module module, including:Extraction unit, for obtaining the script of an Elementary Function script
Annotation, by multiple participles composition participle set of multiple participles in the recalls information and script annotation;Computing unit is used for
The frequency that each participle according to the recalls information occurs in the participle set by the recalls information be mapped as call word frequency to
Script annotation is mapped as annotation word frequency by amount, the frequency that each participle annotated according to the script occurs in the participle set
Vector, according to the calling word frequency vector sum, the annotation word frequency vector calculates the calling word frequency vector of the Elementary Function script with being somebody's turn to do
Annotate the similarity value between word frequency vector, selecting unit, according to the similarity value selection unit function script calculated.
The present invention relates to a kind of method for generating test case script, by being inputted at the participle of text string to tester
The matching of Elementary Function script corresponding with Elementary Function script bank, which reaches, after reason knows the natural language that tester inputs
Other purpose reduces the requirement of tester's code capacity, solves automatic test field and does not meet survey in the prior art
Examination personnel natural language custom requires the technical issues of high to tester's program capability.
Description of the drawings
Fig. 1 is a kind of logical flow chart of the method for generation test case script according to embodiments of the present invention;
Fig. 2 is the embodiment of the present invention according to the script of the corresponding maximum probability of recalls information annotation selection unit function
The logical flow chart of script;
Fig. 3 is a kind of device of generation test case script of the embodiment of the present invention;
Specific embodiment
Come that the present invention will be described in detail below with reference to attached drawing and in conjunction with the embodiments.It should be noted that do not conflicting
In the case of, the feature in embodiment and embodiment in the application can be combined with each other.
It should be noted that term " first " in description and claims of this specification and above-mentioned attached drawing, "
Two " it is etc. the object for distinguishing similar, specific sequence or precedence is described without being used for.
An embodiment of the present invention provides a kind of methods for generating test case script, and Fig. 1 is according to embodiments of the present invention
A kind of logical flow chart for the method for generating test case script, as shown in Figure 1, this method includes three steps,
S101 obtains the recalls information for call unit function script, wherein, which includes holding
The scripted code of row Elementary Function test and script annotation;
S102 annotates selection unit function script according to the script of the corresponding maximum probability of the recalls information, by being somebody's turn to do for selection
Elementary Function script is assembled into test case script;
S103 tests application program to be measured using the test case script.
Further, it obtains and includes for the recalls information of call unit function script:The text string of natural language is obtained,
Word segmentation processing is carried out to text string and obtains multiple participles.
Further, script annotation is multiple participles, the wherein participle and the script generation of the execution unit functional test
The Elementary Function of code is corresponding.
The text string for the natural language that the present invention inputs the tester of acquisition carries out word segmentation processing, obtains tester
Then the recalls information of input searches for the script of maximum probability corresponding with recalls information using the recalls information from database
A series of annotation, using the one-to-one relationship extraction unit function script of script annotation and Elementary Function script, by the of extraction
Elementary Function script is assemblied into test case script and is tested, and the present invention passes through natural language call unit function script, solution
Determined calling interface unnatural language in the prior art the technical issues of, tester no longer needs to have comparable program editing
Ability just can write automatic test cases according to the actual conditions of test object, and reduce automatic test uses threshold,
Improve testing efficiency.
Fig. 2 is the embodiment of the present invention according to the script of the corresponding maximum probability of recalls information annotation selection unit function
The logical flow chart of script, as shown in Fig. 2, selecting step includes 3 steps:
S201:The script annotation of an Elementary Function script is obtained, by multiple participles in the recalls information and the script
Multiple participles composition participle set of annotation;
S202:The frequency that each participle according to the recalls information occurs in the participle set maps the recalls information
To call word frequency vector, the frequency that each participle annotated according to the script occurs in the participle set reflects script annotation
It penetrates as annotation word frequency vector;
S203:The calling word frequency of the Elementary Function script is calculated according to the calling word frequency vector sum annotation word frequency vector
Similarity value between vector and the annotation word frequency vector, according to the similarity value selection unit function script calculated.
The present invention mainly uses word frequency vector sum to annotate word frequency vector calculating acquaintance angle value by exchanging, by knowing each other angle value
Size chooses corresponding Elementary Function script.Acquaintance angle value can calculate the calling word frequency vector sum according to the cosine law to be somebody's turn to do
The cosine value of word frequency vector is annotated, the sine of the two that can also be calculated according to sine is worth to, and can also pass through calculating
Tangent value or cotangent are worth to.
Fig. 3 is a kind of device of generation test case script of the embodiment of the present invention, if Fig. 3 should, including acquisition module 32,
For obtaining the recalls information for call unit function script, wherein, which is included for execution unit work(
It can the scripted code of test and script annotation;Assembling module 34, for the foot according to the corresponding maximum probability of the recalls information
The Elementary Function script of selection is assembled into test case script by this annotation selection unit function script;Test module 33 is used
Application program to be measured is tested in using the test case script.
Further, which includes:Receiving unit, for obtaining the text string of natural language;Participle unit is used
Multiple participles are obtained in carrying out word segmentation processing to text string.
Further, which includes:Extraction unit, for obtaining the script annotation of an Elementary Function script,
By multiple participles composition participle set of multiple participles in the recalls information and script annotation;Computing unit, for according to
The recalls information is mapped as calling word frequency vector by the frequency that each participle of the recalls information occurs in the participle set, presses
Script annotation is mapped as annotation word frequency vector according to the frequency that each participle of script annotation occurs in the participle set,
Calling word frequency vector and the annotation of the Elementary Function script are calculated according to the calling word frequency vector sum annotation word frequency vector
Similarity value between word frequency vector, selecting unit, according to the similarity value selection unit function script calculated.
As the preferred embodiment of the present invention, further explaination is done to a kind of device for generating test case script below.
A testing procedure in tester's input test use-case:Create a DHCP wan connection.
The script annotation that storage has Elementary Function script in database is followed successively by:Create DS-Lite tunnels;LAN1 is broadcast port
Put multicast data flow;Create DHCP wan connections;Create PPPoE wan connections;
Set similarity threshold as:0.8
S401:It is by user's input information word segmentation result according to participle dictionary:Create/mono-/DHCP/Wan/ connections;Use X
Mark;
First Elementary Function script script annotation is taken out in S402 databases:Establishment/DS-Lite/ tunnels, is represented with Y;
S403:The word combination result of x and y is (being represented with z):/ mono-/DHCP/DS-Lite/Wan/ of establishment connections/
Tunnel };
S404:The frequency that the vocabulary in z occurs in x is calculated, if not occurring representing with 0, result is:
It creates:
X is mapped as multi-C vector to be expressed as and (representing with α):
S405:The frequency that the vocabulary in z occurs in y is calculated, if not occurring representing with 0, result is:One=0;DHCP=0;Wan=0;Connection=0;
Y is mapped as multi-C vector to be expressed as and (representing with β):
S406:The cosine value for calculating two vectors α, β is (being represented with γ):0.258, which is exactly similarity.
S407:Entry all in ergodic data library according to the method described above calculates cosine value, is as a result respectively:0.258、
0、0.894、0.67。
S408:Scripted code of the similarity corresponding to 0.894 is returned according to similarity result, as " creates DHCP
Wan connection " corresponding scripted codes.
Those skilled in the art should be understood that each module of the above-mentioned present invention or each step can use general calculating
Device realizes that they can concentrate on single computing device or be distributed in the network that multiple computing devices are formed
On, optionally, they can be realized with the program code that computing device can perform, it is thus possible to be stored in storage
It is performed, and in some cases, can perform shown with the sequence being different from herein or retouched by computing device in device
They are either fabricated to each integrated circuit modules or by the multiple modules or step system in them by the step of stating respectively
Single integrated circuit module is made to realize.It to be combined in this way, the present invention is not limited to any specific hardware and softwares.
It these are only the preferred embodiment of the present invention, be not intended to restrict the invention, for those skilled in the art
For member, the invention may be variously modified and varied.Any modification for all within the spirits and principles of the present invention, being made,
Equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.
Claims (9)
- A kind of 1. method for generating test case script, which is characterized in that including:The recalls information for call unit function script is obtained, wherein, the Elementary Function script is included for execution unit Scripted code and the script annotation of functional test;Selection unit function script is annotated according to the script of the corresponding maximum probability of the recalls information, by the unit of selection Function script is assembled into test case script;Application program to be measured is tested using the test case script.
- 2. according to the method described in claim 1, it is characterized in that, obtain the recalls information packet for call unit function script It includes:The text string of natural language is obtained, carrying out word segmentation processing to the text string obtains multiple participles.
- 3. according to the method described in claim 2, it is characterized in that, script annotation is multiple participles, wherein the participle It is corresponding with the Elementary Function of the scripted code of the execution unit functional test.
- 4. according to the method described in claim 3, it is characterized in that, script according to the corresponding maximum probability of the recalls information Annotation selection unit function script includes:The script annotation of an Elementary Function script is obtained, multiple participles in the recalls information and the script are annotated Multiple participle composition participle set;The recalls information is mapped as by the frequency that each participle according to the recalls information occurs in the participle set Word frequency vector is called, the frequency occurred in the participle set according to each participle of script annotation notes the script It releases and is mapped as annotation word frequency vector;The calling word frequency of the Elementary Function script is calculated according to annotation word frequency vector described in the calling word frequency vector sum The vectorial similarity value between the annotation word frequency vector, according to the similarity value selection unit function foot calculated This.
- 5. according to the method described in claim 4, it is characterized in that, according to it is described calling word frequency vector sum described in annotation word frequency to The similarity value that amount is calculated between the calling word frequency vector of the Elementary Function script and the annotation word frequency vector includes:The cosine value of word frequency vector is annotated according to the cosine law calculates the calling word frequency vector sum, and according to the cosine Value generates the similarity value.
- 6. according to the method described in claim 5, it is characterized in that, according to the similarity value selection unit function of calculating Script includes:The corresponding Elementary Function script of maximum similarity value is chosen, wherein, the maximum similarity value is more than preset threshold Value.
- 7. a kind of device for generating test case script, which is characterized in that including:Acquisition module, for obtaining the recalls information for call unit function script, wherein, the Elementary Function script includes It is annotated for the scripted code and script of execution unit functional test;Assembling module, will for annotating selection unit function script according to the script of the corresponding maximum probability of the recalls information The Elementary Function script chosen is assembled into test case script;Test module, for being tested using the test case script application program to be measured.
- 8. device according to claim 7, which is characterized in that the acquisition module includes:Receiving unit, for obtaining the text string of natural language;Participle unit obtains multiple participles for carrying out word segmentation processing to the text string.
- 9. device according to claim 7, which is characterized in that the assembling module, including:Extraction unit, for obtaining the script of Elementary Function script annotation, by multiple participles in the recalls information with Multiple participles composition participle set of the script annotation;Computing unit, for according to each participle of the recalls information in the participle set frequency that occurs by the tune It is to call word frequency vector with information MAP, the frequency occurred in the participle set according to each participle of script annotation Script annotation is mapped as annotation word frequency vector, institute is calculated according to annotation word frequency vector described in the calling word frequency vector sum State the similarity value between the calling word frequency vector of Elementary Function script and the annotation word frequency vector, selecting unit, root According to the similarity value selection unit function script calculated.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611259648.6A CN108268368A (en) | 2016-12-30 | 2016-12-30 | A kind of method and apparatus for generating test case script |
PCT/CN2017/118639 WO2018121531A1 (en) | 2016-12-30 | 2017-12-26 | Method and apparatus for generating test case script |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611259648.6A CN108268368A (en) | 2016-12-30 | 2016-12-30 | A kind of method and apparatus for generating test case script |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108268368A true CN108268368A (en) | 2018-07-10 |
Family
ID=62710904
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611259648.6A Withdrawn CN108268368A (en) | 2016-12-30 | 2016-12-30 | A kind of method and apparatus for generating test case script |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108268368A (en) |
WO (1) | WO2018121531A1 (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109688599A (en) * | 2019-01-11 | 2019-04-26 | 北京华力创通科技股份有限公司 | Terminal tester packet domain dispatching method and device |
CN109818833A (en) * | 2019-03-14 | 2019-05-28 | 北京信而泰科技股份有限公司 | A kind of ethernet test system and ethernet test method |
CN110245088A (en) * | 2019-06-21 | 2019-09-17 | 四川长虹电器股份有限公司 | A kind of defect automated verification system and verification method based on Jenkins |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109766274B (en) * | 2018-12-28 | 2022-03-15 | 河南思维轨道交通技术研究院有限公司 | Test script automatic fusion method and storage medium |
CN110221965B (en) * | 2019-05-09 | 2023-01-20 | 创新先进技术有限公司 | Test case generation method, test case generation device, test case testing method, test case testing device, test equipment and test system |
CN110879785B (en) * | 2019-11-25 | 2023-05-30 | 斑马网络技术有限公司 | Method for generating interface test scene set |
CN111078202A (en) * | 2019-12-06 | 2020-04-28 | 中国工商银行股份有限公司 | Service architecture model maintenance method, device, electronic equipment and medium |
CN112365902B (en) * | 2020-10-16 | 2024-07-05 | 科大讯飞股份有限公司 | Test method of voice processing system, related equipment and storage device |
CN112506756B (en) * | 2020-11-11 | 2023-06-06 | 东风汽车集团有限公司 | Method and device for generating test case script of vehicle controller |
CN116155788B (en) * | 2023-04-19 | 2023-06-20 | 鹏城实验室 | Network security testing method, device, equipment and readable storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104932980B (en) * | 2015-06-30 | 2018-10-23 | 北京奇虎科技有限公司 | Software automatic testing method and device |
CN105068929B (en) * | 2015-08-06 | 2018-02-13 | 网易(杭州)网络有限公司 | Test script generation method and device, method of testing, test device and test system |
CN105608012A (en) * | 2016-03-10 | 2016-05-25 | 武汉斗鱼网络科技有限公司 | Automatic test method and automatic test system |
-
2016
- 2016-12-30 CN CN201611259648.6A patent/CN108268368A/en not_active Withdrawn
-
2017
- 2017-12-26 WO PCT/CN2017/118639 patent/WO2018121531A1/en active Application Filing
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109688599A (en) * | 2019-01-11 | 2019-04-26 | 北京华力创通科技股份有限公司 | Terminal tester packet domain dispatching method and device |
CN109818833A (en) * | 2019-03-14 | 2019-05-28 | 北京信而泰科技股份有限公司 | A kind of ethernet test system and ethernet test method |
CN109818833B (en) * | 2019-03-14 | 2021-08-17 | 北京信而泰科技股份有限公司 | Ethernet test system and Ethernet test method |
CN110245088A (en) * | 2019-06-21 | 2019-09-17 | 四川长虹电器股份有限公司 | A kind of defect automated verification system and verification method based on Jenkins |
CN110245088B (en) * | 2019-06-21 | 2022-10-18 | 四川长虹电器股份有限公司 | Jenkins-based automatic defect verification system and verification method |
Also Published As
Publication number | Publication date |
---|---|
WO2018121531A1 (en) | 2018-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108268368A (en) | A kind of method and apparatus for generating test case script | |
Hao et al. | An end-to-end model for question answering over knowledge base with cross-attention combining global knowledge | |
CN106874256A (en) | Name the method and device of entity in identification field | |
CN110287480A (en) | A kind of name entity recognition method, device, storage medium and terminal device | |
WO2021151270A1 (en) | Method and apparatus for extracting structured data from image, and device and storage medium | |
CN108154198B (en) | Knowledge base entity normalization method, system, terminal and computer readable storage medium | |
CN107885874A (en) | Data query method and apparatus, computer equipment and computer-readable recording medium | |
US11403286B2 (en) | Bridge from natural language processing engine to database engine | |
CN107451175A (en) | A kind of data processing method and equipment based on block chain | |
CN107357772A (en) | List filling method, device and computer equipment | |
CN109147767A (en) | Digit recognition method, device, computer equipment and storage medium in voice | |
CN109558525A (en) | A kind of generation method of test data set, device, equipment and storage medium | |
EP3855353A2 (en) | Image table extraction method and apparatus, electronic device, and storage medium | |
CN110619050B (en) | Intention recognition method and device | |
CN111783422B (en) | Text sequence generation method, device, equipment and medium | |
CN107221328A (en) | The localization method and device in modification source, computer equipment and computer-readable recording medium | |
KR102634484B1 (en) | A method, a device, an electronic equipment and a storage medium for extracting information | |
CN111026815B (en) | Entity pair specific relation extraction method based on user-assisted correction | |
CN108255602A (en) | Task combined method and terminal device | |
CN113961768B (en) | Sensitive word detection method and device, computer equipment and storage medium | |
CN110362476A (en) | Verification method, device, computer equipment and the storage medium of data conversion tools | |
CN113434542B (en) | Data relationship identification method and device, electronic equipment and storage medium | |
CN103473243B (en) | The method and apparatus of generative semantics network service document | |
EP3945431A1 (en) | Bridge from natural language processing engine to database engine | |
Bisht et al. | Exploring practical deep learning approaches for English-to-Hindi image caption translation using transformers and object detectors |
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 | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20180710 |