CN111274141B - Test management method and device of API client - Google Patents

Test management method and device of API client Download PDF

Info

Publication number
CN111274141B
CN111274141B CN202010062997.9A CN202010062997A CN111274141B CN 111274141 B CN111274141 B CN 111274141B CN 202010062997 A CN202010062997 A CN 202010062997A CN 111274141 B CN111274141 B CN 111274141B
Authority
CN
China
Prior art keywords
api client
target module
module
alias
api
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
Application number
CN202010062997.9A
Other languages
Chinese (zh)
Other versions
CN111274141A (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010062997.9A priority Critical patent/CN111274141B/en
Publication of CN111274141A publication Critical patent/CN111274141A/en
Application granted granted Critical
Publication of CN111274141B publication Critical patent/CN111274141B/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/3696Methods or tools to render software testable
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a test management method and a test management device for an API client, which are used for importing a target module to be tested; acquiring and storing an API client path of a target module; binding and associating the API client with the authentication information thereof; an API client alias is set and associated with the API client path. The invention does not need to be familiar with and input various paths, only needs to input the request containing the alias, strengthens the specification, avoids the use difference caused by human factors, enhances the code readability and improves the code execution efficiency.

Description

Test management method and device of API client
Technical Field
The invention relates to the field of testing of API clients, in particular to a testing management method and device of an API client.
Background
The existing software system becomes more and more complex, and more services, modules and sub-modules of the system are also more and more. The existing architecture is generally organized in a manner of "path= > module= > sub-module= > API client", and when in use, the existing architecture is also called in a manner of "path= > module= > sub-module= > API client". When the API client terminal is automatically tested, authentication information (login) is required to be acquired first to acquire operation authority, then an API client terminal path is input, and then test operation is carried out. Because the code organization structure is complex, the client needs to be familiar with various paths when using the client, and the code organization structure is quite complicated to use, easy to make mistakes and low in efficiency; when a plurality of persons use, an irregular condition is caused, and the readability of the code is deteriorated.
Disclosure of Invention
In order to solve the problems, the invention provides a test management method and a test management device for an API client, which are used for uniformly managing the API client and improving the code execution efficiency by standardizing alias calling.
The technical scheme of the invention is as follows: a test management method of an API client comprises the following steps:
importing a target module to be tested;
acquiring and storing an API client path of a target module;
binding and associating the API client with the authentication information thereof;
an API client alias is set and associated with the API client path.
Further, when the target module to be tested is imported, whether the target module contains a third-party plug-in module or not is detected, and if the target module contains the third-party plug-in module, the target module is imported together.
Further, after the target module to be tested is imported, checking whether the target module is an available service module, if not, terminating the test, and sending out abnormal reminding information.
Further, the set API client alias contains its name and authentication information.
Further, the method further comprises the steps of: and displaying the set API client alias.
The technical scheme of the invention also comprises a test management device of the API client, which comprises the following components:
a test target module importing unit importing a target module to be tested;
the target module registration unit acquires and stores an API client path of the test target module;
an authentication information binding unit for binding and associating the API client with the authentication information thereof;
and the alias management unit is used for setting the API client aliases and associating the API client aliases with the API client paths.
Further, when the target module to be tested is imported by the test target module importing unit, whether the target module contains a third-party plug-in module or not is detected, and if the target module contains the third-party plug-in module, the target module is imported together.
Further, the method further comprises the following steps:
and the target module verification unit is used for verifying whether the target module is an available service module or not after the target module to be tested is imported by the target module importing unit, and if the target module is not available, terminating the test and sending out abnormal reminding information.
Further, the method further comprises the following steps:
and the alias display unit is used for displaying the API client aliases set by the alias management unit.
Further, the method further comprises the following steps:
and the API client calling unit is used for receiving a calling request containing the API client alias, acquiring a corresponding API client path according to the API client alias and calling the API client.
According to the test management method and device for the API client, the API client is subjected to unified management, the API client path is acquired and stored, the API client authentication information is bound and associated, finally, the API client path is managed by the standard alias, when a test call is carried out, a request containing the alias is input, the corresponding path is acquired through the alias, the API client is called, and meanwhile, the API client is bound with the authentication information, and only the user with corresponding authority is allowed to call. Compared with the prior art, the method has the advantages that the method does not need to be familiar with and input various paths, only needs to input the request containing the alias, strengthens the specification, avoids the use difference caused by human factors, enhances the code readability and improves the code execution efficiency. The method supports the third-party plug-in module to add the test, and the method is the same as the core fixed module, and the corresponding paths are uniformly managed.
Drawings
FIG. 1 is a flow chart of a method according to an embodiment of the invention.
Detailed Description
The present invention will be described in detail below by way of specific examples with reference to the accompanying drawings, the following examples being illustrative of the present invention and the present invention is not limited to the following embodiments.
Example 1
The embodiment provides a test management method of an API client, which is used for uniformly managing paths of the API client, binding authentication information and setting aliases in a standard mode, so that the paths are input for testing when the paths are called, and manual path input is not needed.
As shown in fig. 1, the method specifically includes the following steps:
s1, importing a target module to be tested;
considering that when testing of third party services is extended, the test code needs to be added in the existing code structure, if the services of the third party are more and more, the maintenance and upgrading of the test code on the third party plug-in module are inconvenient.
In the step, when the target module to be tested is imported, whether the target module contains a third-party plug-in module or not is detected, and if the target module contains the third-party plug-in module, the target module is imported together. The target module may include a core fixed module and a third-party plug-in module, and if the target module includes the third-party plug-in module, the target module is imported together, and then the API client path and authentication information of the third-party plug-in module are obtained according to the same steps, and a calling alias is set. If the core fixed module does not contain the third-party plug-in module, the third-party plug-in module is skipped to be imported, and only the core fixed module is imported.
In addition, after the target module to be tested is imported, whether the target module is an available service module is checked, if not, the test is terminated, and abnormal reminding information is sent out.
S2, acquiring and storing an API client path of the target module;
the target module is registered, the corresponding relation between the target module and the API client path is managed, and the correct code is conveniently called.
S3, binding and associating the API client with the authentication information thereof;
different roles have different operation authorities, so that the API client is bound and associated with authentication information thereof so as to call different authorities subsequently.
S4, setting an API client alias and associating the API client alias with an API client path;
the specification sets up the alias, which is easy to understand. The set API client alias contains the name and authentication information, and a user can know the corresponding API client and the corresponding authentication information according to the alias.
In addition, the set API client aliases are displayed, so that testers can know and call the API clients contained in the management device conveniently.
To further explain the present solution, a specific implementation is provided below. The method comprises the following steps:
(1) The target module to be tested is imported. The target modules are already maintained code, organized in a "module-submodule/functional class" configuration. Such as "services/computer/fixed_ips_c file. Py", there are specific related API methods in the client file. When the test cases are imported, judging whether the test cases in the plug-in form exist, and if so, importing the test cases together; without, only the core fixing module is imported.
(2) After the test target module is successfully imported, the module is registered. A client code path, such as FixedIPsClient, is obtained and saved for the corresponding code path service.
(3) After registration is completed, binding association between clients and authentication information is performed. Such as: and if the operation authority is an admin role, the binding relationship is FixedIPsClient, namely admin.
(4) Setting aliases of clients according to the association relation in the step (3). Such as: for the client in step 3, set to os_admin. If the authority is other authorities, the admin is modified to the corresponding role name, as per member, primary.
(5) Thus, when calling the client, the os_admin_fixed_ips_client () mode can be used for calling. I.e. inputting os_admin. Fixed_ips_client, show_fixed_ip () call request, obtaining a path service. Com. Fixed_ips_client according to the alias os_admin. Fixed_ips_client, obtaining a client fixed_ips_client according to the path, and finding a show_fixed_ip () interface under the client. The calling process does not require the testers to be familiar with the path.
Example two
The embodiment provides a test management device of an API client for realizing the method, which comprises the following functional units.
A test target module importing unit importing a target module to be tested;
the target module registration unit acquires and stores an API client path of the test target module;
an authentication information binding unit for binding and associating the API client with the authentication information thereof;
and the alias management unit is used for setting the API client aliases and associating the API client aliases with the API client paths.
Considering that when testing of third party services is extended, the test code needs to be added in the existing code structure, if the services of the third party are more and more, the maintenance and upgrading of the test code on the third party plug-in module are inconvenient. Therefore, when the target module to be tested is imported by the test target module importing unit, whether the target module contains the third-party plug-in module or not is detected, and if the target module contains the third-party plug-in module, the target module is imported together. The target module may include a core fixed module and a third-party plug-in module, and if the target module includes the third-party plug-in module, the target module is imported together, and then the API client path and authentication information of the third-party plug-in module are obtained according to the same steps, and a calling alias is set. If the core fixed module does not contain the third-party plug-in module, the third-party plug-in module is skipped to be imported, and only the core fixed module is imported.
In addition, in order to improve the test efficiency, a target module verification unit is arranged, after a target module to be tested is imported, whether the target module is an available service module is verified, if not, the test is terminated, and abnormal reminding information is sent out.
And the alias display unit is also arranged for displaying the API client aliases set by the alias management unit. The tester can conveniently know and call the API client contained in the management device. The specification sets up the alias, which is easy to understand. The set API client alias contains the name and authentication information, and a user can know the corresponding API client and the corresponding authentication information according to the alias.
The device also sets an API client calling unit, receives a calling request containing an API client alias, acquires a corresponding API client path according to the API client alias, and calls the API client. Namely, when a tester performs a test, a call request is input in an API client call unit, the call request comprises an API client alias, a specific implementation mode in embodiment one inputs an os_admin_ips_client_show_fixed_ip () call request, a path service, computer_fixed_ips_client is obtained according to the alias os_admin_fixed_ips_client, a client fixed_ips_client is obtained according to the path, and a show_fixed_ip () interface under the client is found.
The foregoing disclosure is merely illustrative of the preferred embodiments of the invention and the invention is not limited thereto, since modifications and variations may be made by those skilled in the art without departing from the principles of the invention.

Claims (4)

1. The test management method of the API client is characterized by comprising the following steps of:
importing a target module to be tested; when a target module to be tested is imported, detecting whether the target module contains a third-party plug-in module, if so, importing the target module together, and if not, importing the target module by skipping the third-party plug-in module;
the method comprises the steps of acquiring and storing the API client path of the target module, wherein the method specifically comprises the following steps: registering the target module, and managing the corresponding relation between the target module and the API client path;
binding and associating the API client with the authentication information thereof;
setting an API client alias and associating the API client alias with an API client path; the set API client alias contains the name and authentication information thereof, so that a user can obtain the corresponding API client and the corresponding authentication information according to the alias;
if the third-party plug-in module is imported, acquiring an API client path and authentication information of the third-party plug-in module according to the same steps as the target module for the imported third-party plug-in module, and setting a calling alias;
the method further comprises the steps of: displaying the set API client aliases so that testers can know and call the API clients contained in the management device;
and during testing, inputting a call request containing the API client aliases, acquiring a corresponding API client path according to the API client aliases contained in the call request, and calling the API client.
2. The method for testing and managing an API client according to claim 1, wherein after importing a target module to be tested, checking whether the target module is an available service module, if not, terminating the test, and sending out an exception alert.
3. A test management apparatus of an API client, comprising:
a test target module importing unit importing a target module to be tested;
the target module registration unit acquires and stores an API client path of the test target module, and specifically comprises the following steps: registering the target module, and managing the corresponding relation between the target module and the API client path;
an authentication information binding unit for binding and associating the API client with the authentication information thereof;
the alias management unit is used for setting an API client alias and associating the API client alias with an API client path;
the alias display unit is used for displaying the API client aliases set by the alias management unit;
the API client calling unit receives a calling request containing an API client alias, acquires a corresponding API client path according to the API client alias, and calls the API client;
when the target module to be tested is imported by the test target module importing unit, whether the target module contains a third-party plug-in module or not is detected, if the target module contains the third-party plug-in module, the target module is imported together, and if the target module does not contain the third-party plug-in module, the third-party plug-in module importing is skipped.
4. The API client test management apparatus as recited in claim 3, further comprising:
and the target module verification unit is used for verifying whether the target module is an available service module or not after the target module to be tested is imported by the target module importing unit, and if the target module is not available, terminating the test and sending out abnormal reminding information.
CN202010062997.9A 2020-01-19 2020-01-19 Test management method and device of API client Active CN111274141B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010062997.9A CN111274141B (en) 2020-01-19 2020-01-19 Test management method and device of API client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010062997.9A CN111274141B (en) 2020-01-19 2020-01-19 Test management method and device of API client

Publications (2)

Publication Number Publication Date
CN111274141A CN111274141A (en) 2020-06-12
CN111274141B true CN111274141B (en) 2024-02-09

Family

ID=71000937

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010062997.9A Active CN111274141B (en) 2020-01-19 2020-01-19 Test management method and device of API client

Country Status (1)

Country Link
CN (1) CN111274141B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220259A (en) * 2012-01-20 2013-07-24 华为技术有限公司 Using method, call method, device and system of Oauth application programming interface (API)
CN106055943A (en) * 2016-05-30 2016-10-26 杭州华澜微电子股份有限公司 Memory disc identity authentication method
CN108376076A (en) * 2018-05-28 2018-08-07 郑州云海信息技术有限公司 A kind of method and apparatus of installation software
CN109408250A (en) * 2018-09-27 2019-03-01 天津字节跳动科技有限公司 Call application programming interface API approach, device, electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103220259A (en) * 2012-01-20 2013-07-24 华为技术有限公司 Using method, call method, device and system of Oauth application programming interface (API)
CN106055943A (en) * 2016-05-30 2016-10-26 杭州华澜微电子股份有限公司 Memory disc identity authentication method
CN108376076A (en) * 2018-05-28 2018-08-07 郑州云海信息技术有限公司 A kind of method and apparatus of installation software
CN109408250A (en) * 2018-09-27 2019-03-01 天津字节跳动科技有限公司 Call application programming interface API approach, device, electronic equipment

Also Published As

Publication number Publication date
CN111274141A (en) 2020-06-12

Similar Documents

Publication Publication Date Title
CN105490815B (en) Short message verification code acquisition methods and device, login method, apparatus and system
CN108335237B (en) Scheme setting method, terminal and computer readable storage medium
CN110324612B (en) Television testing method, testing control terminal and television
US8204498B1 (en) Automated content download tool
CN108990047B (en) Test method, device and medium for subscription relationship management data preparation platform
CN104980393B (en) Method of calibration, system, server and terminal
ES2817936T3 (en) Methods and systems for verifying users by phone numbers
CN103973506B (en) A kind of domain name method of calibration, Apparatus and system
CN109462601A (en) Multi-platform access method and device based on eSIM
CN113938886A (en) Identity authentication platform test method, device, equipment and storage medium
CN111371793A (en) Communication method and communication system
CN110852711A (en) Signing method, signing device, storage medium and electronic equipment
CN110149629A (en) A kind of method and system of fast registration and login application program based on mobile phone
CN112953791A (en) Network detection method and device, electronic equipment and computer readable storage medium
CN105426272B (en) Application Backup method and device
US20220027429A1 (en) Dynamically determining a server for enrollment with management system
CN111274141B (en) Test management method and device of API client
CN110248356A (en) Information acquisition method and device
CN106230702A (en) Identity information verification method, Apparatus and system
CN108280024B (en) Flow distribution strategy testing method and device and electronic equipment
CN110602700B (en) Seed key processing method and device and electronic equipment
US20150332597A1 (en) Method and system for providing education contents
CN113452533B (en) Charging self-inspection and self-healing method and device, computer equipment and storage medium
CN111831566A (en) Test method, test device, electronic equipment and computer readable storage medium
CN111200512B (en) Network connection disaster recovery method, terminal equipment, storage medium and electronic equipment

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