CN108540351A - The automated testing method of distributed big data service - Google Patents

The automated testing method of distributed big data service Download PDF

Info

Publication number
CN108540351A
CN108540351A CN201810362027.3A CN201810362027A CN108540351A CN 108540351 A CN108540351 A CN 108540351A CN 201810362027 A CN201810362027 A CN 201810362027A CN 108540351 A CN108540351 A CN 108540351A
Authority
CN
China
Prior art keywords
interface
data
label
service
type
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.)
Granted
Application number
CN201810362027.3A
Other languages
Chinese (zh)
Other versions
CN108540351B (en
Inventor
马春燕
李尚儒
王慧朝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Northwestern Polytechnical University
Original Assignee
Northwestern Polytechnical University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Northwestern Polytechnical University filed Critical Northwestern Polytechnical University
Priority to CN201810362027.3A priority Critical patent/CN108540351B/en
Publication of CN108540351A publication Critical patent/CN108540351A/en
Application granted granted Critical
Publication of CN108540351B publication Critical patent/CN108540351B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/0246Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols
    • H04L41/0266Exchanging or transporting network management information using the Internet; Embedding network management web servers in network elements; Web-services-based protocols using meta-data, objects or commands for formatting management information, e.g. using eXtensible markup language [XML]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention proposes a kind of automated testing method of distributed big data service, and the description of test interface is carried out using XML Schema, it is proposed that corresponding specification can effectively be described the API of web applications or cloud platform.By the description of the XML to API, the present invention can automatically generate cycle tests, test script and test data.Through the invention, user only needs the API to web applications or cloud platform to be described, cycle tests can automatically be built, generate test data, to achieve the purpose that automatic test, dramatically reduce the workload of user, the efficiency and accuracy rate for improving test, reduce the cost of test.Web can also be applied simultaneously or cloud platform carries out the test job that the manual testings such as pressure test are difficult completion.

Description

The automated testing method of distributed big data service
Technical field
The present invention relates to the automatization testing technique field of distributed big data service, specially a kind of distributed big data The automated testing method of service.
Background technology
Internet increases with surprising rapidity, and network application has penetrated into the various aspects of people's life.Currently, cloud meter It is various Distributed Services (including infrastructure services, storage service to calculate platform (such as Amazon, Azure, Oracle and Huawei) And data service) metastable Application Programming Interface (API) is provided.
Cloud computing attracts more and more developers that its Web applications are moved to cloud platform.Under cloud concept, Web is answered Development is different from traditional middle-size and small-size stand-alone application, and web application is becoming with big data storage, big server The distributed application program of background and cross-platform multiple users (such as ends PC, the ends Android, the ends IOS and wechat end etc.), For the user terminal platform for adapting to different, Web application controls layer gradually provides stable application interface API, to realize control layer It is cross-platform with background service.
Application and service is unfolded around data storage and access in cloud computing platform or Web application control layers, they are to client The API majorities that end provides are centered on data service, these API are known as data service API, such as travel in a Web In information system, control layer service of goods offer connects the API application programmings of several additions, modification, lookup and the deletion of product Mouthful;In an offer platform and the cloud computing platform of application level service, Web conference service provide to several increases of meeting, Modification, the API Application Programming Interface searched and deleted.In general, the data service API of each data entity can be divided into 4 Type:Interpolation data, searching data, modification data and deletion data.
Along with cloud computing platform and the data service API of Web application control layers not only appearance and its extensive use, Wide variety of conventional, repetition and distribution concurrent test demand are gradually brought into schedule, for example, cloud computing platform and Web apply it is integrated, During safeguarding and developing upgrading, data service API can't be changed, but be needed repeatedly to the test of these API It carries out.Since current data service API quantity is more, application system is huge, terminal system is various, service arrangement updates and iteration frequency The reasons such as numerous, manual manual testing's cloud computing platform and the burden weight of Web applications, efficiency are low, of high cost, or even can not complete point Cloth test target, institute in a distributed manner big data service API automatic test become more and more important.Currently, state Inside and outside expert, scholar and enterprise technology personnel have been achieved for some achievements in terms of software automated testing, for example, test foot This automatic execution, the Test data generation of the single API individually serviced, but still there are following challenges:
1, it cannot be automatically generated towards the single or multiple API sequence of test data being served by and Test oracles;
2, it cannot be automatically generated test script.
Invention content
Since the api interface of data service is stablized, and addition, modification, lookup can be divided into and delete 4 types Operation, meanwhile, the service logic of data-oriented service is simultaneously uncomplicated, and multiplicity is high, but test volume is big, so, distributed data Service has the condition of automatic test.The present invention is directed to the characteristics of distributed big data services API, proposes a kind of distributed big The automated testing method of data service, including test interface Description standard example generate, and based on test interface description rule The cycle tests of model, the automation generation technique of test data, Test oracles and test script.
Through the invention, user may be implemented individually to service automatically generating for API sequence of test data and Test oracles, with And relevant several service API sequence of test data and Test oracles automatically generate.These test datas and test Prophesy, apply integrated of cloud computing platform and Web and develop it is during upgrading can be multiplexed many times, tested according to these API Sequence and data, present invention also proposes the method for automatically generating test script, according to test script can to data service into Row distribution concurrent test.The present invention can apply to the development of cloud computing platform, Web system and other data service systems In, in the case of less manual intervention, automatic test is carried out to data service, continuously to promote these systems to exist The raising of quality control level integrated and in differentiation.
The technical scheme is that:
A kind of automated testing method of the distributed big data service, it is characterised in that:Include the following steps:
Step 1:Establish the example based on XML Schema test interface Description standards;The Description standard of the test interface Interface message is described by XML tag, content includes information on services label, operation label, interface label, request mark Label, responsive tags, the constrained type label for relying on label and data label and data label;7 kinds of numbers that Description standard is supported It is respectively 3 kinds of data types that XML Schema are supported according to type:Onboard data type, simple data type, complex data class Type and additional 4 kinds of data types, respectively file data type, picture data type, audio data type and video counts According to type;
Step 2:Using the instance document based on XML Schema test interface Description standards that step 1 obtains as input, It parses each document respectively, in resolving, the information storage in document will be described in following variable:
Variable OperaterTypesMap:Type is gathered for key-value, and key values are the mark id of Service Instance, Value values are the operation label contained by Service Instance;The variable is used for all action types of storage service;
Variables A ddInterfaceSetMap, DeleteInterfaceSetMap, UpdateInterfaceSetMap, FindInterfaceSetMap:Type is gathered for key-value, and key values are that mark id, the value value of Service Instance are interface Set;Element is in set of interfaces:The parameter list of interface identifier id, request data and response data;It is every in parameter list A parameter includes two attributes of parameter type and parameter name;The concrete operations that the variable is used to store in operations type are real Example;
Variable ParameterConstrainsMap:Type is gathered for key-value, and key values are the mark of Service Instance Id, value value are the constraint set of interface;Element is in constraint set:Interface identifier id, restriction on the parameters list;Restriction on the parameters List includes parameter name and constraints;The variable is used to store the constraint of the parameter of every concrete operations;
Variable Premises:Type is to gather, and element value is the service mark of forerunner's service of current service example in set Know id;
Step 3:Automatically generate operation test pattern:
The OperaterTypesMap that step 2 is obtained as input, according to the mark id of Service Instance and Value values in OperaterTypeMap, the operation for including in OperaterTypesMap variables is combined, is accorded with The regular expression set for sharing family use habit operates test pattern accordingly as Service Instance;
Step 4:API cycle tests and test script are automatically generated based on operation test pattern:
The actual sequence of operation of operation test pattern generation obtained according to step 3;It is not met according to constraint rule deletion It is required that the sequence of operation;The constraint rule is:
In one sequence of operation, add quantity should be more than delete quantity before update, otherwise delete the operation sequence Row;In one sequence of operation, add quantity should be more than delete quantity, otherwise delete the sequence of operation;
After determining the sequence of operation, api interface set under label will be respectively operated in the sequence of operation and is carried out according to the sequence of operation Arrangement, obtains API cycle tests;
Each API cycle tests is written respectively as test script again;
Step 5:Automatic Data Generation Test:
The parameter ParameterConstrainsMap that the test script and step 2 obtained using step 4 obtains as input, The test data for exporting each interface, the specific steps are:
Step 5.1:Static table is generated, while generating the 1st, 2 row of dynamic table according to the test script that step 4 obtains;
The static table is used to enumerate each action type and corresponds to the action type relied on;The action type that wherein find is relied on For add, update, delete;The action type that update is relied on is add, find;The action type that delete is relied on is add, find,update;
The dynamic table includes 5 row, and the 1st row indicate that ordinal position of the interface in script, the 2nd row indicate interface class Type, the 3rd row indicate that the object identity in test input data and referent attribute, the 4th row indicate the output of the interface, the 5 row indicate the Test oracles of the interface, record interface anticipated output;
Step 5.2:Dynamic table is iterated according to the interfacing order in test script, rule of iteration is as follows:
Step a:Since first interface, data in the corresponding dynamic table of interface are generated one by one, until all Data generate;Judge current interface IiAction type be add then go to step b, otherwise go to step c;
Step b:Current interface IiAction type be add, test data is generated according to Black-box Testing principle, and is each The unique key of data set generation, and filled in the 3rd row in dynamic table, the 4th row fill in interface identifier, and the 5th is classified as It is empty;Step a is gone to after the completion, generates the data of next interface;
Step c:Current interface IiAction type be not add, then the front port I of the input data dependence of the interfacejIt is defeated Enter data, j<I, input data dependent Rule are:
Nearby principle is followed, is paid the utmost attention to from current interface IiNearest interface Ij;Control static table judges interface IjBehaviour Make whether type is interface IiIt is dependable;If not rely on, then it traverses forward, until finding dependable interface;If It relies on, compares interface IiInput parameter and interface IjInput parameter or return parameters, if interface IjInput parameter or return It returns parameter and disclosure satisfy that interface IiThe requirement of input parameter is then interface IjWith interface IiData dependence relation is established, by interface Ij Data Identification be filled into interface IiDuring dynamic table the 3rd arranges, while by interface IiReality output inserts interface IiDynamic table the 4th arranges, Expected results insert interface IiDynamic table the 5th arranges, and goes to step a after the completion, generates the data of next interface;If interface Ij's Input parameter or return parameters are ineligible, then traverse forward, until finding the interface of next dependence;
Wherein, if current interface IiAction type be that delete and input data are identified as id1, need to be by interface IiBefore All Data Identifications are id1The data of interface empty;If current interface IiAction type be that update and input data are identified as id1, need to be by interface IiAll input datas are identified as id before1The corresponding data of interface is changed to newest data;
Step d:Ultimately generate the test data of JSON formats.
Further preferred embodiment, a kind of automated testing method of distributed big data service, it is characterised in that:
XML tag in step 1 is specifically divided into:
Information on services label<resources>:Description content is information on services;Attribute includes service identifiers id, Service name Claim name, domain name base, forerunner's service identifiers premise;The priority of information on services label is 0, is the root of all labels;
Label is operated, including<add><delete><update><find>:Description content is addition, deletes, updates and look into Look for operation;Priority is 1;<add>The behavior of operation:It adds in several parameters to service;<delete>The behavior of operation:It deletes Accordingly<add>Operate all parameters of addition;<update>The behavior of operation:Modification is corresponding<add>Some or all of addition Parameter;<find>Operation behavior:Inquire one or more of storage service parameter information;
Interface label<resource>:Description content is the information of interface;Attribute includes interface identifier id, interface name Name, the actual address path of request;Priority is 2;
Ask label<request>And responsive tags<response>:The request and response of user are described;Attribute includes number According to type dataType;Priority is 3;
Rely on label<dependency>:The operate interface that the service is relied on is described;Attribute includes parameter name The id of the id of resouces corresponding with service, resource corresponding interface;
Data label<param>:The information of required parameter is described;Attribute includes parameter name name, corresponding attribute-name Claim attribute, parameter type type, whether characterising parameter is necessary required;Priority is 4.
Data label<data>:Data from response message are described;Attribute includes name data names, type data class Type;Priority is 4;
Data label<element>:Container Type element is described;Attribute includes data name name, data type type; Priority is 5;And<param>、<data>It is under label or self-contained;
The constrained type label of data label<restriction>:Constraints is described;<param>、<data>、< element>Under label.
Further preferred embodiment, a kind of automated testing method of distributed big data service, it is characterised in that:
Test script in step 4 includes the attribute value below 4 labels and label:
<script>Label, containing attribute resourcesID, attribute value is the value that corresponding with service identifies id;<script> Label priority is 0;
<step>Label, containing two attributes of path and operation, attribute path values are the paths url of corresponding interface, Attribute operation values are corresponding interface action type;<step>Label priority 1;
<param>Label, containing tri- attributes of name, attribute and value, attribute name recording parameters titles belong to Property attribute recording parameters corresponding attribute in affiliated class, the corresponding expected results of attribute value record;<param>Label Priority 2;
<response>Label, without attribute, priority 1.
Further preferred embodiment, a kind of automated testing method of distributed big data service, it is characterised in that: In step 3, the OperaterTypesMap that step 2 is obtained is real according to service in conjunction with 4 kinds of operative combination situations as input Value values in the mark id and OperaterTypeMap of example, the operation for including in OperaterTypesMap variables is carried out Combination, the regular expression set for obtaining meeting user's use habit operate test pattern accordingly as Service Instance;
4 kinds of operative combination situations are:Service only exists two kinds of operations of add, find;Service there are add, delete, Tri- kinds of operations of find;There are tri- kinds of operations of add, update, find for service;There are add, update, delete, find tetra- for service Kind operation;
The operation test pattern of each operative combination is:
When service only exists two kinds of add, find operation, operation mode is add (add | find) * find;
When service is there are when tri- kinds of add, delete, find operation, operation mode is add (add | delete | find) * Find and add (add | find) * find;
When service is there are when tri- kinds of add, update, find operation, operation mode is add (add | update | find) * Find and add (add | find) * find;
When service is there are when tetra- kinds of add, update, delete, find operation, operation mode be add (add | update | Delete | find) * find, add (add | delete | find) * find, add (add | update | find) * find and add (add|find)*find。
Further preferred embodiment, a kind of automated testing method of distributed big data service, it is characterised in that: In step 4 when the sequence of operation actual according to operation test pattern generation, the * values operated in test pattern are wanted according to user Ask determining, if user does not require, * occurrences are that (the service interface quantity+update that add operations include, which is operated, includes Service interface quantity+delete operate the service interface quantity for including) * 2-2.
Further preferred embodiment, a kind of automated testing method of distributed big data service, it is characterised in that: API cycle tests create-rule is in step 4:The flute card of api interface set corresponding to label will be respectively operated in the sequence of operation The set of your product as API cycle tests, the sequence of API is according to the corresponding position in the sequence of operation in API cycle tests It carries out;Operate variables A ddInterfaceSetMap of the api interface set in the step 2, DeleteInterfaceSetMap、UpdateInterfaceSetMap、FindInterfaceSetMap。
Advantageous effect
The present invention carries out the description of test interface using XML Schema, it is proposed that corresponding specification, it can be effectively right Web is applied or the API of cloud platform is described.By the description of the XML to API, the present invention can automatically generate cycle tests, Test script and test data.
Through the invention, user only needs that web applications or the API of cloud platform is described, can automatically structure Build cycle tests, generation test data dramatically reduces the workload of user, carry to achieve the purpose that automatic test The efficiency and accuracy rate of height test, reduce the cost of test.Web can also be applied simultaneously or cloud platform carries out pressure test Equal manual testings are difficult the test job completed.
The additional aspect and advantage of the present invention will be set forth in part in the description, and will partly become from the following description Obviously, or practice through the invention is recognized.
Specific implementation mode
The embodiment of the present invention is described below in detail, the embodiment is exemplary, it is intended to for explaining the present invention, and It is not considered as limiting the invention.
The present invention solves the problems, such as automatically generating for data service API sequence of test data, Test oracles and test script, hair Bright includes the following contents and technology:
1) XML schema are used, a kind of data service test interface Description standard is defined.Data service test interface Description standard includes the essential information and its service name relied on of the service, belonging to the API set of the service and each API Action type, the information and returned data information of required input parameter.
2) addition of data-oriented service, 4 generic operation types of modification, lookup and deletion, it is proposed that retouched based on test interface The test model of example and corresponding test pattern are stated, and test interface can be parsed automatically and describe example, is generated by canonical table The test pattern described up to formula.
3) it is based on test pattern, according to related algorithm, the cycle tests of automatically generated data service API, test data, survey The pre- test script of making peace of examination.
Specific technical solution is:
Step 1:Establish the example based on XML Schema test interface Description standards;
Invention defines the Description standards of test interface;The Description standard of the test interface is docked by XML tag Message breath is described, and content includes information on services label, operation label, interface label, request label, responsive tags, dependence The constrained type label of label and data label and data label;7 kinds of data types that Description standard is supported are respectively XML 3 kinds of data types that Schema is supported:Onboard data type, simple data type, complex data type and 4 kinds additional Data type, respectively file data type, picture data type, audio data type and video data type;
XML tag in the Description standard of test interface based on XML Schema is specifically divided into:
Information on services label<resources>:Description content is information on services;Attribute includes service identifiers id, Service name Name, domain name base, forerunner's service identifiers premise is claimed (to indicate the service dependent on the clothes that service identifiers are premise values Business;Permissible value is sky, is indicated independent of any service);The priority of information on services label is 0, is the root of all labels;Example Such as:<Resources id=" Product_Service " name=" ProductController " base=" http://" Premise=" ">.
Label is operated, including<add><delete><update><find>:Description content is addition, deletes, updates and look into Operation, the present invention is looked for be classified as each API of data service<add>、<delete>、<update>With<find>Deng 4 kinds One kind of action type;It is 1 to operate label priority;<add>The behavior of operation:It adds in several parameters to service;<delete >The behavior of operation:It deletes corresponding<add>Operate all parameters of addition;<update>The behavior of operation:Modification is corresponding<add> Some or all of addition parameter;<find>Operation behavior:Inquire one or more of storage service parameter information.
Interface label<resource>:Description content is the information of interface;Attribute includes interface identifier id, interface name Name, the actual address path of request;Priority is 2.Such as:<Resource id=" Product_New " name=" AddProduct " path=" addProduct ">…</resource>.
Ask label<request>And responsive tags<response>:The request and response of user are described;Attribute includes number According to type dataType;Priority is 3.Such as:<Response dataType=" JSON ">…</response>.
Rely on label<dependency>:The operate interface that the service is relied on is described;Attribute includes parameter name The id of the id of resouces corresponding with service, resource corresponding interface;If (a service A services B dependent on another, When then servicing B and modifying, delete, service A may be influenced, so to express clearly dependence).Such as:<dependency Resources=" Product_Service " resource=" Product_New ">, indicate that the service depends on service identifiers The interface for being Product_New for the interface identifier in the service of Product_Service.
Data label<param>:The information of required parameter is described;Attribute includes the parameter name name (names of required parameter Claim), corresponding Property Name attribute (attribute in the affiliated class of parameter), parameter type type (true/false), description Whether parameter is necessary required;Priority is 4.Such as:<Param name=" feature " attribute=" Product.feature " type=" String "/>.
Data label<data>:Data from response message are described;Attribute includes name data names, type data class Type;Priority is 4;Such as:<Data name=" userName " type=" String "/>.
Data label<element>:Container Type element is described;Attribute includes data name name, data type type; Priority is 5;And<param>、<data>It is under label or self-contained;Such as:<Element name=" ProductInfo " type=" String "/>.
The constrained type label of data label<restriction>:Constraints is described;<param>、<data>、< element>Under label.
Based on above-mentioned interface Description standard, the example based on XML Schema test interface Description standards of service is established. For example, certain Tourism Information System service of goods example includes:
1) service identifiers are " Product_Service ", and service name is " ProductController ", and domain name is " http:// ", no service forerunner;
2) there are 7 api interfaces, 4 kinds of action types
A) add action types include 2 api interfaces, i.e. addProduct and addProductBasicInformation.
B) delete action types include 1 api interface, i.e. deleteProduct.
C) update action types include 2 api interfaces, i.e. editProductBiscInformation and editProductBisc。
D) find action types include 2 api interfaces, i.e. displayproducts and showProductDetail.
Assuming that above-mentioned add action types, interface identifier therein is Product_New, entitled addProduct, address For the interface of addProduct, it is assumed that there are one entitled feature, corresponding Property Names during it is asked is The parameter of Product.feature, type string, no returned data.It can thus be concluded that following example.
Step 2:Example is described to test interface to pre-process:
Using the instance document based on XML Schema test interface Description standards that step 1 obtains as input, solve respectively It analyses each document, in resolving, the information storage in document will be described in following variable:
Variable OperaterTypesMap:Type is gathered for key-value, and key values are the mark id of Service Instance, Value values are the operation label contained by Service Instance.Operation label specifically includes:<add>、<delete>、<update>、< find>;The variable is used for all action types of storage service.
Variables A ddInterfaceSetMap, DeleteInterfaceSetMap, UpdateInterfaceSetMap, FindInterfaceSetMap:Type is gathered for key-value, and key values are that mark id, the value value of Service Instance are interface Set.Element is in set of interfaces:The parameter list of interface identifier id, request data and response data;It is every in parameter list A parameter includes two attributes of parameter type and parameter name;The concrete operations that the variable is used to store in operations type are real Example;
Variable ParameterConstrainsMap:Type is gathered for key-value, and key values are the mark of Service Instance Id, value value are the constraint set of interface.Element is in constraint set:Interface identifier id, restriction on the parameters list;Restriction on the parameters List includes parameter name and constraints;The variable is used to store the constraint of the parameter of every concrete operations;
Variable Premises:Type is to gather, and element value is the service mark of forerunner's service of current service example in set Know id.
Step 3:Automatically generate operation test pattern:
The OperaterTypesMap that step 2 is obtained as input, according to the mark id of Service Instance and Value values in OperaterTypeMap, the operation for including in OperaterTypesMap variables is combined, is accorded with The regular expression set for sharing family use habit operates test pattern accordingly as Service Instance.
After the action type for analyzing mass data service API, two features have been obtained:As long as the 1, service that user uses, Centainly there is search operation, if one services itself and do not have find, he centainly depends on another service, another service Lookup to it is provided;2, the service of no add operations is meaningless.Therefore the present invention proposes 4 kinds of action type groups in table 1 Close situation, wherein multiple API of the possible corresponding with service of each action type.
1 operative combination of table
add delete Update Find
1 1 1 1 1
2 1 1 1
3 1 1 1
4 1 1
Method is directed to each case, and regular expressions are taken after determining action type, operation order in conjunction with user's use habit Formula mode indicates operation test pattern.The present invention proposes that the principle of operation test pattern is as follows:
1) consider that expected results providing, operate containing add, find in advance under, proposition add (add | find) * Find patterns;
2) it is to guarantee that abort situation is accurately positioned, on the basis of 1), adds update or delete operations, propose Add (add | delete | find) * find or add (add | update | find) * find patterns
3) on the basis of first two, and proposition add (add | update | delete | find) * find patterns
It is combined for different operation in table 14, the 4 generic operation patterns that the present invention automatically generates respectively include:
1) when service only exists two kinds of add, find operation, operation mode is add (add | find) * find;
2) when service is there are when tri- kinds of add, delete, find operation, operation mode is add (add | delete | find) * Find and add (add | find) * find;
3) when service is there are when tri- kinds of add, update, find operation, operation mode is add (add | update | find) * Find and add (add | find) * find;
4) when service is there are when tetra- kinds of add, update, delete, find operation, operation mode be add (add | update | delete | find) * find, add (add | delete | find) * find, add (add | update | find) * find and add (add|find)*find。
Step 4:API cycle tests and test script are automatically generated based on operation test pattern:
The operation test pattern that this step obtains step 3 is exported as input as test script.
The actual sequence of operation of operation test pattern generation obtained according to step 3.Here it is contemplated that test pattern Priority, as the foundation for determining script execution sequence.Define the regular quantity based on action type of priority.Action type Quantity is fewer, and priority is higher.
Specific regular expression is converted to operational order by this step, but needs to be deleted not according to constraint rule in advance The satisfactory sequence of operation;The constraint rule is:
In one sequence of operation, add quantity should be more than delete quantity before update, otherwise delete the operation sequence Row;In one sequence of operation, add quantity should be more than delete quantity, otherwise delete the sequence of operation;
The * values operated simultaneously in test pattern require to determine according to user, if user does not require, No. * specific Value is that (the service interface quantity+delete that the service interface quantity+update operations that add operations include include, which is operated, includes Service interface quantity) * 2-2.
After determining the sequence of operation, api interface set under label will be respectively operated in the sequence of operation and is carried out according to the sequence of operation Arrangement, obtains API cycle tests:Specifically API cycle tests create-rules are:It will respectively be operated in the sequence of operation corresponding to label Api interface set set of the cartesian product as API cycle tests, the sequence of API is according to grasping in API cycle tests Make corresponding position in sequence to carry out;Operate variables A ddInterfaceSetMap of the api interface set in the step 2, DeleteInterfaceSetMap、UpdateInterfaceSetMap、FindInterfaceSetMap。
We by taking the citing in step 1 as an example, add action types include 2 api interfaces (be respectively addProduct and AddProductBasicInformation), it (is respectively displayproducts that find action types, which include 2 api interfaces, And showProductDetail).It thus can be by the way that " add, find " operation mode obtain a test sequence containing 4 elements Row set.Set element includes:" addProduct, displayproducts ", " addProduct, ShowProductDetail ", " addProductBasicInformation, showProductDetail " and " addProductBasicInformation, showProductDetail ".
Each API cycle tests is written respectively as test test script again;Test script includes below 4 labels and label Attribute value:
<script>Label, containing attribute resourcesID, attribute value is the value that corresponding with service identifies id;<script> Label priority is 0.
<step>Label, containing two attributes of path and operation, attribute path values are the paths url of corresponding interface, Attribute operation values are corresponding interface action type;<step>Label priority 1;Label may include multiple<param>Mark Label.Sequence of the label in script and the sequence consensus in cycle tests, for instructing testing sequence.
<param>Label, containing tri- attributes of name, attribute and value, attribute name recording parameters titles belong to Property attribute recording parameters corresponding attribute in affiliated class, (attribute exists the corresponding expected results of attribute value record< response>Just exist when inside tags);<param>Label priority 2.
<response>Label, without attribute, priority 1;It may include multiple<param>Label.
Step 5:Automatic Data Generation Test:
The parameter ParameterConstrainsMap that the test script and step 2 obtained using step 4 obtains as input, Export the test data of each interface.For each test script, all there are one the interface sequences for generating data.It is executing Before algorithm, 2 reference tables.
1, static table, the reliable operation type for enumerating specific operation type.Such as table 2, the table left side indicates operation class Type (OperaterType), the right indicate the generic operation from Test data generation angle, record its action type relied on (DependOperaterType), for example, the id either add operations that the argument of find operations, which may be add operations, to be returned add Add an attribute in object.That is DependOperaterType provides partly or entirely required number for OperaterType According to.
2 static table of table
Action type The action type of dependence
find add,update,delete
update add,find
delete add,find,update
2, dynamic table will generate dynamic data according to script.As shown in chart 3, table includes 5 row, and the 1st row indicate that this connects Ordinal position of the mouth in script, the 2nd row indicate that interface type, the 3rd row indicate the object identity tested in input data and relate to And object properties, the 4th row indicate the interface output, the 5th row indicate the interface Test oracles, record interface be expected it is defeated Go out.
3 dynamic table example of table
It is as follows that we generate the step of data:
Step 5.1:Static table is generated, while generating the 1st, 2 row of dynamic table according to the test script that step 4 obtains;
The static table is used to enumerate each action type and corresponds to the action type relied on;The action type that wherein find is relied on For add, update, delete;The action type that update is relied on is add, find;The action type that delete is relied on is add, find,update;
The dynamic table includes 5 row, and the 1st row indicate that ordinal position of the interface in script, the 2nd row indicate interface class Type, the 3rd row indicate that the object identity in test input data and referent attribute, the 4th row indicate the output of the interface, the 5 row indicate the Test oracles of the interface, record interface anticipated output;
Step 5.2:Dynamic table is iterated according to the interfacing order in test script, rule of iteration is as follows:
Step a:Since first interface, data in the corresponding dynamic table of interface are generated one by one, until all Data generate;Judge current interface IiAction type be add then go to step b, otherwise go to step c;
Step b:Current interface IiAction type be add, test data is generated according to Black-box Testing principle, and is each The unique key of data set generation, and filled in the 3rd row in dynamic table, the 4th row fill in interface identifier, and the 5th is classified as It is empty;Step a is gone to after the completion, generates the data of next interface;
Step c:Current interface IiAction type be not add, then the front port I of the input data dependence of the interfacejIt is defeated Enter data, j<I, input data dependent Rule are:
Nearby principle is followed, is paid the utmost attention to from current interface IiNearest interface Ij;Control static table judges interface IjBehaviour Make whether type is interface IiIt is dependable;If not rely on, then it traverses forward, until finding dependable interface;If It relies on, compares interface IiInput parameter and interface IjInput parameter or return parameters, if interface IjInput parameter or return It returns parameter and disclosure satisfy that interface IiThe requirement of input parameter is then interface IjWith interface IiData dependence relation is established, by interface Ij Data Identification be filled into interface IiDuring dynamic table the 3rd arranges, while by interface IiReality output inserts interface IiDynamic table the 4th arranges, Expected results insert interface IiDynamic table the 5th arranges, and goes to step a after the completion, generates the data of next interface;If interface Ij's Input parameter or return parameters are ineligible, then traverse forward, until finding the interface of next dependence;
Wherein, if current interface IiAction type be that delete and input data are identified as id1, need to be by interface IiBefore All Data Identifications are id1The data of interface empty;If current interface IiAction type be that update and input data are identified as id1, need to be by interface IiAll input datas are identified as id before1The corresponding data of interface is changed to newest data;
Step d:Ultimately generate the test data of JSON formats.Test data will be stored in database, data in table It can dynamically be changed, remain newest.In addition to this, in entire test process, record log files, essential record are both needed to The variation of test data.
Description type, attribute and priority (the small label priority of numerical priority value of each labels of XML is given below Height, and include the big label of numerical priority value)
Description type, attribute and the priority of 4 each label of table
Provide specific file Preprocessing Algorithm:
Input:fileSet an test Interface Description file set
Output:OperaterTypesMap
AddInterfaceSetMap
DeleteInterfaceSetMap
UpdateInterfaceSetMap
FindInterfaceSetMap
ParameterConstrainsMap
premises
Provide specific test pattern generation algorithm
Input:OperaterTypesMap
Output:Model a set of regular expressions
Provide specific test script generating algorithm
Input:
AddInterfaceSetMap
DeleteInterfaceSetMap
UpdateInterfaceSetMap
FindInterfaceSetMap
Model the value of*
Output:A series of script files
Provide specific Test data generation algorithm
Input:
a series of script files
ParameterConstrainsMap
Output:
script variable contains testData
Although the embodiments of the present invention has been shown and described above, it is to be understood that above-described embodiment is example Property, it is not considered as limiting the invention, those skilled in the art are not departing from the principle of the present invention and objective In the case of can make changes, modifications, alterations, and variations to the above described embodiments within the scope of the invention.

