CN102368227A - Method for generating performance test scripts based on server interfaces - Google Patents
Method for generating performance test scripts based on server interfaces Download PDFInfo
- Publication number
- CN102368227A CN102368227A CN201110310776XA CN201110310776A CN102368227A CN 102368227 A CN102368227 A CN 102368227A CN 201110310776X A CN201110310776X A CN 201110310776XA CN 201110310776 A CN201110310776 A CN 201110310776A CN 102368227 A CN102368227 A CN 102368227A
- Authority
- CN
- China
- Prior art keywords
- data
- service end
- end interface
- request
- performance test
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
The invention provides a method for generating performance test scripts based on server interfaces. The method comprises the following steps: 10, defining a URL (uniform resource locator) and a data body of a server interface required to be tested by using a programming language, and asking a server to allocate memory resources to a performance test script running environment; 20, converting the URL and data body of the server interface required to be tested into data in a JSON format; 30, confirming a data request mode received by the server interface, and carrying out parameterization on the data (converted into the JSON format and required to be parameterized) in the data body of the server interface; and 40, invoking a test function to carry out simulation on the URL and data body (converted into the JSON format) and data request mode of the server interface so as to form a service logic request of the outside to the server interface. In the invention, through simulating logic services of the server interface, performance test scripts which are concise, efficient and easy to read are generated.
Description
[technical field]
The present invention relates to the technical field of performance test of service end interface, relate in particular to a kind of method that generates based on the performance test script of service end interface.
[background technology]
Prior art all is to test to the foreground business of website to the test of the web site performance data of whole server generally, and it is as shown in Figure 1, is the test frame figure of the web site performance data of whole server; This method is based on a performance test software, performance test script is stored in need carries out utilizing performance test script then in the server of performance test, and the service end interface is produced pressure.Through setting the required each item index obtained of performance test, the Virtual User number (number of clients) that produces pressure, lasting time of pressure test; Foreground business to the website is carried out performance test; According to different performance requirements; Set different test scenes, and the test result of output is analyzed.It is to be that middleware carries out performance test to the foreground business through the service end interface.The implementation of the test script in the test process is through recording realization, and there are many drawbacks in the script of recording; Be difficult for reading and comprising the multiple element in website; Because a plurality of interfaces of website calling service service end, the performance data that draws also can't the concrete service end interface capability of real embodiment; If find in the process of test that the web site performance data have problem; Then still need to carry out performance test to the service end interface individually, in order to the location particular problem, like this to very loaded down with trivial details of the test of the web site performance data of whole server.
The service end interface is defined as multiple program language of encapsulation and several data storehouse, and it provides data to extraneous (like client) with the http procotol and with the json form.If its test to the web site performance data of whole server directly is directed against the service end interface, directly carry out performance test, the test result that draws, its inevitable more accurate and saving resource raising testing efficiency.Yet, be to realize key that the test of the web site performance data of whole server is directly carried out performance test to the service end interface based on the write method of the performance test script of service end interface.
The method of a kind of concurrent following response time of environment of the Web of test webpage is provided in the prior art; As open day was on November 10th, 2010; Publication number is the Chinese patent of CN101882105A; Its unique point is: realize through following steps: (1) starts automated performance testing tool, records the system action that Web that user's action need tests uses; The behavior of (2) step (1) being recorded adopts the load testing model to analyze the daily record that Web uses, and refines the user conversation that Web uses, to produce the automated performance testing script; (3) the automated performance testing script that step (2) is produced; By increment mode or the request of random pattern simulation multi-user concurrent; Application server is launched pressure test, detects the performance of application server and data server, produces automatic test performance evaluation report automatically.This invention need not artificial participation network packet analysis in the present performance testing tool, and the script arrangement improves intelligent that the performance test script robotization generates, and reduces tester's working strength, the raising formation efficiency.Also through recording realization, there are many drawbacks in its script of recording to the automated performance testing script of this invention, is difficult for reading and comprising the multiple element in website.
[summary of the invention]
The technical matters that the present invention will solve is to provide a kind of method that generates based on the performance test script of service end interface, and this performance test script is succinct, efficient, be easy to read.
The present invention is achieved in that a kind of method that generates based on the performance test script of service end interface, comprises the steps:
Step 10, use said URL and the data b ody that needs the service end interface of test of programming language definition, and to ask said service end be said performance test script running environment storage allocation resource;
Step 20, with the URL of the said service end interface that needs test and the data that data b ody converts the JSON form to;
Step 30, confirm that the request of data mode that the service end interface receives, said request of data mode are that client need be accomplished a certain business and the service request of sending, this request of data mode comprises the request mode of get, post, put, delete; According to the request of data mode after the said affirmation needs among the data b ody of the service end interface of the said JSON of changing into form are carried out parameterized data and carry out parametrization; Need carry out parameterized data among the said data b ody is business data to making amendment among the data body of accomplishing according to the client needs;
Step 40, call the request of data mode of the trial function of said service end with the data b ody of the service end interface of the URL of the service end interface of said JSON form, JSON form, after confirming, it is performance test script to the request of said service end interface business logic that simulation forms client; Said trial function comprises http request function, with the web_custom_request function of script-editor definition; The data b ody of the service end interface of said JSON form is the data b ody that need carry out in the said step 30 after parameterized data are carried out parametrization;
Step 50, the resource of calling said service end discharge function with discharging for performance test script running environment storage allocation resource in the said step 10.
The present invention has following advantage: the logic business of analog service end interface of the present invention; With the URL of the service end interface of needs tests and the request of data mode of data b ody, the reception of service end interface; Simulate and form the request of client, promptly generate performance test script succinct, efficient, that be easy to read said service end interface business logic, by performance test script to the test of the web site performance data of whole server directly to the service end interface; Directly carry out performance test; The test result that draws best embodies service end interface actual performance, its more accurate and saving resource raising testing efficiency.
[description of drawings]
Fig. 1 is the test frame figure of the web site performance data of whole server in the prior art.
Fig. 2 is a method flow synoptic diagram of the present invention.
[embodiment]
See also shown in Figure 2ly, the method that the performance test script based on the service end interface of the present invention generates comprises the steps:
Step 10, said URL and data b ody (its implementation language such as the char*szUrl that needs the service end interface of test of use programming language (this programming language such as c language, c++ language, java language or the like) definition; * szBody); These 2 parts of the URL of service end interface and data b ody are the important component parts that constitute the service end interface, and to ask said service end be said performance test script running environment storage allocation resource (its implementation language such as * szUrl=(char*) malloc (Length_url); * szBody=(char*) malloc (Length_body));
Step 20, with the URL of the said service end interface that needs test and the data that data b ody converts JSON (this JSON full name is JavaScript Object Notation, is a kind of data interchange format of lightweight) form to;
Step 30, confirm that the request of data mode that the service end interface receives, said request of data mode are that client need be accomplished a certain business and the service request of sending, this request of data mode comprises the request mode of get, post, put, delete; According to the request of data mode after the said affirmation needs among the data b ody of the service end interface of the said JSON of changing into form are carried out parameterized data and carry out parametrization; Need carry out parameterized data among the said data b ody is the business data to making amendment among the data body that will accomplish according to client;
Step 40, call the request of data mode of the trial function of said service end with the data b ody of the service end interface of the URL of the service end interface of said JSON form, JSON form, after confirming, it is performance test script to the request of said service end interface business logic that simulation forms client; The web_custom_request function that said trial function comprises http request function, defines with script-editor (like HP Loadrunner); The data b ody of the service end interface of said JSON form is the data b ody that need carry out in the said step 30 after parameterized data are carried out parametrization;
Step 50, the resource of calling said service end discharge function (like the free function) with discharging for performance test script running environment storage allocation resource in the said step 10, and the statement of this release realization is: free (szUrl); Free (szBody).
According to the request of data mode after the said affirmation needs among the data b ody of the service end interface of the said JSON of changing into form are carried out parameterized data (when client need be accomplished when revising subscriber data professional in the step 30 described in the present embodiment; Its said needs carry out the data item that parameterized data comprise that the pet name, individualized signature etc. can be revised) this is specially to carry out parametrization: definition shaping variable i; And give initial value for the shaping variable, it realizes statement such as int i=1; , needs add i++ (such as revising the pet name, pet name item parameterisable be " pet name i++ ", make this Virtual User pet name when iteration at every turn all inequality) after carrying out parameterized data; Make i like this when being called by performance test script, numerical value increases progressively at every turn, guarantees performance test script at every turn to service end interface initiation service request the time, and the data b ody of service end interface is all inequality, with activation the service end interface is really produced performance pressure.
The above is merely preferred embodiment of the present invention, and all equalizations of doing according to claim of the present invention change and modify, and all should belong to covering scope of the present invention.
Claims (3)
1. a method that generates based on the performance test script of service end interface is characterized in that: comprise the steps:
Step 10, use said URL and the data b ody that needs the service end interface of test of programming language definition, and to ask said service end be said performance test script running environment storage allocation resource;
Step 20, with the URL of the said service end interface that needs test and the data that data b ody converts the JSON form to;
Step 30, confirm that the request of data mode that the service end interface receives, said request of data mode are that client need be accomplished a certain business and the service request of sending, this request of data mode comprises the request mode of get, post, put, delete; According to the request of data mode after the said affirmation needs among the data b ody of the service end interface of the said JSON of changing into form are carried out parameterized data and carry out parametrization; Need carry out parameterized data among the said data b ody is the business data to making amendment among the data body that will accomplish according to client;
Step 40, call the request of data mode of the trial function of said service end with the data b ody of the service end interface of the URL of the service end interface of said JSON form, JSON form, after confirming, it is performance test script to the request of said service end interface business logic that simulation forms client; Said trial function comprises http request function, with the web_custom_request function of script-editor definition; The data b ody of the service end interface of said JSON form is the data b ody that need carry out in the said step 30 after parameterized data are carried out parametrization.
2. the method that generates based on the performance test script of service end interface according to claim 1 is characterized in that: further comprise after the said step 40:
Step 50, the resource of calling said service end discharge function with discharging for performance test script running environment storage allocation resource in the said step 10.
3. the method that generates based on the performance test script of service end interface according to claim 1 and 2; It is characterized in that: according to the request of data mode after the said affirmation needs among the data b ody of the service end interface of the said JSON of changing into form are carried out parameterized data in the said step 30 and carry out parametrization this is specially: definition shaping variable i, and give initial value for the shaping variable; Carry out adding i++ after the parameterized data at needs.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110310776XA CN102368227A (en) | 2011-10-13 | 2011-10-13 | Method for generating performance test scripts based on server interfaces |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110310776XA CN102368227A (en) | 2011-10-13 | 2011-10-13 | Method for generating performance test scripts based on server interfaces |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102368227A true CN102368227A (en) | 2012-03-07 |
Family
ID=45760792
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110310776XA Pending CN102368227A (en) | 2011-10-13 | 2011-10-13 | Method for generating performance test scripts based on server interfaces |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102368227A (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103810091A (en) * | 2012-11-12 | 2014-05-21 | 百度在线网络技术(北京)有限公司 | Method and device for carrying out page testing |
CN103885877A (en) * | 2014-03-10 | 2014-06-25 | 烟台中科网络技术研究所 | Method and device for generating simulation browser testing script of HTTP |
CN105279061A (en) * | 2014-06-26 | 2016-01-27 | 西安Tcl软件开发有限公司 | Server interface concurrent testing method and apparatus |
CN106506199A (en) * | 2016-10-21 | 2017-03-15 | 乐视控股(北京)有限公司 | The automatic monitoring method and device of interface in system line |
CN107395453A (en) * | 2017-07-03 | 2017-11-24 | 竹间智能科技(上海)有限公司 | Background service method for testing pressure and device |
CN107872355A (en) * | 2016-09-26 | 2018-04-03 | 平安科技(深圳)有限公司 | The method and device of interface simulation test |
CN109522351A (en) * | 2018-10-22 | 2019-03-26 | 中国银行股份有限公司 | A kind of data processing method and system |
CN110427331A (en) * | 2019-09-03 | 2019-11-08 | 四川长虹电器股份有限公司 | The method for automatically generating performance test script based on interface testing tool |
CN110502420A (en) * | 2018-05-17 | 2019-11-26 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus for realizing test script selfreparing |
CN110740071A (en) * | 2018-07-18 | 2020-01-31 | 优信拍(北京)信息科技有限公司 | network interface monitoring method, device and system |
CN111078527A (en) * | 2019-11-08 | 2020-04-28 | 北京深思数盾科技股份有限公司 | Auxiliary system and method for pressure testing of server |
CN111352821A (en) * | 2020-03-10 | 2020-06-30 | 深圳市宝能投资集团有限公司 | Service testing method, device, electronic equipment and computer readable storage medium |
CN113938480A (en) * | 2021-10-21 | 2022-01-14 | 四川长虹电器股份有限公司 | Method for data intercommunication between test environment and formal environment |
-
2011
- 2011-10-13 CN CN201110310776XA patent/CN102368227A/en active Pending
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103810091B (en) * | 2012-11-12 | 2018-11-23 | 百度在线网络技术(北京)有限公司 | A kind of method and apparatus for realizing page test |
CN103810091A (en) * | 2012-11-12 | 2014-05-21 | 百度在线网络技术(北京)有限公司 | Method and device for carrying out page testing |
CN103885877A (en) * | 2014-03-10 | 2014-06-25 | 烟台中科网络技术研究所 | Method and device for generating simulation browser testing script of HTTP |
CN103885877B (en) * | 2014-03-10 | 2017-02-08 | 烟台中科网络技术研究所 | Method and device for generating simulation browser testing script of HTTP |
CN105279061A (en) * | 2014-06-26 | 2016-01-27 | 西安Tcl软件开发有限公司 | Server interface concurrent testing method and apparatus |
CN107872355A (en) * | 2016-09-26 | 2018-04-03 | 平安科技(深圳)有限公司 | The method and device of interface simulation test |
CN106506199A (en) * | 2016-10-21 | 2017-03-15 | 乐视控股(北京)有限公司 | The automatic monitoring method and device of interface in system line |
CN107395453A (en) * | 2017-07-03 | 2017-11-24 | 竹间智能科技(上海)有限公司 | Background service method for testing pressure and device |
CN110502420A (en) * | 2018-05-17 | 2019-11-26 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus for realizing test script selfreparing |
CN110740071A (en) * | 2018-07-18 | 2020-01-31 | 优信拍(北京)信息科技有限公司 | network interface monitoring method, device and system |
CN110740071B (en) * | 2018-07-18 | 2021-07-13 | 优信拍(北京)信息科技有限公司 | Method, device and system for monitoring network interface |
CN109522351A (en) * | 2018-10-22 | 2019-03-26 | 中国银行股份有限公司 | A kind of data processing method and system |
CN110427331A (en) * | 2019-09-03 | 2019-11-08 | 四川长虹电器股份有限公司 | The method for automatically generating performance test script based on interface testing tool |
CN111078527A (en) * | 2019-11-08 | 2020-04-28 | 北京深思数盾科技股份有限公司 | Auxiliary system and method for pressure testing of server |
CN111078527B (en) * | 2019-11-08 | 2021-01-26 | 北京深思数盾科技股份有限公司 | Auxiliary system and method for pressure testing of server |
CN111352821A (en) * | 2020-03-10 | 2020-06-30 | 深圳市宝能投资集团有限公司 | Service testing method, device, electronic equipment and computer readable storage medium |
CN113938480A (en) * | 2021-10-21 | 2022-01-14 | 四川长虹电器股份有限公司 | Method for data intercommunication between test environment and formal environment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102368227A (en) | Method for generating performance test scripts based on server interfaces | |
CN106022483B (en) | The method and apparatus converted between machine learning model | |
CN105335293B (en) | A kind of automatization test system and method based on interface concurrent | |
CN101882105A (en) | Method for testing response time of Web page under concurrent environment | |
CN102045191B (en) | Method and equipment for testing compatibility after upgrading of system | |
CN107590075B (en) | Software testing method and device | |
CN102214139A (en) | Automatic test performance control and debugging method facing distributed system | |
CN108279892A (en) | It is a kind of to split the method, apparatus and equipment that large-scale application service is micro services | |
CN102141962A (en) | Safety distributed test framework system and test method thereof | |
CN104683386A (en) | Pile service implementation method and device capable of customizing response | |
CN102567203A (en) | Method and system for testing performance of distributed file system (DFS) | |
CN103246606B (en) | The performance test methods of ESB platform and system | |
CN111651351B (en) | Jenkins-based software performance testing method and computer main equipment | |
CN103279416A (en) | Storage software automated testing system and method | |
CN104834600A (en) | Method for testing Android application controls | |
CN102541732A (en) | Method for constructing Web automatic testing framework | |
CN101729316A (en) | Test method and system and remote management platform equipment for different types of home gateways | |
CN105760300B (en) | A kind of automated testing method and test macro of STK/UTK business | |
CN102567186A (en) | Automated software testing method | |
CN102025555B (en) | Method and device for testing IP multimedia sub-system performance | |
CN116932224A (en) | Big data function resource consumption evaluation method and device | |
CN101296462A (en) | Method and system for batch execution of mobile terminal software automatic test | |
CN103019927B (en) | A kind of performance test methods and system | |
CN105095070A (en) | Method and system for obtaining QQ group data base on test assembly of browser | |
Vergara-Vargas et al. | A model-driven deployment approach for scaling distributed software architectures on a cloud computing platform |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20120307 |