CN108804322A - Automated testing method, device, computer equipment and storage medium - Google Patents
Automated testing method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN108804322A CN108804322A CN201810570299.2A CN201810570299A CN108804322A CN 108804322 A CN108804322 A CN 108804322A CN 201810570299 A CN201810570299 A CN 201810570299A CN 108804322 A CN108804322 A CN 108804322A
- Authority
- CN
- China
- Prior art keywords
- sentence
- xml file
- workflow
- code
- test
- 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 193
- 238000003860 storage Methods 0.000 title claims abstract description 25
- 230000006870 function Effects 0.000 claims description 89
- 238000004590 computer program Methods 0.000 claims description 16
- 230000001755 vocal effect Effects 0.000 claims description 10
- 238000013396 workstream Methods 0.000 claims description 10
- 238000005516 engineering process Methods 0.000 claims description 9
- 238000012163 sequencing technique Methods 0.000 claims description 7
- 238000000034 method Methods 0.000 abstract description 30
- 238000010586 diagram Methods 0.000 description 16
- 230000008569 process Effects 0.000 description 10
- 238000006243 chemical reaction Methods 0.000 description 8
- 238000004422 calculation algorithm Methods 0.000 description 7
- 230000008859 change Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 5
- 238000007726 management method Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000010998 test method Methods 0.000 description 1
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
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- 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/3688—Test management for test execution, e.g. scheduling of test suites
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)
- Debugging And Monitoring (AREA)
Abstract
This application discloses a kind of automated testing method, device, computer equipment and storage mediums.This method includes:XML file is obtained, and code file is generated according to XML file and pre-set Code Template;Code file is assembled, test case corresponding with XML file is obtained;It calls test case to be tested according to test script, obtains test result.This method automatically generates code according to XML file realization by parsing the workflow sentence in XML file, improves quickly generating for the code segment in test cases, and call test case to be tested automatically by test script, improves testing efficiency.
Description
Technical field
This application involves automatization testing technique fields more particularly to a kind of automated testing method, device, computer to set
Standby and storage medium.
Background technology
Currently, enterprise is in commission calculating process, if the commission algorithm set by enterprise is converted into what program can be called
Algorithm model need to test the accuracy of the algorithm model, this just needs largely to write test case and inputs the calculation
Method model is verified.Writing for existing test case and test script is that tester writes manually, and test process
It is performed manually by, causes testing efficiency low.
Invention content
This application provides a kind of automated testing method, device, computer equipment and storage mediums, it is intended to solve existing
In technology in commission calculating process, required algorithm model is calculated to commission and carries out verifying writing and testing for required test case
The progress of process is manually, to lead to the problem that testing efficiency is low.
In a first aspect, this application provides a kind of automated testing methods comprising:
XML file is obtained, and code file is generated according to XML file and pre-set Code Template;
Code file is assembled, test case corresponding with XML file is obtained;
It calls test case to be tested according to test script, obtains test result.
Second aspect, this application provides a kind of automatic test devices comprising:
Code file generation unit is given birth to for obtaining XML file, and according to XML file and pre-set Code Template
At code file;
Test cases technology unit obtains test case corresponding with XML file for assembling code file;
Automatic test cell obtains test result for calling test case to be tested according to test script.
The third aspect, the application provide a kind of computer equipment again, including memory, processor and are stored in described deposit
On reservoir and the computer program that can run on the processor, the processor realize this when executing the computer program
Any one of them automated testing method provided is provided.
Fourth aspect, present invention also provides a kind of storage mediums, wherein the storage medium is stored with computer program,
The computer program includes program instruction, and described program instruction makes the processor execute the application when being executed by a processor
Any one of them automated testing method of offer.
A kind of automated testing method of the application offer, device, computer equipment and storage medium.This method passes through acquisition
XML file, and code file is generated according to XML file and pre-set Code Template;Code file is assembled, is obtained
Test case corresponding with XML file;It calls test case to be tested according to test script, obtains test result.This method
By parsing the workflow sentence in XML file, code is automatically generated according to XML file realization, improves test cases
In code segment quickly generate, and call test case automatically to be tested by test script, improve testing efficiency.
Description of the drawings
It, below will be to needed in embodiment description in order to illustrate more clearly of the embodiment of the present application technical solution
Attached drawing is briefly described, it should be apparent that, the accompanying drawings in the following description is some embodiments of the present application, general for this field
For logical technical staff, without creative efforts, other drawings may also be obtained based on these drawings.
Fig. 1 is a kind of schematic flow diagram of automated testing method provided by the embodiments of the present application;
Fig. 2 is a kind of sub-process schematic diagram of automated testing method provided by the embodiments of the present application;
Fig. 3 is a kind of another sub-process schematic diagram of automated testing method provided by the embodiments of the present application;
Fig. 4 is a kind of another sub-process schematic diagram of automated testing method provided by the embodiments of the present application;
Fig. 5 is a kind of another sub-process schematic diagram of automated testing method provided by the embodiments of the present application;
Fig. 6 is a kind of schematic block diagram of automatic test device provided by the embodiments of the present application;
Fig. 7 is a kind of subelement schematic block diagram of automatic test device provided by the embodiments of the present application;
Fig. 8 is a kind of another subelement schematic block diagram of automatic test device provided by the embodiments of the present application;
Fig. 9 is a kind of another subelement schematic block diagram of automatic test device provided by the embodiments of the present application;
A kind of Figure 10 another subelement schematic block diagrams of automatic test device provided by the embodiments of the present application;
Figure 11 is a kind of schematic block diagram of computer equipment provided by the embodiments of the present application.
Specific implementation mode
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation describes, it is clear that described embodiment is some embodiments of the present application, instead of all the embodiments.Based on this Shen
Please in embodiment, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall in the protection scope of this application.
It should be appreciated that ought use in this specification and in the appended claims, term " comprising " and "comprising" instruction
Described feature, entirety, step, operation, the presence of element and/or component, but one or more of the other feature, whole is not precluded
Body, step, operation, element, component and/or its presence or addition gathered.
It is also understood that the term used in this present specification is merely for the sake of the mesh for describing specific embodiment
And be not intended to limit the application.As present specification and it is used in the attached claims, unless on
Other situations are hereafter clearly indicated, otherwise " one " of singulative, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in present specification and the appended claims is
Refer to any combinations and all possible combinations of one or more of associated item listed, and includes these combinations.
Referring to Fig. 1, Fig. 1 is a kind of schematic flow diagram of automated testing method provided by the embodiments of the present application.The party
Method is applied in server.As shown in Figure 1, the method comprising the steps of S101~S103.
S101, XML file is obtained, and code file is generated according to XML file and pre-set Code Template.
In the present embodiment, if developer has received the requirement documents that test case is developed, (requirement documents are namely
The foundation of programming) after, convert service logic included in requirement documents to the XML file of the workflow including software program
And it is uploaded to server end, subsequent Code automatic build flow is carried out by server end.For example, XML file includes basis
Business demand corresponds to the parameter definition of conversion, the information such as arithmetic logic.Such as A parameters defined in XML file, B parameter etc., and
Operation this arithmetic logic for carrying out A+B is declared.By requirement documents procedure identification trained by developer or in advance
Model can convert requirement documents to the XML file for including vocational work stream information.And demand is indicated by XML file
The vocational work stream information of document can be easier to be identified by computer.File is described by the xml write according to business, automatically
Test case is generated, the workload and difficulty of the generation of test case are reduced.
In one embodiment, as shown in Fig. 2, step S101 includes:
S1011, acquisition include the XML file of vocational work stream information;
S1012, parsing XML file, are sequentially obtained more corresponding to XML file by the sequencing of sentence in XML file
Section workflow sentence;
S1013, according to pre-set Code Template, sequentially produce and each section of workflow language in multistage workflow sentence
The one-to-one code segment of sentence;
S1014, code segment is sequentially combined, obtains code file corresponding with XML file.
In the present embodiment, it is that XML file is directed into Python (is a kind of object-oriented when parsing XML file
Explanation type computer programming language) it is parsed, there are three types of methods:First, xml.dom.* modules, it is W3C
The realization of DOMAPI, if desired handling DOM API, then the module is well suited for;Second is that xml.sax.* modules, it is the reality of SAXAPI
Existing, this module sacrifices convenience to exchange speed and EMS memory occupation for, and SAX is an API based on event, this means that
It can handle the document of vast number " in the air ", without being loaded completely into memory;Third,
Xml.etree.ElementTree modules (abbreviation ET), it provides the API of the Python formulas of lightweight, for DOM
ET is fast very much, and has the API of many pleasants that can use, and the ET.iterparse of ET is also carried for SAX
For the processing mode of " in the air ", it is not necessary that load entire document to memory, the average value and SAX differences of the performance of ET are not
It is more, but API more efficient and use easily.
In one embodiment, as shown in figure 3, step S1012 includes:
S10121, the line by line descriptive statement in acquisition XML file;
S10122, judge the corresponding function type of the descriptive statement of current line;
If the descriptive statement of S10123, current line is to increase function sentence, it converts the descriptive statement of current line to increase
The workflow sentence of function;
If the descriptive statement of S10124, current line is to delete function sentence, it converts the descriptive statement of current line to deletion
The workflow sentence of function;
If the descriptive statement of S10125, current line is editting function sentence, it converts the descriptive statement of current line to editor
The workflow sentence of function;
If the descriptive statement of S10126, current line is query function sentence, it converts the descriptive statement of current line to inquiry
The workflow sentence of function;
If the descriptive statement of S10127, current line is arbitration functions sentence, it converts the descriptive statement of current line to judgement
The workflow sentence of function;
If the descriptive statement of S10128, current line is circulatory function sentence, it converts the descriptive statement of current line to cycle
The workflow sentence of function.
In the present embodiment, server end obtains XML file, and the program circuit corresponding to regulation XML file is (i.e.
Workflow sentence), the logical source of automatic code generating is known according to program circuit.Due in program, the operation one to data
As include following six kinds of situations:Increase, delete, change, look into, judge, recycle.Service logic is the permutation and combination of this six kinds of situations nothing but,
Therefore service logic leaved for development can be described by XML file.
By judge the descriptive statement of current line be increase, delete, change, look into, judge, recycle in it is any, you can it is corresponding
Know the corresponding workflow type of each line statement, it is convenient subsequently according to workflow type to each line statement according to pre-setting
Template be converted into code.
In one embodiment, as shown in figure 4, step S1013 includes:
S10131, parameter or data value included by each section of workflow sentence in multistage workflow sentence are sequentially obtained;
S10132, it obtains and each section of one-to-one Code Template of workflow sentence;
S10133, by included by each section of workflow sentence parameter or data value fill to corresponding Code Template, obtain
To with each section of one-to-one code segment of workflow sentence.
Xml document is parsed, while calling corresponding Code Template, the data defined inside xml document were filled to generation
Code mask ultimately produces code;
For example, the descriptive statement of the first row is to delete function sentence in xml document, then the code mould for deleting function is called
Plate, and data that the descriptive statement of the first row includes are filled to the Code Template for deleting function, it obtains retouching with the first row
The corresponding code segment of predicate sentence;
The descriptive statement of the second row is to increase function sentence in xml document, then calls the Code Template for increasing function, and will
The data that the descriptive statement of second row includes are filled to the Code Template for increasing function, and the descriptive statement pair with the second row is obtained
The code segment answered;
The descriptive statement of the third line is query function sentence in xml document, then calls the Code Template of query function, and will
The data that the descriptive statement of the third line includes fill the descriptive statement pair obtained to the Code Template of query function with the third line
The code segment answered.
S102, code file is assembled, obtains test case corresponding with XML file.
In the present embodiment, the code file automatically generated, can be as the basic material of assembling test use-case.By by one
A code file or multiple code files are assembled, and are specifically filled code file automatically to pre-set test case
Region to be filled in template, you can quickly generate test case corresponding with XML file.The realization of the above process, due to generation
Code file is automatically generated, therefore greatly reduces taking for Test cases technology, and realization can be also operated without professional technician
Generate test case.
S103, it calls test case to be tested according to test script, obtains test result.
In the present embodiment, by being write in advance for starting the test script tested automatically, test case is inputted
In test model, automatic test is carried out, and test result is automatically saved after the completion of test, realize the automatic of test process
Change and carry out, test mode is monitored in real time without tester.
In one embodiment, as shown in figure 5, step S103 includes:
S1031, test script is called by Python, and test script is parsed, obtained corresponding with test script
Executive plan;
S1032, it calls test case to be tested by executive plan, obtains test result corresponding with test case.
Wherein, test script is that in maven tools, (Maven is to be based on item objects model (POM to tester in advance
Project object model), it can be by a bit of description information (configuration) come the structure of management project, report and document
Software project management tool) in write-in commission algorithm calculating logic, and according to calculating logic generate bat suffix test foot
This.Then test script is parsed by Python again, obtains executive plan.Test case can be called by executive plan
It is tested, and is tested.
As it can be seen that this method by parsing the workflow sentence in XML file, is realized according to XML file to the automatic of code
It generates, improves quickly generating for the code segment in test cases, and call test case to be surveyed automatically by test script
Examination, improves testing efficiency.
The embodiment of the present application also provides a kind of automatic test device, and the automatic test device is aforementioned automatic for executing
Change any embodiment of test method.Specifically, referring to Fig. 6, Fig. 6 is a kind of automatic test provided by the embodiments of the present application
The schematic block diagram of device.Automatic test device 100 can be configured in server.
As shown in fig. 6, automatic test device 100 includes code file generation unit 101, Test cases technology unit
102 and automatic test cell 103.
Code file generation unit 101 is used for code file generation unit, for obtaining XML file, and according to XML texts
Part and pre-set Code Template generate code file.
In the present embodiment, if developer has received the requirement documents that test case is developed, (requirement documents are namely
The foundation of programming) after, convert service logic included in requirement documents to the XML file of the workflow including software program
And it is uploaded to server end, subsequent Code automatic build flow is carried out by server end.For example, XML file includes basis
Business demand corresponds to the parameter definition of conversion, the information such as arithmetic logic.Such as A parameters defined in XML file, B parameter etc., and
Operation this arithmetic logic for carrying out A+B is declared.By requirement documents procedure identification trained by developer or in advance
Model can convert requirement documents to the XML file for including vocational work stream information.And demand is indicated by XML file
The vocational work stream information of document can be easier to be identified by computer.File is described by the xml write according to business, automatically
Test case is generated, the workload and difficulty of the generation of test case are reduced.
In one embodiment, as shown in fig. 7, code file generation unit 101 includes:
XML file acquiring unit 1011, for obtain include vocational work stream information XML file;
XML file resolution unit 1012 is sequentially obtained for parsing XML file by the sequencing of sentence in XML file
Multistage workflow sentence corresponding to XML file;
Code segment generation unit 1013, for according to pre-set Code Template, sequentially producing and multistage workflow language
The each section of one-to-one code segment of workflow sentence in sentence;
Code segment assembled unit 1014 obtains code text corresponding with XML file for code segment to be sequentially combined
Part.
In the present embodiment, it is that XML file is directed into Python (is a kind of object-oriented when parsing XML file
Explanation type computer programming language) it is parsed, there are three types of methods:First, xml.dom.* modules, it is W3C
The realization of DOMAPI, if desired handling DOM API, then the module is well suited for;Second is that xml.sax.* modules, it is the reality of SAXAPI
Existing, this module sacrifices convenience to exchange speed and EMS memory occupation for, and SAX is an API based on event, this means that
It can handle the document of vast number " in the air ", without being loaded completely into memory;Third,
Xml.etree.ElementTree modules (abbreviation ET), it provides the API of the Python formulas of lightweight, for DOM
ET is fast very much, and has the API of many pleasants that can use, and the ET.iterparse of ET is also carried for SAX
For the processing mode of " in the air ", it is not necessary that load entire document to memory, the average value and SAX differences of the performance of ET are not
It is more, but API more efficient and use easily.
In one embodiment, as shown in figure 8, XML file resolution unit 1012 includes:
Acquiring unit 10121 line by line, for obtaining the descriptive statement in XML file line by line;
Function type judging unit 10122, for judging the corresponding function type of the descriptive statement of current line;
First conversion unit 10123, if the descriptive statement for current line is to increase function sentence, by the description of current line
Sentence is converted into the workflow sentence for increasing function;
Second conversion unit 10124, if the descriptive statement for current line is to delete function sentence, by the description of current line
Sentence is converted into the workflow sentence for deleting function;
Third conversion unit 10125, if the descriptive statement for current line is editting function sentence, by the description of current line
Sentence is converted into the workflow sentence of editting function;
4th conversion unit 10126, if the descriptive statement for current line is query function sentence, by the description of current line
Sentence is converted into the workflow sentence of query function;
5th conversion unit 10127, if the descriptive statement for current line is arbitration functions sentence, by the description of current line
Sentence is converted into the workflow sentence of arbitration functions;
6th conversion unit 10128, if the descriptive statement for current line is circulatory function sentence, by the description of current line
Sentence is converted into the workflow sentence of circulatory function.
In the present embodiment, server end obtains XML file, and the program circuit corresponding to regulation XML file is (i.e.
Workflow sentence), the logical source of automatic code generating is known according to program circuit.Due in program, the operation one to data
As include following six kinds of situations:Increase, delete, change, look into, judge, recycle.Service logic is the permutation and combination of this six kinds of situations nothing but,
Therefore service logic leaved for development can be described by XML file.
By judge the descriptive statement of current line be increase, delete, change, look into, judge, recycle in it is any, you can it is corresponding
Know the corresponding workflow type of each line statement, it is convenient subsequently according to workflow type to each line statement according to pre-setting
Template be converted into code.
In one embodiment, as shown in figure 9, code segment generation unit 1013 includes:
Parameter or numerical value acquiring unit 10131, for sequentially obtaining each section of workflow sentence in multistage workflow sentence
Included parameter or data value;
Code Template corresponding unit 10132, for obtaining and each section of one-to-one Code Template of workflow sentence;
Parameter or numerical value fills unit 10133, for by included by each section of workflow sentence parameter or data value fill out
It is charged to corresponding Code Template, is obtained and each section of one-to-one code segment of workflow sentence.
Xml document is parsed, while calling corresponding Code Template, the data defined inside xml document were filled to generation
Code mask ultimately produces code;
For example, the descriptive statement of the first row is to delete function sentence in xml document, then the code mould for deleting function is called
Plate, and data that the descriptive statement of the first row includes are filled to the Code Template for deleting function, it obtains retouching with the first row
The corresponding code segment of predicate sentence;
The descriptive statement of the second row is to increase function sentence in xml document, then calls the Code Template for increasing function, and will
The data that the descriptive statement of second row includes are filled to the Code Template for increasing function, and the descriptive statement pair with the second row is obtained
The code segment answered;
The descriptive statement of the third line is query function sentence in xml document, then calls the Code Template of query function, and will
The data that the descriptive statement of the third line includes fill the descriptive statement pair obtained to the Code Template of query function with the third line
The code segment answered.
Test cases technology unit 102 obtains test corresponding with XML file and uses for assembling code file
Example.
In the present embodiment, the code file automatically generated, can be as the basic material of assembling test use-case.By by one
A code file or multiple code files are assembled, you can quickly generate test case corresponding with XML file.The above process
Realization, since code file is automatically generated, thus greatly reduce Test cases technology take, be not necessarily to professional technician
Also realization can be operated and generate test case.
Automatic test cell 103 obtains test result for calling test case to be tested according to test script.
In the present embodiment, by being write in advance for starting the test script tested automatically, test case is inputted
In test model, automatic test is carried out, and test result is automatically saved after the completion of test, realize the automatic of test process
Change and carry out, test mode is monitored in real time without tester.
In one embodiment, as shown in Figure 10, automatic test cell 103 includes:
Test script resolution unit 1031 for calling test script by Python, and parses test script,
Obtain executive plan corresponding with test script;
Executive plan call unit 1032 is obtained and is tested for calling test case to be tested by executive plan
The corresponding test result of use-case.
Wherein, test script is that in maven tools, (Maven is to be based on item objects model (POM to tester in advance
Project object model), it can be by a bit of description information (configuration) come the structure of management project, report and document
Software project management tool) in write-in commission algorithm calculating logic, and according to calculating logic generate bat suffix test foot
This.Then test script is parsed by Python again, obtains executive plan.Test case can be called by executive plan
It is tested, and is tested.
As it can be seen that the device by parsing the workflow sentence in XML file, is realized according to XML file to the automatic of code
It generates, improves quickly generating for the code segment in test cases, and call test case to be surveyed automatically by test script
Examination, improves testing efficiency.
Above-mentioned automatic test device can be implemented as a kind of form of computer program, which can be such as
It is run on computer equipment shown in Figure 11.
Please refer to Fig.1 the schematic block diagram that 1, Figure 11 is a kind of computer equipment provided by the embodiments of the present application.The calculating
500 equipment of machine equipment can be server.
Refering to fig. 11, which includes processor 502, memory and the net connected by system bus 501
Network interface 505, wherein memory may include non-volatile memory medium 503 and built-in storage 504.
The non-volatile memory medium 503 can storage program area 5031 and computer program 5032.The computer program
5032 include program instruction, which is performed, and processor 502 may make to execute a kind of automated testing method.
The processor 502 supports the operation of entire computer equipment 500 for providing calculating and control ability.
The built-in storage 504 provides environment for the operation of the computer program 5032 in non-volatile memory medium 503, should
When computer program 5032 is executed by processor 502, processor 502 may make to execute a kind of automated testing method.
The network interface 505 such as sends the task dispatching of distribution for carrying out network communication.Those skilled in the art can manage
It solves, structure is not constituted only with the block diagram of the relevant part-structure of application scheme to the application side shown in Figure 11
The restriction for the computer equipment 500 that case is applied thereon, specific computer equipment 500 may include more than as shown in the figure
Or less component, it either combines certain components or is arranged with different components.
Wherein, the processor 502 is for running computer program 5032 stored in memory, to realize following work(
Energy:XML file is obtained, and code file is generated according to XML file and pre-set Code Template;Code file is subjected to group
Dress, obtains test case corresponding with XML file;It calls test case to be tested according to test script, obtains test result.
In one embodiment, processor 502 also executes following operation:Acquisition includes the XML file of vocational work stream information;
XML file is parsed, the multistage workflow sentence corresponding to XML file is sequentially obtained by the sequencing of sentence in XML file;Root
According to pre-set Code Template, sequentially produce and each section of one-to-one code of workflow sentence in multistage workflow sentence
Section;Code segment is sequentially combined, code file corresponding with XML file is obtained.
In one embodiment, processor 502 also executes following operation:The descriptive statement in XML file is obtained line by line;Judge
The corresponding function type of descriptive statement of current line;If the descriptive statement of current line is to increase function sentence, by retouching for current line
Predicate sentence is converted into the workflow sentence for increasing function;If the descriptive statement of current line is to delete function sentence, by current line
Descriptive statement is converted into the workflow sentence for deleting function;If the descriptive statement of current line is editting function sentence, by current line
Descriptive statement be converted into the workflow sentence of editting function;If the descriptive statement of current line is query function sentence, will be current
Capable descriptive statement is converted into the workflow sentence of query function;If the descriptive statement of current line is arbitration functions sentence, will work as
Forward descriptive statement is converted into the workflow sentence of arbitration functions;It, will if the descriptive statement of current line is circulatory function sentence
The descriptive statement of current line is converted into the workflow sentence of circulatory function.
In one embodiment, processor 502 also executes following operation:Sequentially obtain each section of work in multistage workflow sentence
Make the parameter included by stream sentence or data value;It obtains and each section of one-to-one Code Template of workflow sentence;It will be each
Parameter or data value included by section workflow sentence are filled to corresponding Code Template, are obtained and each section of workflow sentence one
One corresponding code segment.
In one embodiment, processor 502 also executes following operation:Test script is called by Python, and to test
Script is parsed, and executive plan corresponding with test script is obtained;It calls test case to be tested by executive plan, obtains
To test result corresponding with test case.
It will be understood by those skilled in the art that the embodiment of computer equipment shown in Figure 11 is not constituted to computer
The restriction of equipment specific composition, in other embodiments, computer equipment may include components more more or fewer than diagram, or
Person combines certain components or different components arrangement.For example, in some embodiments, computer equipment can only include depositing
Reservoir and processor, in such embodiments, the structure and function of memory and processor are consistent with embodiment illustrated in fig. 11,
Details are not described herein.
It should be appreciated that in the embodiment of the present application, processor 502 can be central processing unit (Central
Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital
Signal Processor, DSP), application-specific integrated circuit (Application Specific Integrated Circuit,
ASIC), ready-made programmable gate array (Field-Programmable GateArray, FPGA) or other programmable logic devices
Part, discrete gate or transistor logic, discrete hardware components etc..Wherein, general processor can be microprocessor or
The processor can also be any conventional processor etc..
A kind of storage medium is provided in another embodiment of the application.The storage medium can be computer-readable storage
Medium.The storage medium is stored with computer program, and wherein computer program includes program instruction.The program instruction is by processor
It is realized when execution:XML file is obtained, and code file is generated according to XML file and pre-set Code Template;By code text
Part is assembled, and test case corresponding with XML file is obtained;It calls test case to be tested according to test script, obtains
Test result.
In one embodiment, it is realized when which is executed by processor:Acquisition includes the XML of vocational work stream information
File;XML file is parsed, the multistage workflow language corresponding to XML file is sequentially obtained by the sequencing of sentence in XML file
Sentence;According to pre-set Code Template, sequentially produces and corresponded with each section of workflow sentence in multistage workflow sentence
Code segment;Code segment is sequentially combined, code file corresponding with XML file is obtained.
In one embodiment, it is realized when which is executed by processor:The description in XML file is obtained line by line
Sentence;Judge the corresponding function type of the descriptive statement of current line;If the descriptive statement of current line is to increase function sentence, will be current
Capable descriptive statement is converted into the workflow sentence for increasing function;If the descriptive statement of current line is to delete function sentence, will work as
Forward descriptive statement is converted into the workflow sentence for deleting function;It, will if the descriptive statement of current line is editting function sentence
The descriptive statement of current line is converted into the workflow sentence of editting function;If the descriptive statement of current line is query function sentence,
Convert the descriptive statement of current line to the workflow sentence of query function;If the descriptive statement of current line is arbitration functions language
Sentence, converts the descriptive statement of current line to the workflow sentence of arbitration functions;If the descriptive statement of current line is circulatory function
Sentence converts the descriptive statement of current line to the workflow sentence of circulatory function.
In one embodiment, it is realized when which is executed by processor:It sequentially obtains every in multistage workflow sentence
Parameter included by one section of workflow sentence or data value;It obtains and each section of one-to-one Code Template of workflow sentence;
By included by each section of workflow sentence parameter or data value fill to corresponding Code Template, obtain and each section of workflow
The one-to-one code segment of sentence.
In one embodiment, it is realized when which is executed by processor:Test script is called by Python, and right
Test script is parsed, and executive plan corresponding with test script is obtained;Test case is called to be surveyed by executive plan
Examination, obtains test result corresponding with test case.
The storage medium can be the internal storage unit of aforementioned device, such as the hard disk or memory of equipment.It is described to deposit
Storage media can also be the plug-in type hard disk being equipped on the External memory equipment of the equipment, such as the equipment, intelligent storage
Block (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..
Further, the storage medium can also both include the equipment internal storage unit and also including External memory equipment.
It is apparent to those skilled in the art that for convenience of description and succinctly, foregoing description is set
The specific work process of standby, device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
Those of ordinary skill in the art may realize that units and algorithm described in conjunction with the examples disclosed in the embodiments of the present disclosure
Step can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and software
Interchangeability generally describes each exemplary composition and step according to function in the above description.These functions are studied carefully
Unexpectedly the specific application and design constraint depending on technical solution are implemented in hardware or software.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
In several embodiments provided herein, it should be understood that disclosed unit and method, it can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of division of logic function, formula that in actual implementation, there may be another division manner can also will have identical work(
The unit set of energy can be combined or can be integrated into another system at a unit, such as multiple units or component, or
Some features can be ignored or not executed.In addition, shown or discussed mutual coupling or direct-coupling or communication link
It can be INDIRECT COUPLING or communication connection by some interfaces, device or unit to connect, and can also be electricity, mechanical or other
Form connection.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple
In network element.Some or all of unit therein can be selected according to the actual needs to realize the embodiment of the present invention
Purpose.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
It is that each unit physically exists alone, can also be during two or more units are integrated in one unit.It is above-mentioned integrated
The form that hardware had both may be used in unit is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can be stored in a storage medium.Based on this understanding, technical scheme of the present invention is substantially in other words to existing
The all or part of part or the technical solution that technology contributes can be expressed in the form of software products, should
Computer software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be
Personal computer, server or network equipment etc.) execute all or part of step of each embodiment the method for the present invention
Suddenly.And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disc or
The various media that can store program code such as person's CD.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace
It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right
It is required that protection domain subject to.
Claims (10)
1. a kind of automated testing method, which is characterized in that including:
XML file is obtained, and code file is generated according to XML file and pre-set Code Template;
Code file is assembled, test case corresponding with XML file is obtained;
It calls test case to be tested according to test script, obtains test result.
2. automated testing method according to claim 1, which is characterized in that the acquisition XML file, and according to XML
File and pre-set Code Template generate code file, including:
Acquisition includes the XML file of vocational work stream information;
XML file is parsed, the multistage workflow language corresponding to XML file is sequentially obtained by the sequencing of sentence in XML file
Sentence;
According to pre-set Code Template, sequentially produces and corresponded with each section of workflow sentence in multistage workflow sentence
Code segment;
Code segment is sequentially combined, code file corresponding with XML file is obtained.
3. automated testing method according to claim 2, which is characterized in that the parsing XML file, by XML file
The sequencing of middle sentence sequentially obtains the multistage workflow sentence corresponding to XML file, including:
The descriptive statement in XML file is obtained line by line;
Judge the corresponding function type of the descriptive statement of current line;
If the descriptive statement of current line is to increase function sentence, it converts the descriptive statement of current line to the workflow for increasing function
Sentence;
If the descriptive statement of current line is to delete function sentence, it converts the descriptive statement of current line to the workflow for deleting function
Sentence;
If the descriptive statement of current line is editting function sentence, it converts the descriptive statement of current line to the workflow of editting function
Sentence;
If the descriptive statement of current line is query function sentence, it converts the descriptive statement of current line to the workflow of query function
Sentence;
If the descriptive statement of current line is arbitration functions sentence, it converts the descriptive statement of current line to the workflow of arbitration functions
Sentence;
If the descriptive statement of current line is circulatory function sentence, it converts the descriptive statement of current line to the workflow of circulatory function
Sentence.
4. automated testing method according to claim 2, which is characterized in that described according to pre-set code mould
Plate, sequentially produce with each section of one-to-one code segment of workflow sentence in multistage workflow sentence, including:
Sequentially obtain parameter or data value included by each section of workflow sentence in multistage workflow sentence;
It obtains and each section of one-to-one Code Template of workflow sentence;
By included by each section of workflow sentence parameter or data value fill to corresponding Code Template, obtain and each section of work
Make the stream one-to-one code segment of sentence.
5. automated testing method according to claim 1, which is characterized in that described to call test to use according to test script
Example is tested, and test result is obtained, including:
Test script is called by Python, and test script is parsed, obtains executive plan corresponding with test script;
It calls test case to be tested by executive plan, obtains test result corresponding with test case.
6. a kind of automatic test device, which is characterized in that including:
Code file generation unit generates generation for obtaining XML file, and according to XML file and pre-set Code Template
Code file;
Test cases technology unit obtains test case corresponding with XML file for assembling code file;
Automatic test cell obtains test result for calling test case to be tested according to test script.
7. automatic test device according to claim 6, which is characterized in that the code file generation unit, including:
XML file acquiring unit, for obtain include vocational work stream information XML file;
XML file resolution unit sequentially obtains XML file for parsing XML file by the sequencing of sentence in XML file
Corresponding multistage workflow sentence;
Code segment generation unit, for according to pre-set Code Template, sequentially produce with it is each in multistage workflow sentence
The section one-to-one code segment of workflow sentence;
Code segment assembled unit obtains code file corresponding with XML file for code segment to be sequentially combined.
8. automatic test device according to claim 6, which is characterized in that the automatic test cell, including:
Test script resolution unit for calling test script by Python, and parses test script, obtains and survey
The corresponding executive plan of training sheet;
Executive plan call unit obtains corresponding with test case for calling test case to be tested by executive plan
Test result.
9. a kind of computer equipment, including memory, processor and it is stored on the memory and can be on the processor
The computer program of operation, which is characterized in that the processor is realized when executing the computer program as in claim 1-5
Any one of them automated testing method.
10. a kind of storage medium, which is characterized in that the storage medium is stored with computer program, the computer program packet
Program instruction is included, described program instruction makes the processor execute such as any one of claim 1-5 institutes when being executed by a processor
The automated testing method stated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810570299.2A CN108804322A (en) | 2018-06-05 | 2018-06-05 | Automated testing method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810570299.2A CN108804322A (en) | 2018-06-05 | 2018-06-05 | Automated testing method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108804322A true CN108804322A (en) | 2018-11-13 |
Family
ID=64088733
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810570299.2A Pending CN108804322A (en) | 2018-06-05 | 2018-06-05 | Automated testing method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108804322A (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109491919A (en) * | 2018-11-28 | 2019-03-19 | 中电科西北集团有限公司 | A kind of method for testing software and test platform |
CN110362467A (en) * | 2019-05-27 | 2019-10-22 | 深圳壹账通智能科技有限公司 | Code test method, device, computer installation and storage medium |
CN110532185A (en) * | 2019-08-29 | 2019-12-03 | 中国工商银行股份有限公司 | Test method, device, electronic equipment and computer readable storage medium |
CN111078548A (en) * | 2019-12-06 | 2020-04-28 | 上海励驰半导体有限公司 | Test case analysis method and device, storage medium and verification platform |
CN111881053A (en) * | 2020-08-04 | 2020-11-03 | 北京四维智联科技有限公司 | Test case format conversion method and device and computer equipment |
CN112099472A (en) * | 2020-09-03 | 2020-12-18 | 通号城市轨道交通技术有限公司 | Automatic testing method and device, electronic equipment and storage medium |
CN112731117A (en) * | 2021-01-11 | 2021-04-30 | Oppo广东移动通信有限公司 | Automatic verification method and system for chip, and storage medium |
CN113064811A (en) * | 2020-12-25 | 2021-07-02 | 浙江鲸腾网络科技有限公司 | Workflow-based automatic testing method and device and electronic equipment |
CN113360713A (en) * | 2021-05-31 | 2021-09-07 | 浙江中科领航汽车电子有限公司 | Design method and system for embedded graphic frame of automobile instrument |
CN113515444A (en) * | 2021-04-21 | 2021-10-19 | 平安银行股份有限公司 | Test case generation method and device, computer equipment and storage medium |
CN117312177A (en) * | 2023-11-30 | 2023-12-29 | 北京控制工程研究所 | Test case generation method and device for spacecraft control system |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101645010A (en) * | 2009-08-20 | 2010-02-10 | 深圳市珍爱网信息技术有限公司 | System and method for automatically generating code |
CN102968306A (en) * | 2012-11-29 | 2013-03-13 | 广东全通教育股份有限公司 | Method and system for automatically generating code based on data model drive |
CN106250164A (en) * | 2016-08-16 | 2016-12-21 | 广州仕邦人力资源有限公司 | A kind of code generating method based on requirement documents and device |
CN107273117A (en) * | 2017-05-25 | 2017-10-20 | 深圳市彬讯科技有限公司 | A kind of quick Code automatic build system for programming friendly |
CN107291450A (en) * | 2017-05-25 | 2017-10-24 | 深圳市彬讯科技有限公司 | A kind of quick code automatic generation method for programming friendly |
CN107729228A (en) * | 2017-08-24 | 2018-02-23 | 北京网众共创科技有限公司 | Interface test method, device, storage medium and processor |
CN108073511A (en) * | 2016-11-14 | 2018-05-25 | 平安科技(深圳)有限公司 | test code generating method and device |
-
2018
- 2018-06-05 CN CN201810570299.2A patent/CN108804322A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101645010A (en) * | 2009-08-20 | 2010-02-10 | 深圳市珍爱网信息技术有限公司 | System and method for automatically generating code |
CN102968306A (en) * | 2012-11-29 | 2013-03-13 | 广东全通教育股份有限公司 | Method and system for automatically generating code based on data model drive |
CN106250164A (en) * | 2016-08-16 | 2016-12-21 | 广州仕邦人力资源有限公司 | A kind of code generating method based on requirement documents and device |
CN108073511A (en) * | 2016-11-14 | 2018-05-25 | 平安科技(深圳)有限公司 | test code generating method and device |
CN107273117A (en) * | 2017-05-25 | 2017-10-20 | 深圳市彬讯科技有限公司 | A kind of quick Code automatic build system for programming friendly |
CN107291450A (en) * | 2017-05-25 | 2017-10-24 | 深圳市彬讯科技有限公司 | A kind of quick code automatic generation method for programming friendly |
CN107729228A (en) * | 2017-08-24 | 2018-02-23 | 北京网众共创科技有限公司 | Interface test method, device, storage medium and processor |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109491919A (en) * | 2018-11-28 | 2019-03-19 | 中电科西北集团有限公司 | A kind of method for testing software and test platform |
CN109491919B (en) * | 2018-11-28 | 2021-10-26 | 中电科西北集团有限公司 | Software testing method and testing platform |
CN110362467A (en) * | 2019-05-27 | 2019-10-22 | 深圳壹账通智能科技有限公司 | Code test method, device, computer installation and storage medium |
CN110532185A (en) * | 2019-08-29 | 2019-12-03 | 中国工商银行股份有限公司 | Test method, device, electronic equipment and computer readable storage medium |
CN110532185B (en) * | 2019-08-29 | 2023-09-19 | 中国工商银行股份有限公司 | Test method, test device, electronic equipment and computer readable storage medium |
CN111078548A (en) * | 2019-12-06 | 2020-04-28 | 上海励驰半导体有限公司 | Test case analysis method and device, storage medium and verification platform |
CN111078548B (en) * | 2019-12-06 | 2023-05-23 | 上海励驰半导体有限公司 | Test case analysis method and device, storage medium and verification platform |
CN111881053A (en) * | 2020-08-04 | 2020-11-03 | 北京四维智联科技有限公司 | Test case format conversion method and device and computer equipment |
CN112099472A (en) * | 2020-09-03 | 2020-12-18 | 通号城市轨道交通技术有限公司 | Automatic testing method and device, electronic equipment and storage medium |
CN113064811A (en) * | 2020-12-25 | 2021-07-02 | 浙江鲸腾网络科技有限公司 | Workflow-based automatic testing method and device and electronic equipment |
CN113064811B (en) * | 2020-12-25 | 2024-06-07 | 浙江鲸腾网络科技有限公司 | Automatic testing method and device based on workflow and electronic equipment |
CN112731117A (en) * | 2021-01-11 | 2021-04-30 | Oppo广东移动通信有限公司 | Automatic verification method and system for chip, and storage medium |
CN113515444B (en) * | 2021-04-21 | 2023-07-25 | 平安银行股份有限公司 | Test case generation method, device, computer equipment and storage medium |
CN113515444A (en) * | 2021-04-21 | 2021-10-19 | 平安银行股份有限公司 | Test case generation method and device, computer equipment and storage medium |
CN113360713A (en) * | 2021-05-31 | 2021-09-07 | 浙江中科领航汽车电子有限公司 | Design method and system for embedded graphic frame of automobile instrument |
CN117312177A (en) * | 2023-11-30 | 2023-12-29 | 北京控制工程研究所 | Test case generation method and device for spacecraft control system |
CN117312177B (en) * | 2023-11-30 | 2024-02-09 | 北京控制工程研究所 | Test case generation method and device for spacecraft control system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108804322A (en) | Automated testing method, device, computer equipment and storage medium | |
CN108762764A (en) | Code automatic generation method, device, computer equipment and storage medium | |
US8689177B2 (en) | Integration environment generator | |
CN102449598B (en) | Bag design and generation | |
CN107273117B (en) | Programming-friendly agile code automatic generation system | |
CN104679488B (en) | A kind of flow custom development platform and flow custom development approach | |
CN107729003A (en) | Automatic generation method, device and the electronic equipment of code | |
CN109240688A (en) | Interface development method, electronic device and readable storage medium storing program for executing | |
CN106293664A (en) | Code generating method and device | |
CN107592238A (en) | Automatic test approach and system, service terminal, the memory of interface | |
CN103186457A (en) | Method and device for automatically generating test case | |
CN103500087A (en) | Code generation method and device based on maven plug-in and freemarker template | |
CN101968740B (en) | Service data dynamic adjustment server and system on basis of JAVA CLASS compilation | |
CN107729228A (en) | Interface test method, device, storage medium and processor | |
CN102306122A (en) | Automated testing method and equipment | |
CN110109831A (en) | Automated test frame system, automated testing method and terminal device | |
CN111399828B (en) | Model-driven logic device modeling method and terminal | |
CN110134596A (en) | The generation method and terminal device of test document | |
CN102929646A (en) | Application program production method and device | |
EP2511841A2 (en) | System and method for generation of cim-based power system circuit models | |
CN104660435A (en) | Transactional network management engine for intelligent pipeline and network management transaction processing method of transactional network management engine | |
CN113467782B (en) | Method, device and equipment for determining business process | |
CN110135814A (en) | The correlating method of BIM and project data, system and terminal device | |
Salger et al. | Knowledge transfer in global software development-leveraging ontologies, tools and assessments | |
CN106293651A (en) | The implementation method of a kind of general-purpose interface and device |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181113 |