CN109885498A - A kind of test script generation method and system - Google Patents
A kind of test script generation method and system Download PDFInfo
- Publication number
- CN109885498A CN109885498A CN201910140512.0A CN201910140512A CN109885498A CN 109885498 A CN109885498 A CN 109885498A CN 201910140512 A CN201910140512 A CN 201910140512A CN 109885498 A CN109885498 A CN 109885498A
- Authority
- CN
- China
- Prior art keywords
- script
- test
- test case
- message
- jmeter
- 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
- 238000012360 testing method Methods 0.000 title claims abstract description 113
- 238000013515 script Methods 0.000 title claims abstract description 109
- 238000000034 method Methods 0.000 title claims abstract description 35
- 239000002131 composite material Substances 0.000 claims description 7
- 230000004044 response Effects 0.000 claims description 6
- 238000005516 engineering process Methods 0.000 abstract description 4
- 238000012423 maintenance Methods 0.000 abstract description 4
- 238000013522 software testing Methods 0.000 abstract description 2
- 230000000875 corresponding effect Effects 0.000 description 26
- 238000003860 storage Methods 0.000 description 10
- 238000004590 computer program Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 5
- 230000008859 change Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000007547 defect Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000002596 correlated effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Test script generation method and system disclosed by the invention, it is related to software testing technology field, by creating JMeter script, generate initial JMeter script, each test case is read one by one and obtains the title of each test case, according to the title of each test case, the type of each test case is judged respectively, according to the type, corresponding message is added in the corresponding script of each test case, it arranges and combines the corresponding script of each test case, generate script interface data, initial JMeter script is written into script interface data, generate test script, reduce the testing time, it reduces maintenance cost and improves integrated testability efficiency.
Description
Technical field
The present invention relates to software testing technology fields, and in particular to a kind of test script generation method and system.
Background technique
With the fast development of Internet company, server end version iteration speed is accelerated, and measuring technology is caused to be also required to
Constantly adjustment and optimization therewith.
At this stage mainly by interface testing come the problem of finding server end.Currently common basic skills be using
EXCEL or professional interface management tool (Ru Chandao, TestLink) preservation, management of test cases, are compiled according to test case later
Write test script.
Above-mentioned interface testing scheme is primarily present following defect:
(1) test case write and JMeter script accounts for 80% or more of entire interface testing duration, write that time-consuming
And repeatability is high;
(2) test case is separated with JMeter script, need to be adjusted simultaneously when business being caused to change test case and
JMeter script, if only maintenance one easily causes confusion.
(3) it sustainable can not be integrated when server end express delivery iteration, be unable to satisfy the demand of quickly hair version.
Summary of the invention
In view of the defects existing in the prior art, the embodiment of the invention provides a kind of test script generation method and systems.
In a first aspect, the embodiment of the invention provides a kind of test script generation methods, method includes the following steps:
JMeter script is created, initial JMeter script is generated;
Each test case is read one by one and obtains the title of each test case;
According to the title of each test case, the type of each test case is judged respectively, according to the type, each
Corresponding message is added in the corresponding script of test case, comprising:
If the type is configuration class, configuration message is added in the corresponding script of corresponding test case;If described
Type is HTTP request class, then adds HTTP request message in the corresponding script of corresponding test case and report is asserted in response
Text, wherein configuration message is one of HTTP default request message or user's custom parameter, and HTTP request message includes asking
Ask path, server ip, server end slogan and order parameter;
The corresponding script of each test case is arranged and combined, script interface data are generated;
The initial JMeter script is written into the script interface data, generates the first test script.
Further, after generating the first test script, the method also includes:
First test script and Jenkins module are combined, the second test script is generated.
Second aspect, the embodiment of the invention provides a kind of test scripts to generate system, which includes:
Creation module generates initial JMeter script for creating JMeter script;
Module is obtained, for reading each test case one by one and obtaining the title of each test case;
Judgment module judges the type of each test case for the title according to each test case respectively, according to institute
Type is stated, adds corresponding message in the corresponding script of each test case, wherein the judgment module includes that addition is single
Member, the adding unit are used for:
Configuration message or HTTP request message are added in the corresponding script of test case and message is asserted in response;Wherein,
Configuration message be one of HTTP default request message or user's custom parameter, HTTP request message include request path,
Server ip, server end slogan and order parameter;
Composite module generates script interface data for arranging and combining the corresponding script of each test case;
Writing module generates the first test foot for the initial JMeter script to be written in the script interface data
This.
Further, the composite module is also used to:
First test script and Jenkins module are combined, the second test script is generated.
Test script generation method and system provided in an embodiment of the present invention, have the advantages that
(1) test case only need to be write, without writing JMeter script, reduces the testing time;
(2) test case need to be only modified when interface changes, and test case is converted into JMeter using tool later
Script reduces maintenance cost;
(3) it is used in combination with Jenkins, realizes continuous integrating, improve integrated testability efficiency.
Detailed description of the invention
Fig. 1 is the flow diagram of test script generation method disclosed by the embodiments of the present invention;
Fig. 2 is the structural schematic diagram that test script disclosed by the embodiments of the present invention generates system.
Specific embodiment
Specific introduce is made to the present invention below in conjunction with the drawings and specific embodiments.
As shown in Figure 1, test script generation method provided in an embodiment of the present invention the following steps are included:
S101 creates JMeter script, generates initial JMeter script.
S102 reads each test case one by one and obtains the title of each test case.
S103 judges the type of each test case according to the title of each test case respectively, according to the type,
Corresponding message is added in the corresponding script of each test case, comprising:
S1031 adds configuration if the type of test case is configuration class in the corresponding script of corresponding test case
Message, wherein configuration message is one of HTTP default request message or user's custom parameter;
As a specific embodiment, HTTP default request message includes the enabling of HTTP default request and does not enable letter
Breath, server ip and server end slogan.
S1032 is added in the corresponding script of corresponding test case if the type of test case is HTTP request class
Message is asserted in HTTP request message and response, wherein HTTP request message includes request path, server ip, Service-Port
Number and order parameter.
S104 arranges and combines the corresponding script of each test case, generates script interface data.
Script interface data are written initial JMeter script, generate the first test script by S105.
Optionally, this method further include:
The first test script and Jenkins module are combined, the second test script is generated.
As shown in Fig. 2, test script generation method provided in an embodiment of the present invention includes creation module, obtains module, sentences
Disconnected module, composite module and writing module, in which:
Creation module generates initial JMeter script for creating JMeter script;
Module is obtained, for reading each test case one by one and obtaining the title of each test case;
Judgment module judges the type of each test case, according to this for the title according to each test case respectively
Type adds corresponding message in the corresponding script of each test case, wherein and the judgment module includes adding unit,
Adding unit is used for:
Configuration message or HTTP request message are added in the corresponding script of test case and message is asserted in response;Wherein,
Configuration message be one of HTTP default request message or user's custom parameter, HTTP request message include request path,
Server ip, server end slogan and order parameter;
Composite module generates script interface data for arranging and combining the corresponding script of each test case;
Writing module generates the first test script for initial JMeter script to be written in script interface data.
Optionally, composite module is also used to:
The first test script and Jenkins block combiner are combined, the second test script is generated.
Test script generation method and system provided in an embodiment of the present invention are generated initial by creating JMeter script
JMeter script reads each test case and obtains the title of each test case, one by one according to the name of each test case
Claim, judge the type of each test case respectively, according to the type, is added in the corresponding script of each test case corresponding
Message arranges and combines the corresponding script of each test case, generates script interface data, script interface data is written initial
JMeter script generates test script, reduces the testing time, reduces maintenance cost and improve integrated testability efficiency.
It is understood that the correlated characteristic in the above method and device can be referred to mutually.In addition, in above-described embodiment
" first ", " second " etc. be and not represent the superiority and inferiority of each embodiment for distinguishing each embodiment.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein.
Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system
Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various
Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In addition, memory may include the non-volatile memory in computer-readable medium, random access memory
(RAM) and/or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM), memory includes extremely
A few storage chip.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/
Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable Jie
The example of matter.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including element
There is also other identical elements in process, method, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can provide as method, system or computer program product.
Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the application
Form.It is deposited moreover, the application can be used to can be used in the computer that one or more wherein includes computer usable program code
The shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.
The above is only embodiments herein, are not intended to limit this application.To those skilled in the art,
Various changes and changes are possible in this application.It is all within the spirit and principles of the present application made by any modification, equivalent replacement,
Improve etc., it should be included within the scope of the claims of this application.
It should be noted that the above embodiments do not limit the invention in any form, it is all to use equivalent replacement or equivalent change
The mode changed technical solution obtained, falls within the scope of protection of the present invention.
Claims (4)
1. a kind of test script generation method characterized by comprising
JMeter script is created, initial JMeter script is generated;
Each test case is read one by one and obtains the title of each test case;
According to the title of each test case, the type of each test case is judged respectively, according to the type, in each test
Corresponding message is added in the corresponding script of use-case, comprising:
If the type is configuration class, configuration message is added in the corresponding script of corresponding test case;If the type
For HTTP request class, then HTTP request message is added in the corresponding script of corresponding test case and message is asserted in response,
In, configuration message is one of HTTP default request message or user's custom parameter, and HTTP request message includes request road
Diameter, server ip, server end slogan and order parameter;
The corresponding script of each test case is arranged and combined, script interface data are generated;
The initial JMeter script is written into the script interface data, generates the first test script.
2. test script generation method according to claim 1, which is characterized in that after generating the first test script,
The method also includes:
First test script and Jenkins module are combined, the second test script is generated.
3. a kind of test script generates system characterized by comprising
Creation module generates initial JMeter script for creating JMeter script;
Module is obtained, for reading each test case one by one and obtaining the title of each test case;
Judgment module judges the type of each test case for the title according to each test case respectively, according to the class
Type adds corresponding message in the corresponding script of each test case, wherein the judgment module includes adding unit, institute
Adding unit is stated to be used for:
Configuration message or HTTP request message are added in the corresponding script of test case and message is asserted in response;Wherein, it configures
Message is one of HTTP default request message or user's custom parameter, and HTTP request message includes request path, service
Device IP, server end slogan and order parameter;
Composite module generates script interface data for arranging and combining the corresponding script of each test case;
Writing module generates the first test script for the initial JMeter script to be written in the script interface data.
4. test script according to claim 3 generates system, which is characterized in that the composite module is also used to:
First test script and Jenkins block combiner are combined, the second test script is generated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910140512.0A CN109885498A (en) | 2019-02-26 | 2019-02-26 | A kind of test script generation method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910140512.0A CN109885498A (en) | 2019-02-26 | 2019-02-26 | A kind of test script generation method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109885498A true CN109885498A (en) | 2019-06-14 |
Family
ID=66929216
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910140512.0A Pending CN109885498A (en) | 2019-02-26 | 2019-02-26 | A kind of test script generation method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109885498A (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104484269A (en) * | 2014-11-27 | 2015-04-01 | 北京广利核***工程有限公司 | Method for automatically generating testing script |
US20180024914A1 (en) * | 2016-07-20 | 2018-01-25 | International Business Machines Corporation | Generating test scripts for testing a network-based application |
CN108334443A (en) * | 2017-12-22 | 2018-07-27 | 海尔优家智能科技(北京)有限公司 | Generate method, apparatus, equipment and the computer readable storage medium of test case |
CN108415832A (en) * | 2018-02-07 | 2018-08-17 | 平安科技(深圳)有限公司 | Automatic interface testing method, device, equipment and storage medium |
CN108459850A (en) * | 2017-11-21 | 2018-08-28 | 广州视源电子科技股份有限公司 | method, device and system for generating test script |
CN108763084A (en) * | 2018-05-30 | 2018-11-06 | 郑州云海信息技术有限公司 | A kind of generation method of test case, device and electronic equipment |
CN109299017A (en) * | 2018-11-16 | 2019-02-01 | 郑州云海信息技术有限公司 | The method and system of test script frame are automatically generated based on test case document |
CN109344076A (en) * | 2018-10-22 | 2019-02-15 | 浙江执御信息技术有限公司 | A kind of automatic interface testing method and its device based on JMeter and Jenkins |
-
2019
- 2019-02-26 CN CN201910140512.0A patent/CN109885498A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104484269A (en) * | 2014-11-27 | 2015-04-01 | 北京广利核***工程有限公司 | Method for automatically generating testing script |
US20180024914A1 (en) * | 2016-07-20 | 2018-01-25 | International Business Machines Corporation | Generating test scripts for testing a network-based application |
CN108459850A (en) * | 2017-11-21 | 2018-08-28 | 广州视源电子科技股份有限公司 | method, device and system for generating test script |
CN108334443A (en) * | 2017-12-22 | 2018-07-27 | 海尔优家智能科技(北京)有限公司 | Generate method, apparatus, equipment and the computer readable storage medium of test case |
CN108415832A (en) * | 2018-02-07 | 2018-08-17 | 平安科技(深圳)有限公司 | Automatic interface testing method, device, equipment and storage medium |
CN108763084A (en) * | 2018-05-30 | 2018-11-06 | 郑州云海信息技术有限公司 | A kind of generation method of test case, device and electronic equipment |
CN109344076A (en) * | 2018-10-22 | 2019-02-15 | 浙江执御信息技术有限公司 | A kind of automatic interface testing method and its device based on JMeter and Jenkins |
CN109299017A (en) * | 2018-11-16 | 2019-02-01 | 郑州云海信息技术有限公司 | The method and system of test script frame are automatically generated based on test case document |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103186460B (en) | A kind of method, Apparatus and system of generating test use case script | |
US10929490B2 (en) | Network search query | |
CN105808437B (en) | Automatic test method and system based on test case data sheet | |
US10366112B2 (en) | Compiling extract, transform, and load job test data cases | |
CN105446865B (en) | Test method and device under a variety of environment | |
CN105791178B (en) | Message assemble method and device | |
CN106815131A (en) | A kind of game resource inspection method and system based on Unity engines | |
US11089000B1 (en) | Automated source code log generation | |
CN109145055A (en) | A kind of method of data synchronization and system based on Flink | |
US20210158076A1 (en) | Determining Model-Related Bias Associated with Training Data | |
CN107943465A (en) | A kind of method and device for generating HTML form | |
CN109871312A (en) | A kind of interface test method, device, equipment and readable storage medium storing program for executing | |
CN106708723B (en) | A kind of test, method of calibration and device | |
US20230099150A1 (en) | Structural information preserving for graph-to-text generation | |
CN110457182A (en) | A kind of load balancing cluster example operating index monitoring system | |
CN113495797A (en) | Message queue and consumer dynamic creation method and system | |
CN105446952A (en) | Method and system for processing semantic fragments | |
CN109194483A (en) | Data verification method based on block chain | |
CN115878092A (en) | Code generation method, device and medium based on micro-service architecture | |
CN109508791A (en) | Vehicle damage management method | |
CN109885498A (en) | A kind of test script generation method and system | |
CN109086362A (en) | The management method of multimode project | |
US10509659B1 (en) | Input processing logic to produce outputs for downstream systems using configurations | |
US10664338B2 (en) | System and method for root cause analysis in large scale data curation flows using provenance | |
CN110362316A (en) | A kind of Source code management method |
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: 20190614 |
|
RJ01 | Rejection of invention patent application after publication |