Claims (5)

1. a kind of automated testing method of distribution big data service, it is characterised in that:Include the following steps:
Step 1:Establish the example based on XML Schema test interface Description standards;The Description standard of the test interface passes through Interface message is described in XML tag, and content includes information on services label, operation label, interface label, request label, sound The constrained type label answered label, rely on label and data label and data label;7 kinds of data class that Description standard is supported Type is respectively 3 kinds of data types that XML Schema are supported:Onboard data type, simple data type, complex data type, with And additional 4 kinds of data types, respectively file data type, picture data type, audio data type and video data class Type;
Step 2:Using the instance document based on XML Schema test interface Description standards that step 1 obtains as input, respectively It parses each document, in resolving, the information storage in document will be described in following variable:
Variable OperaterTypesMap:Type is gathered for key-value, and key values are mark id, the value value of Service Instance For the operation label contained by Service Instance;The variable is used for all action types of storage service;
Variables A ddInterfaceSetMap, DeleteInterfaceSetMap, UpdateInterfaceSetMap, FindInterfaceSetMap:Type is gathered for key-value, and key values are that mark id, the value value of Service Instance are interface Set;Element is in set of interfaces:The parameter list of interface identifier id, request data and response data;It is every in parameter list A parameter includes two attributes of parameter type and parameter name;The concrete operations that the variable is used to store in operations type are real Example;
Variable ParameterConstrainsMap:Type is gathered for key-value, and key values are the mark id of Service Instance, Value values are the constraint set of interface;Element is in constraint set:Interface identifier id, restriction on the parameters list;Restriction on the parameters list Including parameter name and constraints;The variable is used to store the constraint of the parameter of every concrete operations;
Variable Premises:Type is to gather, and element value is the service identifiers id of forerunner's service of current service example in set;
Step 3:Automatically generate operation test pattern:
The OperaterTypesMap that step 2 is obtained as input, according to the mark id of Service Instance and Value values in OperaterTypeMap, the operation for including in OperaterTypesMap variables is combined, is accorded with The regular expression set for sharing family use habit operates test pattern accordingly as Service Instance;
Step 4:API cycle tests and test script are automatically generated based on operation test pattern:
The actual sequence of operation of operation test pattern generation obtained according to step 3;It is deleted according to constraint rule undesirable The sequence of operation;The constraint rule is:
In one sequence of operation, add quantity should be more than delete quantity before update, otherwise delete the sequence of operation;One In a sequence of operation, add quantity should be more than delete quantity, otherwise delete the sequence of operation;
After determining the sequence of operation, api interface set under label will be respectively operated in the sequence of operation and is arranged according to the sequence of operation, Obtain API cycle tests;
Each API cycle tests is written respectively as test script again;
Step 5:Automatic Data Generation Test:
The parameter ParameterConstrainsMap that the test script and step 2 obtained using step 4 obtains is exported as input The test data of each interface, the specific steps are:
Step 5.1:Static table is generated, while generating the 1st, 2 row of dynamic table according to the test script that step 4 obtains;
The static table is used to enumerate each action type and corresponds to the action type relied on;Wherein find rely on action type be add,update,delete;The action type that update is relied on is add, find;The action type that delete is relied on is add, find,update;
The dynamic table includes 5 row, and the 1st row indicate ordinal position of the interface in script, and the 2nd row indicate interface type, and the 3rd Row indicate that the object identity in test input data and referent attribute, the 4th row indicate the output of the interface, the 5th list Show the Test oracles of the interface, record interface anticipated output;
Step 5.2:Dynamic table is iterated according to the interfacing order in test script, rule of iteration is as follows:
Step a:Since first interface, data in the corresponding dynamic table of interface are generated one by one, until all numbers According to generating;Judge current interface IiAction type be add then go to step b, otherwise go to step c;
Step b:Current interface IiAction type be add, according to Black-box Testing principle generate test data, and be each data Collection generates unique key, and is filled in the 3rd row in dynamic table, and the 4th row fill in interface identifier, and the 5th is classified as sky;It is complete Step a is gone to after, generates the data of next interface;
Step c:Current interface IiAction type be not add, then the front port I of the input data dependence of the interfacejInput number According to j<I, input data dependent Rule are:
Nearby principle is followed, is paid the utmost attention to from current interface IiNearest interface Ij;Control static table judges interface IjOperation class Whether type is interface IiIt is dependable;If not rely on, then it traverses forward, until finding dependable interface;If relying on , compare interface IiInput parameter and interface IjInput parameter or return parameters, if interface IjInput parameter or return ginseng Number disclosure satisfy that interface IiThe requirement of input parameter is then interface IjWith interface IiData dependence relation is established, by interface IjNumber It is filled into interface I according to markiDuring dynamic table the 3rd arranges, while by interface IiReality output inserts interface IiDynamic table the 4th arranges, it is contemplated that As a result filling interface IiDynamic table the 5th arranges, and goes to step a after the completion, generates the data of next interface;If interface IjInput Parameter or return parameters are ineligible, then traverse forward, until finding the interface of next dependence;
Wherein, if current interface IiAction type be that delete and input data are identified as id1, need to be by interface IiOwn before Data Identification is id1The data of interface empty;If current interface IiAction type be that update and input data are identified as id1, It need to be by interface IiAll input datas are identified as id before1The corresponding data of interface is changed to newest data;
Step d:Ultimately generate the test data of JSON formats.
2. a kind of automated testing method of distributed big data service according to claim 1, it is characterised in that:
XML tag in step 1 is specifically divided into:
Information on services label<resources>:Description content is information on services;Attribute includes service identifiers id, service name Name, domain name base, forerunner's service identifiers premise;The priority of information on services label is 0, is the root of all labels;
Label is operated, including<add><delete><update><find>:Description content is addition, is deleted, update and lookup behaviour Make;Priority is 1;<add>The behavior of operation:It adds in several parameters to service;<delete>The behavior of operation:It deletes corresponding <add>Operate all parameters of addition;<update>The behavior of operation:Modification is corresponding<add>Some or all of addition parameter; <find>Operation behavior:Inquire one or more of storage service parameter information;
Interface label<resource>:Description content is the information of interface;Attribute includes interface identifier id, interface name name, The actual address path of request;Priority is 2;
Ask label<request>And responsive tags<response>:The request and response of user are described;Attribute includes data class Type dataType;Priority is 3;
Rely on label<dependency>:The operate interface that the service is relied on is described;Attribute includes parameter name resouces The id of the id of corresponding with service, resource corresponding interface;
Data label<param>:The information of required parameter is described;Attribute includes parameter name name, corresponding Property Name Whether attribute, parameter type type, characterising parameter are necessary required;Priority is 4.
Data label<data>:Data from response message are described;Attribute includes name data names, type data types; Priority is 4;
Data label<element>:Container Type element is described;Attribute includes data name name, data type type;Preferentially Grade is 5;And<param>、<data>It is under label or self-contained;
The constrained type label of data label<restriction>:Constraints is described;<param>、<data>、< element>Under label.
3. a kind of automated testing method of distributed big data service according to claim 2, it is characterised in that:
Test script in step 4 includes the attribute value below 4 labels and label:
<script>Label, containing attribute resourcesID, attribute value is the value that corresponding with service identifies id;<script>Label Priority is 0;
<step>Label, containing two attributes of path and operation, attribute path values are the paths url of corresponding interface, attribute Operation values are corresponding interface action type;<step>Label priority 1;
<param>Label contains tri- attributes of name, attribute and value, attribute name recording parameters titles, attribute Attribute recording parameters corresponding attribute in affiliated class, the corresponding expected results of attribute value records;<param>Label is excellent First grade 2;
<response>Label, without attribute, priority 1.
4. according to a kind of automated testing method of distribution big data service described in Claims 2 or 3, it is characterised in that:Step In rapid 4 when the sequence of operation actual according to operation test pattern generation, the * values operated in test pattern are required according to user It determines, if user does not require, * occurrences are that (the service interface quantity+update that add operations include, which is operated, includes Service interface quantity+delete operates the service interface quantity for including) * 2-2.
5. a kind of automated testing method of distributed big data service according to claim 4, it is characterised in that:Step 4 Middle API cycle tests create-rule is:The cartesian product of api interface set corresponding to label will be respectively operated in the sequence of operation As the set of API cycle tests, the sequence of API is according to the corresponding position progress in the sequence of operation in API cycle tests;Behaviour Make variables A ddInterfaceSetMap, DeleteInterfaceSetMap of the api interface set in the step 2, UpdateInterfaceSetMap、FindInterfaceSetMap。
CN201810362027.3A 2018-04-20 2018-04-20 Automatic testing method for distributed big data service Active CN108540351B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810362027.3A CN108540351B (en) 2018-04-20 2018-04-20 Automatic testing method for distributed big data service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810362027.3A CN108540351B (en) 2018-04-20 2018-04-20 Automatic testing method for distributed big data service

