CN112069064B - API (application program interface) testing method for short message service provider - Google Patents
API (application program interface) testing method for short message service provider Download PDFInfo
- Publication number
- CN112069064B CN112069064B CN202010896186.9A CN202010896186A CN112069064B CN 112069064 B CN112069064 B CN 112069064B CN 202010896186 A CN202010896186 A CN 202010896186A CN 112069064 B CN112069064 B CN 112069064B
- Authority
- CN
- China
- Prior art keywords
- short message
- service provider
- message service
- api
- testing
- 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.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 36
- 238000000034 method Methods 0.000 claims abstract description 30
- 238000013461 design Methods 0.000 claims description 3
- 238000004806 packaging method and process Methods 0.000 claims description 3
- 238000012795 verification Methods 0.000 claims description 2
- 239000008186 active pharmaceutical agent Substances 0.000 description 3
- 238000004590 computer program Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000010998 test method Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 235000013601 eggs Nutrition 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Abstract
The invention discloses a method for testing the API interface of a short message service provider, which relates to the technical field of interface testing, and comprises the steps of respectively extracting URL addresses and parameters corresponding to the API interfaces of the short message service providers, storing the URL addresses and the parameters in a data table, acquiring the URL addresses and the parameters from the data table by utilizing a Apache Http Client framework, assembling the URL addresses and the parameters into a data format required by the short message service request, sending the short message service request to the corresponding short message service provider according to the API interfaces of the short message service providers, testing the API interfaces of the short message service providers according to the returned results of the short message service providers, reducing the workload, accessing the API interfaces of the short message service providers more conveniently, and improving the efficiency of the API interface test of the short message service providers. In addition, the invention also discloses another method for testing the API interface of the short message service provider.
Description
Technical Field
The invention relates to the technical field of interface testing, in particular to a method for testing an API (application program interface) of a short message service provider.
Background
As the mobile internet penetrates deeply into various levels of society, people are enjoying their own superbonus. However, even if the national-level applications such as WeChat and microblog are widely used in people of all ages, there is still an information blind area which cannot be reached by people. Short messages, which are based on good technical foundation and wide user coverage, play an incomparable supplementary role in the mobile internet era. The short message is used for enterprises, and serves as a head soldier for the communication between the enterprises and users, and the butt-joint short message service provider also becomes a key ring for the informationized construction of the enterprises.
However, like the theory of "not placing eggs in a basket", the contradiction between the limited service capability provided by the short message provider and the feature that the short message must be sent to the client is always "damokilli sword" suspended on the business information touch-up business head. Therefore, the enterprise can select a plurality of short message service providers simultaneously as a self full-platform short message service scheme. Therefore, testing the interface capability provided by the SMS service provider is also a necessary lesson in enterprise informatization construction.
The current test scheme according to the application program interface (Application Programming Interface, API) of the SMS service provider mainly adopts different methods to test according to the characteristics of each API interface, and the methods are various and not uniform. Technicians need to test a large number of APIs of short message service providers in a short period of time to verify the stability of the service provided by the short message service providers, and huge workload is generated due to the difference of APIs of the short message service providers, so that the efficiency is low, and whether the enterprise information access service is reliable or not is directly affected by the short message service capability. Therefore, the test method using the knock-on type system cannot be a sustainable scheme.
Disclosure of Invention
In order to solve the defects in the prior art, the embodiment of the invention provides a method for testing an API (application program interface) of a short message service provider.
In a first aspect, the method for testing the API interface of the sms provider according to the embodiment of the present invention includes the following steps:
respectively extracting URL addresses and parameters corresponding to the API interfaces of the short message service providers;
storing the URL address and the parameters in a data table;
acquiring the URL address and the parameters from the data table by using a Apache Http Client framework, and assembling the URL address and the parameters into a data format required by a short message service request;
according to the API interface of each SMS service provider, sending an SMS service request to the corresponding SMS service provider;
and testing the API interfaces of the short message service providers according to the results returned by the short message service providers.
Preferably, according to the result returned by each short message service provider, the testing the API interface of each short message service provider includes:
and respectively judging whether the returned results of the short message service providers are consistent with the corresponding sent contents, and if so, determining that the corresponding API of the short message service provider passes the test.
Preferably, the parameters include:
the method comprises the steps of URL address corresponding to an API interface of a short message service provider, a request method of the short message service provider, an authentication mode/token of the short message service provider, a request parameter list of the short message service provider, a data exchange mode of the short message service provider and service public parameters of the short message service provider.
Preferably, the data format required by the short message service request comprises a FORM format and a JSON message body format.
Preferably, the service public parameters of the short message service provider include:
the number of the mobile phone to be sent and the content to be sent.
In a second aspect, the method for testing the API interface of the sms service provider according to the embodiment of the present invention includes the following steps:
and shielding the difference of SDK functions of each short message service provider by using an adapter design mode, and packaging a set of uniform adapter interfaces towards an upper layer.
The method for testing the API interface of the short message service provider has the following beneficial effects:
by utilizing the Apache Http Client framework, a set of short message service middle layer is formed, the workload is reduced, and the API interfaces of all short message service providers can be accessed more conveniently and tested efficiently.
Detailed Description
The present invention will be specifically described with reference to the following specific examples.
Through extensive profiling and summarization, the APIs of the short message service provider mainly comprise an API interface of an embedded SDK mode and an API interface based on an HTTP call mode (Representational State Transfer, RESTful). The short messages are classified according to the content, and comprise verification type short messages, notification type short messages and marketing type short messages; according to the sending objects, the short messages are divided into single-object short messages and multi-object short messages. Aiming at the multi-object short message, the multi-object short message is divided into multi-object short messages with the same content and multi-object short messages with different contents.
The method for testing the API interface of the short message service provider provided by the embodiment of the invention is suitable for the API interface based on the HTTP call mode, and comprises the following steps:
s101, respectively extracting URL addresses and parameters corresponding to the API interfaces of the short message service providers.
S102, storing the URL address and the parameters in a data table.
S103, utilizing Apache Http Client frame to obtain URL address and parameter from data table and assemble URL address and parameter into data format required by short message service request.
S104, according to the API interface of each SMS business, sending SMS business request to the corresponding SMS business.
S105, according to the returned result of each SMS business, testing the API interface of each SMS business.
Optionally, according to the result returned by each sms service provider, testing the API interface of each sms service provider includes:
and respectively judging whether the returned results of the short message service providers are consistent with the corresponding sent contents, and if so, determining that the corresponding API of the short message service provider passes the test.
Optionally, the parameters include:
the method comprises the steps of URL address corresponding to an API interface of a short message service provider, a request method of the short message service provider, an authentication mode/token of the short message service provider, a request parameter list of the short message service provider, a data exchange mode of the short message service provider and service public parameters of the short message service provider.
As a specific embodiment of the invention, the URL address corresponding to the API of the SMS comprises:
http:// serviceA/sendMessageAPI, http:// serviceB/sendMessageAPI, the SMS server request method includes POST and GET.
Optionally, the data format required by the short message service request includes a FORM format and a JSON message body format.
Optionally, the service public parameters of the short message service provider include:
the number of the mobile phone to be sent and the content to be sent.
According to the method for testing the API interface of the short message service provider, URL addresses and parameters corresponding to the API interfaces of the short message service provider are respectively extracted, the URL addresses and the parameters are stored in the data table, the Apache Http Client framework is utilized to obtain the URL addresses and the parameters from the data table, the URL addresses and the parameters are assembled into a data format required by the short message service request, the short message service request is sent to the corresponding short message service provider according to the API interface of the short message service provider, the API interface of the short message service provider is tested according to the returned result of the short message service provider, the workload is reduced, the API interface of the short message service provider can be conveniently accessed, and the efficiency of testing the API interface of the short message service provider is improved.
The other test method of the short message service provider API interface provided by the embodiment of the invention is suitable for the API interface of the embedded SDK mode, and comprises the following steps:
and shielding the difference of SDK functions of each short message service provider by using an adapter design mode, and packaging a set of uniform adapter interfaces towards an upper layer.
Although the test scheme is not as good as the test scheme of the API interface based on the HTTP call mode (can be configured on the premise of not developing), certain adaptation work is still needed, but the test scheme reduces a considerable amount of workload compared with the prior art.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the methods and apparatus described above may be referenced to one another. In addition, the "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent the merits and merits of the embodiments.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.
Claims (5)
1. The method for testing the API of the short message service provider is characterized by comprising the following steps:
respectively extracting URL addresses and parameters corresponding to the API interfaces of the short message service providers;
storing the URL address and the parameters in a data table;
the parameters include:
URL address corresponding to API interface of SMS service provider, request method of SMS service provider, authentication mode/token of SMS service provider, request parameter list of SMS service provider, data exchange mode of SMS service provider, service public parameter of SMS service provider;
acquiring the URL address and the parameters from the data table by using a Apache Http Client framework, and assembling the URL address and the parameters into a data format required by a short message service request;
according to the API interface of each SMS service provider, sending an SMS service request to the corresponding SMS service provider;
the API of the SMS service provider comprises an API interface of an embedded SDK mode and an API interface based on an HTTP call mode; the short messages are classified according to the content, and comprise verification type short messages, notification type short messages and marketing type short messages; according to the sending object, the short message is divided into a single-object short message and a multi-object short message; the multi-object short message is divided into multi-object short messages with the same content and multi-object short messages with different contents;
and testing the API interfaces of the short message service providers according to the results returned by the short message service providers.
2. The method for testing API of sms service provider according to claim 1, wherein testing the API of each sms service provider according to the result returned from each sms service provider comprises:
and respectively judging whether the returned results of the short message service providers are consistent with the corresponding sent contents, and if so, determining that the corresponding API of the short message service provider passes the test.
3. The method according to claim 1, wherein the data format required by the sms request includes a FORM format and a JSON message body format.
4. The method for testing an API of a sms service provider according to claim 1, wherein the service common parameters of the sms service provider include:
the number of the mobile phone to be sent and the content to be sent.
5. The method for testing an API of a sms service provider according to claim 1, further comprising:
and shielding the difference of SDK functions of each short message service provider by using an adapter design mode, and packaging a set of uniform adapter interfaces towards an upper layer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010896186.9A CN112069064B (en) | 2020-08-31 | 2020-08-31 | API (application program interface) testing method for short message service provider |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010896186.9A CN112069064B (en) | 2020-08-31 | 2020-08-31 | API (application program interface) testing method for short message service provider |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112069064A CN112069064A (en) | 2020-12-11 |
CN112069064B true CN112069064B (en) | 2024-02-02 |
Family
ID=73664834
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010896186.9A Active CN112069064B (en) | 2020-08-31 | 2020-08-31 | API (application program interface) testing method for short message service provider |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112069064B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112506807B (en) * | 2021-02-07 | 2021-05-11 | 上海洋漪信息技术有限公司 | Automatic test system for interface serving multiple systems |
CN113794999B (en) * | 2021-08-20 | 2022-11-01 | 上海德吾信息科技有限公司 | Short message distribution method, device and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1988575A (en) * | 2005-12-20 | 2007-06-27 | 国富通信息技术发展有限公司 | Method and system for checking real name by using radio terminal |
CN101453711A (en) * | 2007-12-06 | 2009-06-10 | 中兴通讯股份有限公司 | Automatic test system and test method for mobile phone short message |
CN101645013A (en) * | 2009-09-07 | 2010-02-10 | 中兴通讯股份有限公司 | Plug-in type service management system and method of integrated service management platform |
CN107707433A (en) * | 2017-11-14 | 2018-02-16 | 北京思特奇信息技术股份有限公司 | A kind of method and computer equipment from network platform test operation flow |
CN107832217A (en) * | 2017-11-09 | 2018-03-23 | 政采云有限公司 | A kind of automated testing method and device |
CN108809890A (en) * | 2017-04-26 | 2018-11-13 | 腾讯科技(深圳)有限公司 | Leak detection method, test server and client |
CN110830420A (en) * | 2018-08-10 | 2020-02-21 | 杭州字符串科技有限公司 | Method and system for verifying short message verification code |
CN110971614A (en) * | 2019-12-17 | 2020-04-07 | 软通动力信息技术(集团)有限公司 | Internet of things adaptation method and system, computer equipment and storage medium |
CN111026636A (en) * | 2019-09-27 | 2020-04-17 | 珠海随变科技有限公司 | Software project testing method, device, equipment and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130290441A1 (en) * | 2012-04-27 | 2013-10-31 | Mobitv, Inc. | Server logging module |
US10476982B2 (en) * | 2015-05-15 | 2019-11-12 | Cisco Technology, Inc. | Multi-datacenter message queue |
US20200117523A1 (en) * | 2018-10-15 | 2020-04-16 | Ca, Inc. | Statistical deep content inspection of api traffic to create per-identifier interface contracts |
-
2020
- 2020-08-31 CN CN202010896186.9A patent/CN112069064B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1988575A (en) * | 2005-12-20 | 2007-06-27 | 国富通信息技术发展有限公司 | Method and system for checking real name by using radio terminal |
CN101453711A (en) * | 2007-12-06 | 2009-06-10 | 中兴通讯股份有限公司 | Automatic test system and test method for mobile phone short message |
CN101645013A (en) * | 2009-09-07 | 2010-02-10 | 中兴通讯股份有限公司 | Plug-in type service management system and method of integrated service management platform |
CN108809890A (en) * | 2017-04-26 | 2018-11-13 | 腾讯科技(深圳)有限公司 | Leak detection method, test server and client |
CN107832217A (en) * | 2017-11-09 | 2018-03-23 | 政采云有限公司 | A kind of automated testing method and device |
CN107707433A (en) * | 2017-11-14 | 2018-02-16 | 北京思特奇信息技术股份有限公司 | A kind of method and computer equipment from network platform test operation flow |
CN110830420A (en) * | 2018-08-10 | 2020-02-21 | 杭州字符串科技有限公司 | Method and system for verifying short message verification code |
CN111026636A (en) * | 2019-09-27 | 2020-04-17 | 珠海随变科技有限公司 | Software project testing method, device, equipment and storage medium |
CN110971614A (en) * | 2019-12-17 | 2020-04-07 | 软通动力信息技术(集团)有限公司 | Internet of things adaptation method and system, computer equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
HTTP接口自动化测试方法研究;杨清玉 等;《微型机与应用》;第35卷(第18期);22-25 * |
Mobile Application Web API Reconnaissance: Web-to-Mobile Inconsistencies & Vulnerabilities;A. Mendoza 等;《 2018 IEEE Symposium on Security and Privacy (SP)》;756-769 * |
Also Published As
Publication number | Publication date |
---|---|
CN112069064A (en) | 2020-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10693885B2 (en) | Social networking behavior-based identity system | |
US9065817B2 (en) | Authenticating linked accounts | |
TWI745473B (en) | Network verification method and device | |
US9390255B2 (en) | Privileged account manager, dynamic policy engine | |
CN112069064B (en) | API (application program interface) testing method for short message service provider | |
JP6599906B2 (en) | Login account prompt | |
US8996687B2 (en) | Context-based computing framework | |
US7984421B2 (en) | Web application cloning | |
US9471896B2 (en) | Memo synchronization system, mobile system, and method for synchronizing memo data | |
TWI761385B (en) | Device configuration method, device, and system | |
CN104580074A (en) | Logging method of client end application and corresponding server of logging method | |
WO2021068518A1 (en) | Identity authentication method and system, electronic equipment and storage medium | |
US10609060B2 (en) | Clustering network addresses | |
CN105022939B (en) | Information Authentication method and device | |
US20130014126A1 (en) | Cross-browser communication between devices on a network | |
CN110795174B (en) | Application program interface calling method, device, equipment and readable storage medium | |
CN109669718A (en) | System permission configuration method, device, equipment and storage medium | |
CN105847853A (en) | Video content distribution method and device | |
US20210014278A1 (en) | Multi-tenant authentication framework | |
US20160337308A1 (en) | Electronic mail prompting method and server | |
CN108259436A (en) | Authenticating user identification processing method, application server and Verification System server | |
CN108449367B (en) | Method and device for managing user login security, electronic equipment and readable medium | |
Kirsan et al. | Improved access speed of the Codeigniter framework and REST APIs for the implementation of SIAKAD: Academic information system in Balikpapan schools | |
Lakkireddy et al. | Web-based Application for Real-Time Chatting using Firebase | |
Yang et al. | Access to mobile services |
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 |