Specific embodiment
In order to make those skilled in the art more fully understand the technical solution in this specification embodiment, below in conjunction with this
Attached drawing in specification embodiment is described in detail the technical solution in this specification embodiment, it is clear that described
Embodiment is only a part of the embodiment of this specification, instead of all the embodiments.The embodiment of base in this manual,
Those of ordinary skill in the art's every other embodiment obtained, all should belong to the range of protection.
For problem of the prior art, this specification embodiment provides a kind of service test method, shown in Figure 1, should
Method may comprise steps of:
S101 obtains the test case for carrying out operational trials;
In the operational trials scheme that this specification embodiment provides, by the corresponding test suite of test operation, constitutes and use
In the test case of test business.
Specifically, before carrying out operational trials, tester needs each operation to be simulated when can be directed to test business,
Several test suites are accordingly write in advance, a kind of operation may be implemented in each test suite.Also, test suite is equivalent to
The frame of specific associated data is not written, associated data can obtain during the test, therefore test suite can have one
Fixed versatility can be multiplexed in different test cases.
Tester can also write the test case for the business of testing in advance, and included test is defined in use-case
Execution sequence of component and various components etc..
Accordingly, it in operational trials scheme provided by this specification embodiment, can specifically obtain in several ways
For carrying out the test case of operational trials.
In a kind of specific embodiment of this specification embodiment, it can be specified and write before testing by tester
The test case of completion, test case can be stored in advance in background server, be called when testing beginning by test macro
Specified test case, such as the use-case ID of research staff's nominative testing use-case, and test macro calls this to test institute according to ID
The test case used;
In another specific embodiment of this specification embodiment, tester can not write before testing
Whole test case, and the test suite that uses needed for specifying before testing and each test suite execute sequence, test suite
It can be stored in advance in background server, specified test suite be called by test macro when testing and starting, according to execution
Sequence constitutes and obtains test case;
Specifically, it can determine first in this operational trials, then several object runs that institute's test business includes mention
The keyword of determined each object run is taken, thus according to extracted keyword and the keyword and test case of operation
Default corresponding relationship, obtain the test case for carrying out operational trials.
It is of course also possible to realize by other means, or realization is combined in various ways.As tester can be preparatory
The common test case in part is write, when testing beginning, test macro is inquired first with the presence or absence of existing test case, if
It is then to call directly ready-made test case, if it is not, then prompting tester's nominative testing component and executing sequence, or directly
It is determined according to the instruction before tester and needs the test suite called and execute sequence, it even, can be raw by test macro
At test case storage to background system, to be called directly when carrying out next time after identical operational trials;Etc., this
Specification embodiment does not limit this, and those skilled in the art can flexibly set according to actual needs.
S102 parses the test case, obtains defined in several test suites for including in the use-case and the use-case
Each test suite executes sequence;
S103 executes sequence according to described, successively executes obtained each test suite;Wherein, each test group is executed
Following functions as shown in Figure 2 are executed when part:
S103a determines that associated data defined in this test suite obtains rule in the case where needing to obtain associated data
Then;The associated data is the data that need to be obtained from other test suites of the test case;
S103b obtains rule according to the associated data, obtains required association from the test suite that the rule is specified
Data;
S103c completes the operation of this test suite based on associated data obtained.
As previously described, it in operational trials scheme provided by this specification embodiment, is not written in test suite
Specific associated data, but obtain associated data automatically during the test, thus in the case where not needing interrupt test,
Automatically it realizes the data transmitting of different components, and completes entire operational trials glibly.
Therefore the acquisition rule for automatically obtaining associated data can be defined, is being needed in advance when writing test suite
In the case where obtaining associated data, determine that associated data defined in this test suite obtains rule, specifically, this specification
Associated data defined in embodiment obtains rule, can be obtained and be advised according to the associated data there are many form, accordingly
Then, the process of required associated data is obtained from the test suite that the rule is specified, it can also there are many implementation, this theorys
In bright book embodiment without limitation to this.
In a kind of specific embodiment of this specification embodiment, associated data, which obtains in rule, can be specifically defined pass
Join data path, the test suite where associated data for indicating required.Therefore, rule are being obtained according to the associated data
Then, when obtaining required associated data from the test suite that the rule is specified, it can determine that the associated data obtains first
Associated data path defined in rule, then according to the associated data path, from test suite corresponding in the path
Associated data needed for obtaining.
In another specific embodiment of this specification embodiment, it can also include closing in rule that associated data, which obtains,
Join data subpath, for indicating the position of required associated data in the corresponding test suite of the associated data path.
Therefore, according to identified associated data path, required associated data is obtained from test suite corresponding in the path
When, the test suite for obtaining associated data can be determined first according to the associated data path, and, according to the association
Data subpath determines position of the associated data in the test suite, then obtains and determines in determined test suite
The associated data of position.
In another specific embodiment of this specification embodiment, it can also include closing in rule that associated data, which obtains,
Join data type, the data in each test suite can be multiple types, for example, can for required parameter, operation result, etc.
Multiple types.Therefore, it according to identified associated data path, is obtained from test suite corresponding in the path required
When associated data, it can determine the test suite for obtaining associated data first according to the associated data path, then obtain institute
Determine the data of associated data type described in test suite.
The not concrete form of qualified association data acquisition rule and corresponding according to rule in this specification embodiment
The concrete mode of associated data is obtained, also, by taking three kinds of specific embodiments above as an example, can also include simultaneously in rule
Associated data path, subpath and data type.Those skilled in the art can flexibly set data according to actual needs
Obtain rule and data acquiring mode.
For example, associated data, which obtains rule, can pass through code " { rq=zj1_name:$ in a specific example
.request.xxxx form } " indicates, wherein rq refers to that the type for the associated data that acquisition need to obtain is required parameter
(request), zj1_name is the mark of the test suite in associated data source, and $ .request.xxxx is indicated from zj1_name
The required parameter data that specific location is xxxx are obtained in this test suite.
In another specific example, associated data, which obtains rule, can also pass through code " { rs=zj2_name:$
.result.xxxx form } " indicates, wherein rs refers to that the type for the associated data that acquisition need to obtain is operation result
(result), zj2_name be associated data source test suite mark, $ .result.xxxx indicate from zj2_name this
The operation result data that specific location is xxxx are obtained in one test suite.
Certainly, it when executing some test suite, can be associated with from other one or more test suites
Data.
In addition, so-called associated data in this specification embodiment, can be equivalent to local variable.For in test process
The global variable that need to be used is usually to write direct variable in code, but the shortcomings that this scheme is test in the prior art
Code can not be multiplexed.And in operational trials scheme provided by this specification embodiment, based on the mode similar with associated data,
The acquisition rule of global variable can be defined in test case in advance, and during implementation of test cases, need to obtain
When taking global variable, according to the value of defined Rule global variable, to keep test case more general.
In a kind of specific embodiment of this specification embodiment, needs can be defined by way of key-value
The global variable of acquisition the key of global variable can specifically be written in code when writing test suite in advance, and real
The test suite is quoted on border in test case, and execute test suite carry out operational trials when, the page of front end can be passed through
Fill in value in face.
In addition, as shown in figure 3, the operational trials scheme that this specification embodiment provides, can be applied to include preceding end page
The test macro in face and back-end server, tester can write test suite and test case by front end page in advance,
And be stored in back-end server, in operational trials, the number such as value of global variable can also be filled in by front end page
According to.And when operational trials, operation system to be tested call and execute test suite in the back-end server of test macro with
Test case realizes the operational trials to the operation system.
Below with reference to one, more specifically example, the service test method provided this specification are illustrated.
Assuming that need to carry out certain purchase system operational trials, the multi-mode operation being directed in user's shopping process,
For example, then user can search commodity, user in the merchandise query page by inputting user name and password login account first
Certain part commodity in lookup result can be clicked, are browsed into item detail page, and the commodity can be added and be done shopping
Vehicle generates purchase order, final clearing payment.
For purchase system operational trials in, can by login account, search commodity, check details, generation order
Single and clearing 5 test suites of payment, the corresponding operating being separately implemented in above-mentioned shopping process.
In addition, there is the transmitting of multiple data between 5 test suites, for example, purchase system can have been stepped on according to user
The information of account is recorded, lookup result is presented for different user customization, that is, needs the login result data in login account component,
It is transmitted to and searches in commodity components;For another example, it when carrying out clearing payment for the amount of money of order generated, needs that order will be generated
Order result data in component is transmitted in clearing payment component;Etc..
Tester can write above-mentioned 5 test suites in the front end page of test macro in advance, and write packet
It includes above-mentioned 5 test suites and defines the test case of execution sequence, test suite and test case can store in rear end
Server.
When carrying out operational trials, above-mentioned operation system can call the test case write in advance, and parsing use-case obtains it
In test suite and definition execute sequence, to execute each test suite in sequence.Executing each test suite
When, such as when execution clearing payment test suite, determination needs to obtain associated data " the order amount of money ", it is determined that this test suite
Defined in associated data obtain rule, such as can be " { rs=payInit:$ .result.xxxx } ".After obtaining associated data
The operation of this test suite can be completed based on associated data obtained.
As it can be seen that using above scheme, it, can be according to defined if running test suite during operational trials
Rule obtains data from other specified test suites automatically, to complete each survey in the case where not needing interrupt test
Try the operation of component.Further, since specific associated data is not written in test suite, each test suite can be in difference
Operational trials in be multiplexed.Therefore, this programme can reduce artificial needed for the operational trials and time, improve testing efficiency, and
Complete entire operational trials glibly automatically.
Corresponding to above method embodiment, this specification embodiment also provides a kind of operational trials device, referring to fig. 4 institute
Show, the apparatus may include:
Test case obtains module 110, for obtaining the test case for carrying out operational trials;
Test case parsing module 120 obtains several test groups for including in the use-case for parsing the test case
Each test suite defined in part and the use-case executes sequence;
Test suite execution module 130 successively executes obtained each test suite for executing sequence according to described;
Wherein, test suite execution module executes each test suite especially by following submodule:
It obtains rule and determines submodule 131, for determining in this test suite in the case where needing to obtain associated data
The associated data of definition obtains rule;The associated data is the number that need to be obtained from other test suites of the test case
According to;
Associated data acquisition submodule 132, for obtaining rule according to the associated data, the test specified from the rule
Required associated data is obtained in component;The operation of this test suite is completed based on associated data obtained.
Shown in Figure 5 in a kind of specific embodiment that this specification provides, the test case obtains module
110, comprising:
Business operation determines submodule 111, for determining in this operational trials, several targets that institute's test business includes
Operation;
Keyword extraction submodule 112, for extracting the keyword for determining each object run;
Test case acquisition submodule 113, for being used according to the keyword and test of extracted keyword and operation
The default corresponding relationship of example, obtains the test case for carrying out operational trials.
In a kind of specific embodiment that this specification provides, the associated data acquisition submodule 132, referring to Fig. 6
It is shown, comprising:
Path determining unit 132a, for determining that the associated data obtains associated data path defined in rule;Institute
State the test suite where associated data of the associated data path for indicating required;
Data capture unit 132b is used for according to the associated data path, from test suite corresponding in the path
Associated data needed for obtaining.
In a kind of specific embodiment that this specification provides, the associated data is obtained in rule further include: association
Data subpath, for indicating: position of the required associated data in the corresponding test suite of the associated data path;
The data capture unit 132b, is specifically used for:
According to the associated data path, the test suite for obtaining associated data is determined;And
According to the associated data subpath, position of the associated data in the test suite is determined;
Obtain the associated data of the determined position in determined test suite.
In a kind of specific embodiment that this specification provides, the associated data is obtained in rule further include: association
Data type;
The data capture unit 132b, is specifically used for:
According to the associated data path, the test suite for obtaining associated data is determined;
Obtain the data of associated data type described in determined test suite.
The function of modules and the realization process of effect are specifically detailed in the above method and correspond to step in above-mentioned apparatus
Realization process, details are not described herein.
This specification embodiment also provides a kind of computer equipment, includes at least memory, processor and is stored in
On reservoir and the computer program that can run on a processor, wherein processor realizes business above-mentioned when executing described program
Test method.This method includes at least:
A kind of service test method, this method comprises:
Obtain the test case for carrying out operational trials;
The test case is parsed, obtains respectively surveying defined in several test suites for including in the use-case and the use-case
Examination component executes sequence;
Sequence is executed according to described, successively executes obtained each test suite;Wherein, it is held when executing each test suite
Row following functions:
In the case where needing to obtain associated data, determine that associated data defined in this test suite obtains rule;Institute
Stating associated data is the data that need to be obtained from other test suites of the test case;
Rule is obtained according to the associated data, obtains required associated data from the test suite that the rule is specified;
The operation of this test suite is completed based on associated data obtained.
Fig. 7 shows one kind provided by this specification embodiment and more specifically calculates device hardware structural schematic diagram,
The equipment may include: processor 1010, memory 1020, input/output interface 1030, communication interface 1040 and bus
1050.Wherein processor 1010, memory 1020, input/output interface 1030 and communication interface 1040 are real by bus 1050
The now communication connection inside equipment each other.
Processor 1010 can use general CPU (Central Processing Unit, central processing unit), micro- place
Reason device, application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or one
Or the modes such as multiple integrated circuits are realized, for executing relative program, to realize technical side provided by this specification embodiment
Case.
Memory 1020 can use ROM (Read Only Memory, read-only memory), RAM (Random Access
Memory, random access memory), static storage device, the forms such as dynamic memory realize.Memory 1020 can store
Operating system and other applications are realizing technical solution provided by this specification embodiment by software or firmware
When, relevant program code is stored in memory 1020, and execution is called by processor 1010.
Input/output interface 1030 is for connecting input/output module, to realize information input and output.Input and output/
Module can be used as component Configuration (not shown) in a device, can also be external in equipment to provide corresponding function.Wherein
Input equipment may include keyboard, mouse, touch screen, microphone, various kinds of sensors etc., output equipment may include display,
Loudspeaker, vibrator, indicator light etc..
Communication interface 1040 is used for connection communication module (not shown), to realize the communication of this equipment and other equipment
Interaction.Wherein communication module can be realized by wired mode (such as USB, cable etc.) and be communicated, can also be wirelessly
(such as mobile network, WIFI, bluetooth etc.) realizes communication.
Bus 1050 include an access, equipment various components (such as processor 1010, memory 1020, input/it is defeated
Outgoing interface 1030 and communication interface 1040) between transmit information.
It should be noted that although above equipment illustrates only processor 1010, memory 1020, input/output interface
1030, communication interface 1040 and bus 1050, but in the specific implementation process, which can also include realizing normal fortune
Other assemblies necessary to row.In addition, it will be appreciated by those skilled in the art that, it can also be only comprising real in above equipment
Component necessary to existing this specification example scheme, without including all components shown in figure.
This specification embodiment also provides a kind of computer readable storage medium, is stored thereon with computer program, the journey
Service test method above-mentioned is realized when sequence is executed by processor.This method includes at least:
A kind of service test method, this method comprises:
Obtain the test case for carrying out operational trials;
The test case is parsed, obtains respectively surveying defined in several test suites for including in the use-case and the use-case
Examination component executes sequence;
Sequence is executed according to described, successively executes obtained each test suite;Wherein, it is held when executing each test suite
Row following functions:
In the case where needing to obtain associated data, determine that associated data defined in this test suite obtains rule;Institute
Stating associated data is the data that need to be obtained from other test suites of the test case;
Rule is obtained according to the associated data, obtains required associated data from the test suite that the rule is specified;
The operation of this test suite is completed based on associated data obtained.
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.
As seen through the above description of the embodiments, those skilled in the art can be understood that this specification
Embodiment can be realized by means of software and necessary general hardware platform.Based on this understanding, this specification is implemented
Substantially the part that contributes to existing technology can be embodied in the form of software products the technical solution of example in other words,
The computer software product can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are to make
It is each to obtain computer equipment (can be personal computer, server or the network equipment etc.) execution this specification embodiment
Method described in certain parts of a embodiment or embodiment.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipment
The combination of any several equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality
For applying example, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to embodiment of the method
Part explanation.The apparatus embodiments described above are merely exemplary, wherein described be used as separate part description
Module may or may not be physically separated, can be each module when implementing this specification example scheme
Function realize in the same or multiple software and or hardware.Can also select according to the actual needs part therein or
Person's whole module achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not the case where making the creative labor
Under, it can it understands and implements.
The above is only the specific embodiment of this specification embodiment, it is noted that for the general of the art
For logical technical staff, under the premise of not departing from this specification embodiment principle, several improvements and modifications can also be made, this
A little improvements and modifications also should be regarded as the protection scope of this specification embodiment.