CN105550103A - Custom test script based automated testing method - Google Patents

Custom test script based automated testing method Download PDF

Info

Publication number
CN105550103A
CN105550103A CN201510888260.1A CN201510888260A CN105550103A CN 105550103 A CN105550103 A CN 105550103A CN 201510888260 A CN201510888260 A CN 201510888260A CN 105550103 A CN105550103 A CN 105550103A
Authority
CN
China
Prior art keywords
test
class
testing method
test script
http
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
CN201510888260.1A
Other languages
Chinese (zh)
Other versions
CN105550103B (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.)
Taihua Wisdom Industry Group Co Ltd
Original Assignee
Taihua Wisdom Industry Group Co Ltd
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 Taihua Wisdom Industry Group Co Ltd filed Critical Taihua Wisdom Industry Group Co Ltd
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
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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 OR 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a custom test script based automated testing method. The method comprises the following steps: step (1): making a test script: according to a parameter type and a transmission mode of an Http request, generating test classes; writing a test main function; step (2): according to a logic relationship between the test classes, setting an execution sequence of the test script to execute the test script; step (3): judging whether an error exists in the Http request or not; if yes, entering the step (4), otherwise, returning to the step (2); step (4): recording an error log in a Bug management system; and step (5): judging whether the execution needs to be stopped or not by the main function, and if yes, stopping the execution, otherwise, returning to the step (2). The method has the advantages that a smart city platform business execution process is self-defined, the repeated labor of test personnel is reduced, and part of the productive forces are liberated.

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
Along with popularizing of smart city, the operation flow of smart city platform is ripe gradually, the situation developing multiplexing existing procucts framework gets more and more, add the repeated labor of tester, if all need manual test, so just increase the workload of tester, the tester of most of company and the proportion numerous imbalances of developer, test resource can not meet the needs of programstatus.
Traditional automatic test, for catching interface, all needs again to make test script if developer revises any one code, and the maintenance workload of script can be very large.
Summary of the invention
Object of the present invention is exactly to solve the problem, a kind of automated testing method based on self-defined test script is provided, it has self-defined execution smart city platform service flow process, reduces the repeated labor of tester, liberates a part of yield-power advantage.
To achieve these goals, the present invention adopts following technical scheme:
Based on an automated testing method for self-defined test script, comprise the steps:
Step (1): make test script: according to parameter type and the transfer mode generation test class of Http request; Write test principal function;
Step (2): according to the logical relation between test class, the execution sequence of setting test script performs test script;
Step (3): judge whether there is mistake in Http request; If just enter step (4), just return step (2) if not;
Step (4): error log is recorded in Bug management system;
Step (5): principal function judges whether to need to stop, if just stop performing, just returns step (2) if not.
The step of described step (1) is:
Step (101): the generation of test class: intercept the mutual Http request of smart city platform each operation flow bottom by Http agreement, analyze the parameter type in Http request and transfer mode, and write several test class according to parameter type and transfer mode;
Step (102): write test principal function, principal function and main function;
Step (103): in main function, read test data;
Step (104): in main function, calls several test class, and according to the logical relation between several test class, the execution sequence of setting test class;
Step (105): in main function, the interval time between setting execution sequence;
Step (106): in main function, sets the parameter Flag that each test class terminates to perform.
The step of described step (2) is:
Step (201): perform main function;
Step (202): the call instruction of main function is sent to each test class;
Step (203): each test class receives call instruction, according to the logical relation between the test class set in main function, the parameter during initialization Http asks and parameter Flag;
Step (204): read test data, changes into the parameter type that test class needs by the parameter type of test data, by parameter type, give each test class by Parameter transfer;
Step (205): test class receiving parameter, test class passes to parameter in Http agreement by HttpRequest, and accepts the rreturn value of Http request by HttpResonse, and rreturn value is directly delivered in the Result class of main function.
The step of described step (4) comprising:
Step (401): when containing the information of Http error code in Result class, Result class sends request automatically, and request for test class returns browser error snapshot;
Step (402): the browser error snapshot captured is sent to Result class by test class, browser error snapshot and the Http corresponding to browser error snapshot ask to be saved in error log class by Result class, and Flag value is sent to principal function;
Step (403): after error log class receives error log, is sent to Bug management system by error log.
The parameter type of described step (101) comprising: int type, string type or float type;
The transfer mode of described step (101) comprising: HttpRequest or HttpResonse.
Logical relation between described step (104) several test class comprises: start-start, and starts-terminates, and terminates-terminates, and terminates-starts.
Form interval time of described step (105) is hh:mm:ss.
Described step (106), when a certain test class of execution, when going wrong, judges whether principal function will continue to perform, if when the Flag performing class setting is true, then continue to perform next test class, if the Flag of test class class setting is false, then test stopping.
The Http error code of described step (401) comprises Http500 or Http400.
The error log of described step (403) comprising: browser error snapshot and the Http corresponding to browser error snapshot ask.
Beneficial effect of the present invention: for the project of smart city platform service flow process, can reduce tester's repeated labor, liberates a part of yield-power, reduces cost of human resources, and method of testing of the present invention can shorten the test duration, increases work efficiency.The present invention is mainly by intercepting parameter type and transfer mode in http protocol, and the impact by interface element and code is smaller, and the workload of maintenance is smaller.
Accompanying drawing explanation
Fig. 1 is method flow diagram of the present invention;
Fig. 2 is the process flow diagram of the step (1) of Fig. 1;
Fig. 3 is the process flow diagram of the step (2) of Fig. 1;
Fig. 4 is the process flow diagram of the step (4) of Fig. 1.
Embodiment
Below in conjunction with accompanying drawing and embodiment, the invention will be further described.
As shown in Figure 1, a kind of automated testing method based on self-defined test script, comprises the steps:
Step (1): make test script: according to parameter type and the transfer mode generation test class of Http request; Write test principal function;
Step (2): according to the logical relation between test class, the execution sequence of setting test script performs test script;
Step (3): judge whether there is mistake in Http request; If just enter step (4), just return step (2) if not;
Step (4): error log is recorded in Bug management system;
Step (5): principal function judges whether to need to stop, if just stop performing, just returns step (2) if not.
As shown in Figure 2, the step of described step (1) is:
Step (101): the generation of test class: intercept the mutual Http request of smart city platform each operation flow bottom by Http agreement, analyze the parameter type in Http request and transfer mode, and write several test class according to parameter type and transfer mode; Parameter type is such as: int type, string type, float type etc.; Transfer mode comprises such as: HttpRequest and HttpResonse etc.
Step (102): write test principal function, i.e. main function;
Step (103): in main function, the initialization test data in reading database;
Step (104): in main function, calls several test class, and according to the logical relation between several test class, the execution sequence of setting test class; Logical relation between several test class described comprises: start-start, and starts-terminates, and terminates-terminates, terminate-start; Such as: test class A starts, test class B starts; Test class A terminates, and test class B terminates; Test class A terminates, and test class B starts;
Step (105): in main function, the interval time between setting execution sequence; Interval time, form was hh:mm:ss;
Step (106): in main function, sets the parameter Flag that each test class terminates to perform.When a certain test class of execution, when going wrong, judge whether principal function will continue to perform, if when the Flag performing class setting is true, then continues to perform next test class, if the Flag of test class class setting is false, then test stopping.
As shown in Figure 3, the step of described step (2) is:
Step (201): perform main function;
Step (202): the call instruction of main function is sent to each test class;
Step (203): each test class receives call instruction, according to the logical relation between the test class set in main function, the parameter during initialization Http asks and the Flag parameter of setting;
Step (204): read test data from database, the parameter type of test data is changed into the parameter type that test class needs, by parameter type, give each test class by Parameter transfer;
Step (205): test class receiving parameter, test class passes to parameter in Http agreement by HttpRequest, and accepts the rreturn value of Http request by HttpResonse, and rreturn value is directly delivered in the Result class of main function.
As shown in Figure 4, the step of described step (4) comprising:
Step (401): when containing the information of Http error code in Result class, Result class sends request automatically, and request for test class returns browser error snapshot; Http error code comprises Http500 or Http400;
Step (402): the browser error snapshot captured is sent to Result class by test class, browser error snapshot and the Http corresponding to browser error snapshot ask to be saved in error log class by Result class, and Flag value is sent to principal function;
Step (403): after error log class receives error log, is sent to Bug management system by error log.Described error log comprises: browser error snapshot and the Http corresponding to browser error snapshot ask.
By reference to the accompanying drawings the specific embodiment of the present invention is described although above-mentioned; but not limiting the scope of the invention; one of ordinary skill in the art should be understood that; on the basis of technical scheme of the present invention, those skilled in the art do not need to pay various amendment or distortion that creative work can make still within protection scope of the present invention.

