CN105550103B - A kind of automated testing method based on self-defined test script - Google Patents

A kind of automated testing method based on self-defined test script Download PDF

Info

Publication number
CN105550103B
CN105550103B CN201510888260.1A CN201510888260A CN105550103B CN 105550103 B CN105550103 B CN 105550103B CN 201510888260 A CN201510888260 A CN 201510888260A CN 105550103 B CN105550103 B CN 105550103B
Authority
CN
China
Prior art keywords
step
test
class
test class
http
Prior art date
Application number
CN201510888260.1A
Other languages
Chinese (zh)
Other versions
CN105550103A (en
Inventor
袁慧
蒲金培
胡海峡
李建平
马述浩
马述杰
Original Assignee
泰华智慧产业集团股份有限公司
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 泰华智慧产业集团股份有限公司 filed Critical 泰华智慧产业集团股份有限公司
Priority to CN201510888260.1A priority Critical patent/CN105550103B/en
Publication of CN105550103A publication Critical patent/CN105550103A/en
Application granted granted Critical
Publication of CN105550103B publication Critical patent/CN105550103B/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention discloses a kind of automated testing method based on self-defined test script, comprise the following steps:Step (1):Make test script:Parameter type and transfer mode generation test class according to Http requests;Write test principal function;Step (2):According to the logical relation between test class, the execution sequence of test script is set to perform test script;Step (3):Judge to whether there is mistake in Http requests;If being put into step (4), step (2) is returned to if not;Step (4):Error log recorded in Bug management systems;Step (5):Principal function judges whether to need to stop, if just stopping performing, is returned to step (2) if not.The present invention has self-defined execution smart city platform service flow, reduces the repeated labor of tester, liberates a part of productivity advantage.

Description

A kind of automated testing method based on self-defined test script

Technical field

The present invention relates to a kind of automated testing method based on self-defined test script.

Background technology

With the popularization of smart city, the operation flow of smart city platform is gradually ripe, exploitation multiplexing existing procucts frame The situation of frame is more and more, adds the repeated labor of tester, if being required for manual test, then just increase survey The workload of examination personnel, the tester of most of company and the proportion numerous imbalances of developer, test resource can not expire The needs of sufficient programstatus.

Traditional automatic test is for catching interface, if developer changes any one code and is required for weight New production test script, the maintenance workload of script can be very big.

The content of the invention

The purpose of the present invention is exactly to solve the above problems, there is provided a kind of automation based on self-defined test script is surveyed Method for testing, it has self-defined execution smart city platform service flow, reduces the repeated labor of tester, liberate one Mitogenetic force of labor advantage.

To achieve these goals, the present invention adopts the following technical scheme that:

A kind of automated testing method based on self-defined test script, comprises the following steps:

Step (1):Make test script:Parameter type and transfer mode generation test class according to Http requests;Write Test principal function;

Step (2):According to the logical relation between test class, the execution sequence of test script is set to perform test pin This;

Step (3):Judge to whether there is mistake in Http requests;If being put into step (4), step is returned to if not (2);

Step (4):Error log recorded in Bug management systems;

Step (5):Principal function judges whether to need to stop, if just stopping performing, is returned to step (2) if not.

The step of step (1) is:

Step (101):The generation of test class:The each operation flow bottom of smart city platform is intercepted by Http agreements to hand over Mutual Http requests, parameter type and transfer mode in analysis Http requests, and write according to parameter type and transfer mode Several test class;

Step (102):Test principal function is write, principal function is main functions;

Step (103):In main functions, read test data;

Step (104):In main functions, several test class are called, and according to the logic between several test class Relation, set the execution sequence of test class;

Step (105):In main functions, the interval time between execution sequence is set;

Step (106):In main functions, the parameter Flag that each test class terminates to perform is set.

The step of step (2) is:

Step (201):Perform main functions;

Step (202):The call instruction of main functions is sent to each test class;

Step (203):Each test class receives call instruction, according to the logic between the test class set in main functions Relation, parameter and parameter Flag in initialization Http requests;

Step (204):Read test data, the parameter type of test data is changed into the parameter class of test class needs Type, by parameter type, parameter is passed into each test class;

Step (205):Test class receives parameter, and test class passes to parameter in Http agreements by HttpRequest, and Receive the return value of Http requests by HttpResponse, return value is directly delivered in the Result classes of main functions.

The step of step (4), includes:

Step (401):When the information containing Http error codes in Result classes, Result classes send request automatically, Request for test class returns to browser error snapshot;

Step (402):The browser error snapshot captured is sent to Result classes by test class, and Result classes will browse Device mistake snapshot and Http corresponding with browser error snapshot requests are saved in error log class, and Flag values are sent into master Function;

Step (403):After error log class receives error log, error log is sent to Bug management systems.

The parameter type of the step (101) includes:Int types, string types or float types;

The transfer mode of the step (101) includes:HttpRequest or HttpResponse.

Logical relation between described several test class of step (104) includes:Beginning-beginning, beginning-end, terminate- Terminate, end-beginning.

The interval time form of the step (105) is hh:mm:ss.

The step (106) when going wrong, judges whether principal function will continue to hold when performing a certain test class OK, if perform the Flag that set of class as true, next test class is continued executing with, if the Flag that test class is set is False, then test stop.

The Http error codes of the step (401) include Http500 or Http400.

The error log of the step (403) includes:Browser error snapshot and corresponding with browser error snapshot Http is asked.

Beneficial effects of the present invention:For the project of smart city platform service flow, it is possible to reduce tester repeats Property work, liberate a part of productivity, reduce cost of human resources, method of testing of the invention can shorten the testing time, Improve operating efficiency.The present invention is mainly by intercepting parameter type and transfer mode in http protocol, by interface element and generation The influence of code is smaller, and the workload of maintenance is smaller.

Brief description of the drawings

Fig. 1 is flow chart of the method for the present invention;

The flow chart of the step of Fig. 2 is Fig. 1 (1);

The flow chart of the step of Fig. 3 is Fig. 1 (2);

The flow chart of the step of Fig. 4 is Fig. 1 (4).

Embodiment

The invention will be further described with embodiment below in conjunction with the accompanying drawings.

As shown in figure 1, a kind of automated testing method based on self-defined test script, comprises the following steps:

Step (1):Make test script:Parameter type and transfer mode generation test class according to Http requests;Write Test principal function;

Step (2):According to the logical relation between test class, the execution sequence of test script is set to perform test pin This;

Step (3):Judge to whether there is mistake in Http requests;If being put into step (4), step is returned to if not (2);

Step (4):Error log recorded in Bug management systems;

Step (5):Principal function judges whether to need to stop, if just stopping performing, is returned to step (2) if not.

As shown in Fig. 2 the step of step (1), is:

Step (101):The generation of test class:The each operation flow bottom of smart city platform is intercepted by Http agreements to hand over Mutual Http requests, parameter type and transfer mode in analysis Http requests, and write according to parameter type and transfer mode Several test class;Parameter type is for example:Int types, string types, float types etc.;Transfer mode is included for example: HttpRequest and HttpResponse etc..

Step (102):Write test principal function, i.e. main functions;

Step (103):In main functions, the initialization test data in reading database;

Step (104):In main functions, several test class are called, and according to the logic between several test class Relation, set the execution sequence of test class;Logical relation between several described test class includes:Beginning-beginning, start- Terminate, end-end, terminate-start;Such as:Test class A starts, and test class B starts;Test class A terminates, test class B knots Beam;Test class A terminates, and test class B starts;

Step (105):In main functions, the interval time between execution sequence is set;Interval time form is hh: mm:ss;

Step (106):In main functions, the parameter Flag that each test class terminates to perform is set.When a certain survey of execution Class is tried, when going wrong, judges whether principal function will continue executing with, if perform the Flag that sets of class as true, after Continuous to perform next test class, if the Flag of test class setting is false, test stops.

As shown in figure 3, the step of step (2), is:

Step (201):Perform main functions;

Step (202):The call instruction of main functions is sent to each test class;

Step (203):Each test class receives call instruction, according to the logic between the test class set in main functions Relation, the Flag parameters of parameter and setting in initialization Http requests;

Step (204):The read test data from database, the parameter type of test data is changed into test class needs The parameter type wanted, by parameter type, parameter is passed into each test class;

Step (205):Test class receives parameter, and test class passes to parameter in Http agreements by HttpRequest, and Receive the return value of Http requests by HttpResponse, return value is directly delivered in the Result classes of main functions.

As shown in figure 4, the step of step (4), includes:

Step (401):When the information containing Http error codes in Result classes, Result classes send request automatically, Request for test class returns to browser error snapshot;Http error codes include Http500 or Http400;

Step (402):The browser error snapshot captured is sent to Result classes by test class, and Result classes will browse Device mistake snapshot and Http corresponding with browser error snapshot requests are saved in error log class, and Flag values are sent into master Function;

Step (403):After error log class receives error log, error log is sent to Bug management systems.The mistake Daily record by mistake includes:Browser error snapshot and Http corresponding with browser error snapshot requests.

Although above-mentioned the embodiment of the present invention is described with reference to accompanying drawing, model not is protected to the present invention The limitation enclosed, one of ordinary skill in the art should be understood that on the basis of technical scheme those skilled in the art are not Need to pay various modifications or deformation that creative work can make still within protection scope of the present invention.

Claims (9)

1. a kind of automated testing method based on self-defined test script, it is characterized in that, comprise the following steps:
Step (1):Make test script:Parameter type and transfer mode generation test class according to Http requests;Write test Principal function;The step of step (1) is:
Step (101):The generation of test class:Intercept what platform each operation flow bottom in smart city interacted by Http agreements Http is asked, parameter type and transfer mode in analysis Http requests, and is write according to parameter type and transfer mode some Individual test class;
Step (102):Test principal function is write, principal function is main functions;
Step (103):In main functions, the initialization test data in reading database;
Step (104):In main functions, several test class are called, and according to the logical relation between several test class, Set the execution sequence of test class;
Step (105):In main functions, the interval time between execution sequence is set;
Step (106):In main functions, the parameter Flag that each test class terminates to perform is set;
Step (2):According to the logical relation between test class, the execution sequence of each test class is set to perform test script;
Step (3):Judge to whether there is mistake in Http requests;If being put into step (4), step (2) is returned to if not;
Step (4):Error log recorded in Bug management systems;
Step (5):Principal function judges whether to need to stop, if just stopping performing, is returned to step (2) if not.
2. a kind of automated testing method based on self-defined test script as claimed in claim 1, it is characterized in that, the step Suddenly the step of (2) are:
Step (201):Perform main functions;
Step (202):The call instruction of main functions is sent to each test class;
Step (203):Each test class receives call instruction, is closed according to the logic between the test class set in main functions System, parameter and parameter Flag in initialization Http requests;
Step (204):Read test data, the parameter type of test data is changed into the parameter type of test class needs, led to Parameter type is crossed, parameter is passed into each test class;
Step (205):Test class receives parameter, and test class passes to parameter in Http agreements by HttpRequest, and passes through Http Response receive the return value of Http requests, and return value is directly delivered in the Result classes of main functions.
3. a kind of automated testing method based on self-defined test script as claimed in claim 1, it is characterized in that, the step Suddenly the step of (4) include:
Step (401):When the information containing Http error codes in Result classes, Result classes send request automatically, request Test class returns to browser error snapshot;
Step (402):The browser error snapshot captured is sent to Result classes by test class, and Result classes are wrong by browser Snapshot and Http corresponding with browser error snapshot requests are saved in error log class by mistake, and Flag values are sent into main letter Number;
Step (403):After error log class receives error log, error log is sent to Bug management systems.
4. a kind of automated testing method based on self-defined test script as claimed in claim 1, it is characterized in that, the step Suddenly the parameter type of (101) includes:Int types, string types or float types;The transfer mode of the step (101) includes: HttpRequest or Http Response.
5. a kind of automated testing method based on self-defined test script as claimed in claim 1, it is characterized in that, the step Suddenly the logical relation between (104) several test class includes:Beginning-beginning, beginning-end, end-end, terminate-open Begin.
6. a kind of automated testing method based on self-defined test script as claimed in claim 1, it is characterized in that, the step Suddenly the interval time form of (105) is hh:mm:ss.
7. a kind of automated testing method based on self-defined test script as claimed in claim 1, it is characterized in that, the step Suddenly (106) when going wrong, judge whether principal function will continue executing with when performing a certain test class, if performing class setting Flag when being true, then continue executing with next test class, if the Flag of test class setting is false, test stops.
8. a kind of automated testing method based on self-defined test script as claimed in claim 3, it is characterized in that, the step Suddenly the Http error codes of (401) include Http500 or Http400.
9. a kind of automated testing method based on self-defined test script as claimed in claim 3, it is characterized in that, the step Suddenly the error log of (403) includes:Browser error snapshot and Http corresponding with browser error snapshot requests.
CN201510888260.1A 2015-12-03 2015-12-03 A kind of automated testing method based on self-defined test script CN105550103B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510888260.1A CN105550103B (en) 2015-12-03 2015-12-03 A kind of automated testing method based on self-defined test script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510888260.1A CN105550103B (en) 2015-12-03 2015-12-03 A kind of automated testing method based on self-defined test script

Publications (2)

Publication Number Publication Date
CN105550103A CN105550103A (en) 2016-05-04
CN105550103B true CN105550103B (en) 2017-12-05

Family

ID=55829297

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510888260.1A CN105550103B (en) 2015-12-03 2015-12-03 A kind of automated testing method based on self-defined test script

Country Status (1)

Country Link
CN (1) CN105550103B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107104827A (en) * 2017-04-12 2017-08-29 上海斐讯数据通信技术有限公司 DMZ method for automatically testing functions and system based on Socket

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101025686A (en) * 2007-03-22 2007-08-29 中兴通讯股份有限公司 Automation test system and test script generating and operating method
CN101221503A (en) * 2008-02-01 2008-07-16 中国建设银行股份有限公司 Software testing method and device
CN102135938A (en) * 2011-03-21 2011-07-27 中国工商银行股份有限公司 Software product testing method and system
CN102932205A (en) * 2012-11-19 2013-02-13 深圳市亚特尔科技有限公司 Automatic test method and test platform of network server-side interface

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101025686A (en) * 2007-03-22 2007-08-29 中兴通讯股份有限公司 Automation test system and test script generating and operating method
CN101221503A (en) * 2008-02-01 2008-07-16 中国建设银行股份有限公司 Software testing method and device
CN102135938A (en) * 2011-03-21 2011-07-27 中国工商银行股份有限公司 Software product testing method and system
CN102932205A (en) * 2012-11-19 2013-02-13 深圳市亚特尔科技有限公司 Automatic test method and test platform of network server-side interface

Also Published As

Publication number Publication date
CN105550103A (en) 2016-05-04

Similar Documents

Publication Publication Date Title
US8135827B2 (en) Distributed capture and aggregation of dynamic application usage information
US8914679B2 (en) Software testing automation framework
US8028200B2 (en) Tracing operations in multiple computer systems
US8434058B1 (en) Integrated system and method for validating the functionality and performance of software applications
US8572437B2 (en) Multi-platform test automation enhancement
US9448916B2 (en) Software test automation systems and methods
US20040153837A1 (en) Automated testing
US7640459B2 (en) Performing computer application trace with other operations
US20080098359A1 (en) Manipulation of trace sessions based on address parameters
EP2615555A1 (en) Framework for automated testing of mobile apps
US20140237451A1 (en) Exposing method related data calls during testing in an event driven, multichannel architecture
CN101339534A (en) Software test apparatus and test method
JP2003091432A (en) Software evaluation system and software evaluation tool
JP5295269B2 (en) Method for generating component model-based virtual software platform, method for verifying software platform architecture using the same, and apparatus therefor
US9122671B2 (en) System and method for grammar based test planning
US7954011B2 (en) Enabling tracing operations in clusters of servers
US9842045B2 (en) Failure recovery testing framework for microservice-based applications
Sripanidkulchai et al. Are clouds ready for large distributed applications?
CN1248116C (en) General purpose testing arrangement for embedded module and subsystem based on host machine platform
CN103365770A (en) Mobile terminal software testing system and software testing method
CN102419727A (en) Automatic test method and device
US20100281467A1 (en) Method and apparatus for automatic software testing
US9355017B2 (en) Automated error checking system for a software application and method therefor
CN102608464A (en) Modularized automatic test assembly system of rely protection device and test method of modularized automatic test assembly system
Yu et al. Cloudseer: Workflow monitoring of cloud infrastructures via interleaved logs

Legal Events

Date Code Title Description
PB01 Publication
C06 Publication
SE01 Entry into force of request for substantive examination
C10 Entry into substantive examination
CB03 Change of inventor or designer information

Inventor after: Yuan Hui

Inventor after: Pu Jinpei

Inventor after: Hu Haixia

Inventor after: Li Jianping

Inventor after: Ma Shuhao

Inventor after: Ma Shujie

Inventor before: Yuan Hui

Inventor before: Pu Jinpei

Inventor before: Ma Shujie

Inventor before: Ma Shuhao

CB03 Change of inventor or designer information
GR01 Patent grant
GR01 Patent grant