Publications (2)

Publication Number Publication Date
CN108540351A true CN108540351A (en) 2018-09-14
CN108540351B CN108540351B (en) 2021-06-25

Family

ID=63479106

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810362027.3A Active CN108540351B (en) 2018-04-20 2018-04-20 Automatic testing method for distributed big data service

Country Status (1)

Country Link
CN (1) CN108540351B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109460366A (en) * 2018-11-16 2019-03-12 郑州云海信息技术有限公司 A kind of software stability test method, device, equipment and medium
CN110071844A (en) * 2019-05-14 2019-07-30 广东电网有限责任公司 A kind of detection script creation system, method and relevant apparatus
CN110765667A (en) * 2019-11-28 2020-02-07 深圳市金城保密技术有限公司 Simulation method and system of laser printer
CN111488267A (en) * 2019-01-25 2020-08-04 北京搜狗科技发展有限公司 Interface test script generation method and device and electronic equipment
CN114968689A (en) * 2022-08-01 2022-08-30 北京数字光芯集成电路设计有限公司 FPGA device, MIPI protocol layer testing device and method based on FPGA device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222042A (en) * 2011-06-28 2011-10-19 北京新媒传信科技有限公司 Automatic software testing method based on cloud computing
CN103064788A (en) * 2012-12-24 2013-04-24 清华大学 Web service modeling and test method based on interface semantic contract model
US20150007149A1 (en) * 2011-08-08 2015-01-01 Ca, Inc. Automating functionality test cases
CN104866422A (en) * 2015-05-20 2015-08-26 中国互联网络信息中心 Web Service automatic test system and method
CN107124326A (en) * 2017-04-05 2017-09-01 烽火通信科技股份有限公司 A kind of automated testing method and system
WO2018004892A1 (en) * 2016-07-01 2018-01-04 Mcafee, Inc. Cloud assisted behavioral automated testing
CN107643981A (en) * 2017-08-29 2018-01-30 顺丰科技有限公司 A kind of automatic test platform and operation method of polynary operation flow
CN107704395A (en) * 2017-10-24 2018-02-16 武大吉奥信息技术有限公司 One kind is based on cloud platform automatic test implementation and system under Openstack

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222042A (en) * 2011-06-28 2011-10-19 北京新媒传信科技有限公司 Automatic software testing method based on cloud computing
US20150007149A1 (en) * 2011-08-08 2015-01-01 Ca, Inc. Automating functionality test cases
CN103064788A (en) * 2012-12-24 2013-04-24 清华大学 Web service modeling and test method based on interface semantic contract model
CN104866422A (en) * 2015-05-20 2015-08-26 中国互联网络信息中心 Web Service automatic test system and method
WO2018004892A1 (en) * 2016-07-01 2018-01-04 Mcafee, Inc. Cloud assisted behavioral automated testing
CN107124326A (en) * 2017-04-05 2017-09-01 烽火通信科技股份有限公司 A kind of automated testing method and system
CN107643981A (en) * 2017-08-29 2018-01-30 顺丰科技有限公司 A kind of automatic test platform and operation method of polynary operation flow
CN107704395A (en) * 2017-10-24 2018-02-16 武大吉奥信息技术有限公司 One kind is based on cloud platform automatic test implementation and system under Openstack

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李亚辉: "基于XML描述的软件接口测试研究", 《中国优秀博硕士学位论文全文数据库 信息科技辑》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109460366A (en) * 2018-11-16 2019-03-12 郑州云海信息技术有限公司 A kind of software stability test method, device, equipment and medium
CN111488267A (en) * 2019-01-25 2020-08-04 北京搜狗科技发展有限公司 Interface test script generation method and device and electronic equipment
CN111488267B (en) * 2019-01-25 2024-03-12 北京搜狗科技发展有限公司 Interface test script generation method and device and electronic equipment
CN110071844A (en) * 2019-05-14 2019-07-30 广东电网有限责任公司 A kind of detection script creation system, method and relevant apparatus
CN110765667A (en) * 2019-11-28 2020-02-07 深圳市金城保密技术有限公司 Simulation method and system of laser printer
CN114968689A (en) * 2022-08-01 2022-08-30 北京数字光芯集成电路设计有限公司 FPGA device, MIPI protocol layer testing device and method based on FPGA device