Claims (10)

1. based on an automated testing method for self-defined test script, it is characterized in that, comprise the steps:
Step (1): make test script: according to parameter type and the transfer mode generation test class of Http request; Write test principal function;
Step (2): according to the logical relation between test class, the execution sequence of setting test script performs test script;
Step (3): judge whether there is mistake in Http request; If just enter step (4), just return step (2) if not;
Step (4): error log is recorded in Bug management system;
Step (5): principal function judges whether to need to stop, if just stop performing, just returns 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 of described step (1) is:
Step (101): the generation of test class: intercept the mutual Http request of smart city platform each operation flow bottom by Http agreement, analyze the parameter type in Http request and transfer mode, and write several test class according to parameter type and transfer mode;
Step (102): write test principal function, principal function and main function;
Step (103): in main function, read test data;
Step (104): in main function, calls several test class, and according to the logical relation between several test class, the execution sequence of setting test class;
Step (105): in main function, the interval time between setting execution sequence;
Step (106): in main function, sets the parameter Flag that each test class terminates to perform.
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 of described step (2) is:
Step (201): perform main function;
Step (202): the call instruction of main function is sent to each test class;
Step (203): each test class receives call instruction, according to the logical relation between the test class set in main function, the parameter during initialization Http asks and parameter Flag;
Step (204): read test data, changes into the parameter type that test class needs by the parameter type of test data, by parameter type, give each test class by Parameter transfer;
Step (205): test class receiving parameter, test class passes to parameter in Http agreement by HttpRequest, and accepts the rreturn value of Http request by HttpResonse, and rreturn value is directly delivered in the Result class of main function.
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 of described step (4) comprising:
Step (401): when containing the information of Http error code in Result class, Result class sends request automatically, and request for test class returns browser error snapshot;
Step (402): the browser error snapshot captured is sent to Result class by test class, browser error snapshot and the Http corresponding to browser error snapshot ask to be saved in error log class by Result class, and Flag value is sent to principal function;
Step (403): after error log class receives error log, is sent to Bug management system by error log.
5. a kind of automated testing method based on self-defined test script as claimed in claim 2, it is characterized in that, the parameter type of described step (101) comprising: int type, string type or float type; The transfer mode of described step (101) comprising: HttpRequest or HttpResonse.
6. a kind of automated testing method based on self-defined test script as claimed in claim 2, it is characterized in that, the logical relation between described step (104) several test class comprises: start-start, and starts-terminates, terminate-terminate, terminate-start.
7. a kind of automated testing method based on self-defined test script as claimed in claim 2, it is characterized in that, form interval time of described step (105) is hh:mm:ss.
8. a kind of automated testing method based on self-defined test script as claimed in claim 2, it is characterized in that, described step (106) is when a certain test class of execution, when going wrong, judge whether principal function will continue to perform, if when the Flag performing class setting is true, then continue to perform next test class, if the Flag of test class class setting is false, then test stopping.
9. a kind of automated testing method based on self-defined test script as claimed in claim 4, it is characterized in that, the Http error code of described step (401) comprises Http500 or Http400.
10. a kind of automated testing method based on self-defined test script as claimed in claim 4, it is characterized in that, the error log of described step (403) comprising: browser error snapshot and the Http corresponding to browser error snapshot ask.
CN201510888260.1A 2015-12-03 2015-12-03 A kind of automated testing method based on self-defined test script Active 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 true CN105550103A (en) 2016-05-04
CN105550103B CN105550103B (en) 2017-12-05

Family

ID=55829297

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510888260.1A Active 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)

Cited By (4)

* 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
CN109542737A (en) * 2018-09-29 2019-03-29 中国平安人寿保险股份有限公司 Platform alert processing method, device, electronic device and storage medium
CN109726116A (en) * 2018-11-08 2019-05-07 深圳壹账通智能科技有限公司 Joint debugging test method, device, computer installation and storage medium
CN114612209A (en) * 2022-05-12 2022-06-10 深圳依时货拉拉科技有限公司 Account checking data processing method and device, computer equipment and storage medium

Family Cites Families (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
CN102135938B (en) * 2011-03-21 2015-04-15 中国工商银行股份有限公司 Software product testing method and system
CN102932205B (en) * 2012-11-19 2016-01-20 深圳市亚特尔科技有限公司 A kind of automated testing method of network service end interface

Cited By (4)

* 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
CN109542737A (en) * 2018-09-29 2019-03-29 中国平安人寿保险股份有限公司 Platform alert processing method, device, electronic device and storage medium
CN109726116A (en) * 2018-11-08 2019-05-07 深圳壹账通智能科技有限公司 Joint debugging test method, device, computer installation and storage medium
CN114612209A (en) * 2022-05-12 2022-06-10 深圳依时货拉拉科技有限公司 Account checking data processing method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN105550103B (en) 2017-12-05

Similar Documents

Publication Publication Date Title
CN106940428B (en) Chip verification method, device and system
CN101241467B (en) Automatized white box test system and method facing to WEB application
CN105550103A (en) Custom test script based automated testing method
CN108920146A (en) Page control assembly and visual Simulation operating system
CN106446166A (en) Method and device for migrating data from DB2 database to K-DB database
CN110013672A (en) Method, unit and the computer readable storage medium of the automatic test of game for machine operation
CN109933521A (en) Automated testing method, device, computer equipment and storage medium based on BDD
CN104731566A (en) Testing device, method and system for IDE (Integrated Development Environment)
CN101145989A (en) A simulated single board and its simulation method
CN115952758A (en) Chip verification method and device, electronic equipment and storage medium
CN111399828A (en) Model-driven logic device modeling method and terminal
CN103593293A (en) Parallel automated testing method
CN115576817A (en) Automatic test system, method, electronic equipment and storage medium
CN111176989A (en) Fault injection test scenario case model and framework based on service arrangement
CN104572443A (en) Mobile terminal testing method and device
CN112506802B (en) Test data management method and system
CN103186465B (en) The browser compatibility method of testing of web user interface and system
CN112084108A (en) Test script generation method and device and related components
CN116629173A (en) Verification method and device of network chip, computer equipment and storage medium
CN112559313A (en) Test case setting method and device, storage medium and electronic equipment
CN116599881A (en) Cloud platform tenant modeling test method, device, equipment and storage medium
CN103019927B (en) A kind of performance test methods and system
CN108804309B (en) Automatic test method and test tool for contract management system
CN112308622A (en) Data processing method and device for virtual object, storage medium and electronic equipment
CN115437903A (en) Interface test method, device, apparatus, storage medium, and program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for 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