Also Published As

Publication number Publication date
CN108540351B (en) 2021-06-25

Similar Documents

Publication Publication Date Title
CN108540351A (en) The automated testing method of distributed big data service
CN105808428B (en) A method of unified performance test is carried out to distributed file system
CN102341781B (en) Software test bed generation
CN108304201B (en) Object updating method, device and equipment
US6427230B1 (en) System and method for defining and managing reusable groups software constructs within an object management system
US9519701B2 (en) Generating information models in an in-memory database system
US10635408B2 (en) Method and apparatus for enabling agile development of services in cloud computing and traditional environments
CN107122368A (en) A kind of data verification method, device and electronic equipment
CN114791846B (en) Method for realizing observability aiming at cloud-originated chaos engineering experiment
CN113034665B (en) Simulation modeling method and system based on scene tree
US20050166115A1 (en) Method for performing software stress test
CN109002334A (en) A kind of operation platform and its data processing method
US20220376991A1 (en) System and method for visualizing and navigating network data
CN109150964A (en) A kind of transportable data managing method and services migrating method
CN110046155A (en) The update of property data base, data characteristics determination method, device and equipment
MX2011003102A (en) Data subscription.
CN116360891A (en) Operator customization method and system for visual artificial intelligence modeling
CN113867700B (en) Model construction method, display platform, server and storage medium
CN114398151A (en) Configuration management method, device, equipment and storage medium
CN115293365A (en) Management method, device, management platform and storage medium of machine learning model
CN103729286B (en) Automatic test platform for embedded device
CN112486461A (en) Information processing system based on springboot frame
US8910183B2 (en) Access to context information in a heterogeneous application environment
Wallace et al. A Situated Evaluation of the Object Management Group's (OMG) Object Management Architecture (OMA)
CN116755684B (en) OAS Schema generation method, device, equipment and medium

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
GR01 Patent grant
GR01 Patent grant