CN112380145A - SDK generation method, device, equipment and readable storage medium - Google Patents

SDK generation method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN112380145A
CN112380145A CN202110051565.2A CN202110051565A CN112380145A CN 112380145 A CN112380145 A CN 112380145A CN 202110051565 A CN202110051565 A CN 202110051565A CN 112380145 A CN112380145 A CN 112380145A
Authority
CN
China
Prior art keywords
sdk
source code
test case
template
generating
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
Application number
CN202110051565.2A
Other languages
Chinese (zh)
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.)
Irootech Technology Co ltd
Original Assignee
Irootech 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 Irootech Technology Co ltd filed Critical Irootech Technology Co ltd
Priority to CN202110051565.2A priority Critical patent/CN112380145A/en
Publication of CN112380145A publication Critical patent/CN112380145A/en
Pending legal-status Critical Current

Links

Images

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 application provides an SDK generation method, an SDK generation device, SDK generation equipment and a readable storage medium, and relates to the technical field of computers. The method comprises the following steps: generating an SDK source code and a test case source code corresponding to the SDK source code by a template engine according to configured API information and a template file, wherein the API information comprises input parameter description information and output parameter description information of an API, and the template file comprises a test case generation rule; compiling the SDK source code and the test case source code, and testing the SDK obtained after compiling by using the test case obtained after compiling; and uploading the SDK source code to a code warehouse after the SDK test obtained after compiling passes. Therefore, the test case for carrying out the automatic test can be obtained without manual writing, and the SDK source code passing the automatic test can be obtained.

Description

SDK generation method, device, equipment and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for generating an SDK.
Background
With the rise of the internet and the prevalence of open cooperative thinking, different terminals and third-party developers need a large amount of capability of accessing to the core services of the platform. Nowadays, the complexity of software systems is higher and higher, and the functions provided by an API (Application Programming Interface) are more and more powerful. In order to reduce the threshold of software development, it is becoming more and more trend that one software system provides API services to other software systems, OpenAPI has become an important bridge for completing integration between systems, and the availability of OpenAPI and the user experience in use become more and more important.
The API needs to maintain SDKs (Software Development Kit) in each language version. Each time of adding, modifying and deleting the API, the SDK is required to be correspondingly adjusted, and a corresponding test case Codesample is manually compiled so as to test the adjusted SDK by using the test case. Because the test cases are manually written, a lot of manpower is needed.
Disclosure of Invention
In view of the above, an object of the present invention is to provide an SDK generating method, apparatus, device and readable storage medium, which can automatically generate test cases, thereby avoiding the need to consume a large amount of manpower to maintain the test cases.
The embodiment of the application can be realized as follows:
in a first aspect, an embodiment of the present application provides an SDK generation method, which is applied to an SDK generation device, and includes:
generating an SDK source code and a test case source code corresponding to the SDK source code by a template engine according to configured API information and a template file, wherein the API information comprises input parameter description information and output parameter description information of an API, and the template file comprises a test case generation rule;
compiling the SDK source code and the test case source code, and testing the SDK obtained after compiling by using the test case obtained after compiling;
and uploading the SDK source code to a code warehouse after the SDK test obtained after compiling passes.
In an optional embodiment, the generating, by the template engine, the SDK source code and the test case source code corresponding to the SDK source code according to the configured API information and the template file includes:
generating an API information code under a target language corresponding to the template file through the template engine based on the configured API information;
and generating the SDK source code and the test case source code in the target language based on the API information code and the template file through the template engine.
In an optional embodiment, the template file further includes a preset field processing rule, the preset field processing rule includes a field alias conversion rule, and the generating, by the template engine, the SDK source code and the test case source code in the target language based on the API information code and the template file includes:
and in the process of generating the SDK source code and the test case source code, if a field corresponding to the preset field processing rule is detected, processing according to the preset processing rule corresponding to the field to obtain the SDK source code and the test case source code.
In an optional embodiment, the configured template files include template files corresponding to different target languages, and the generating, by the template engine, the SDK source code and the test case source code corresponding to the SDK source code according to the configured API information and the template files includes:
and aiming at different target languages, generating the SDK source code and the test case source code corresponding to the target language by the template engine according to the configured API information and the template file corresponding to the target language.
In an alternative embodiment, the method further comprises:
after the SDK source code is released, testing the SDK source code by using a test case corresponding to the SDK source code;
and if the test case which does not pass the test exists, sending prompt information to the service providing equipment and/or the service using equipment corresponding to the SDK source code.
In a second aspect, an embodiment of the present application provides an SDK generating apparatus, which is applied to an SDK generating device, and includes:
the source code generation module is used for generating an SDK source code and a test case source code corresponding to the SDK source code according to configured API information and a template file through a template engine, wherein the API information comprises input parameter description information and output parameter description information of an API, and the template file comprises a test case generation rule;
the test module is used for compiling the SDK source code and the test case source code and testing the SDK obtained after compiling by using the test case obtained after compiling;
and the sending module is used for uploading the SDK source code to a code warehouse after the SDK test obtained after compiling passes.
In an optional embodiment, the configured template files include template files corresponding to different target languages, and the source code generation module is specifically configured to:
and aiming at different target languages, generating the SDK source code and the test case source code corresponding to the target language by the template engine according to the configured API information and the template file corresponding to the target language.
In an optional embodiment, the apparatus further comprises a monitoring module, the monitoring module is configured to:
after the SDK source code is released, testing the SDK source code by using a test case corresponding to the SDK source code;
and if the test case which does not pass the test exists, sending prompt information to the service providing equipment and/or the service using equipment corresponding to the SDK source code.
In a third aspect, an embodiment of the present application provides an SDK generation device, including a processor and a memory, where the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the SDK generation method described in any one of the foregoing embodiments.
In a fourth aspect, the present application provides a readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the SDK generation method according to any one of the foregoing embodiments.
According to the SDK generation method, the SDK generation device, the SDK generation equipment and the readable storage medium, the SDK source code and the test case source code corresponding to the SDK source code are generated through the template engine according to the configured API information and the template file, wherein the API information comprises the input parameter description information and the output parameter description information of the API, and the template file comprises the test case generation rule; and then, by compiling, testing the SDK obtained by compiling by using the test case obtained by compiling, and uploading the SDK source code to a code warehouse if the test passes. Therefore, the template engine, the configured API information and the template file can be used for obtaining the SDK and simultaneously obtaining the test case for testing the SDK, manual writing is not needed, and a large amount of manpower can be saved; meanwhile, SDK source codes passing automated testing can be obtained.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic block diagram of an SDK generation device according to an embodiment of the present application;
fig. 2 is a schematic flow chart of an SDK generation method according to an embodiment of the present disclosure;
fig. 3 is a second schematic flowchart of an SDK generation method according to an embodiment of the present application;
fig. 4 is a schematic block diagram of an SDK generation apparatus according to an embodiment of the present application;
fig. 5 is a second block diagram of an SDK generating apparatus according to an embodiment of the present application.
Icon: 100-an SDK generating device; 110-a memory; 120-a processor; 130-a communication unit; 200-SDK generating means; 210-a source code generation module; 220-a test module; 230-a sending module; 240 — monitoring module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present application, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. are used for indicating the orientation or positional relationship based on the orientation or positional relationship shown in the drawings or the orientation or positional relationship which the present invention product is usually put into use, it is only for convenience of describing the present application and simplifying the description, but it is not intended to indicate or imply that the referred device or element must have a specific orientation, be constructed in a specific orientation and be operated, and thus, should not be construed as limiting the present application.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a block diagram of an SDK generating device 100 according to an embodiment of the present disclosure. The SDK generating device 100 may be, but is not limited to, a computer, a server, and the like. The SDK generating device 100 includes a memory 110, a processor 120, and a communication unit 130. The elements of the memory 110, the processor 120 and the communication unit 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 110 is used to store programs or data. The Memory 110 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 120 is used to read/write data or programs stored in the memory 110 and perform corresponding functions. For example, the storage 110 stores therein an SDK generating apparatus 200, and the SDK generating apparatus 200 includes at least one software functional module which can be stored in the storage 110 in the form of software or firmware (firmware). The processor 120 executes various functional applications and data processing by running software programs and modules stored in the memory 110, such as the SDK generating apparatus 200 in the embodiment of the present application, so as to implement the SDK generating method in the embodiment of the present application.
The communication unit 130 is configured to establish a communication connection between the SDK generating device 100 and another communication terminal through a network, and to transceive data through the network.
It should be understood that the structure shown in fig. 1 is only a schematic structural diagram of the SDK generating device 100, and the SDK generating device 100 may further include more or less components than those shown in fig. 1, or have a different configuration than that shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 2, fig. 2 is a schematic flow chart of an SDK generation method according to an embodiment of the present disclosure. The method may be applied to the SDK generating apparatus 100 described above. The following describes a specific flow of the SDK generation method in detail.
And step S110, generating an SDK source code and a test case source code corresponding to the SDK source code through a template engine according to the configured API information and the template file.
In this embodiment, the SDK generating device 100 may store pre-configured API information and template files. Alternatively, a worker at the service providing device may operate the service providing device to make the service providing device obtain the API information and send the API information to the SDK generating device 100.
As an optional implementation manner, the service provider may provide a json file corresponding to the API to the service providing device, and the service providing device sends the json file as API information to the SDK generating device 100. The service providing device may also provide a visualization page on which the service provider performs configuration, and sends the content configured by the service provider as the API information to the SDK generating device 100. The data of the page configuration can be directly stored in a database of the service providing equipment, and the service provider can modify the data again next time; the json file uploaded by the service provider may also be parsed, and the parsed memory may be stored in the database, so that the subsequent service provider may modify the API information stored in the database, and send the modified API information to the SDK generating device 100 through the service providing device, and the wireless user manually edits the json file first and then performs an uploading operation.
After obtaining the API information sent by the service providing device, the API information may be verified, and if the API information passes the verification, the API information is reused to generate the SDK source code. The check rule may be determined according to actual requirements, for example, whether a field repetition problem exists is checked, and if the field repetition problem exists, the API information is returned to the service provider so that the service provider can modify the API information.
It is understood that the SDK generating device 100 may obtain the API information in other manners, which are only examples. The API information may include input parameter description information of the API, output parameter description information of the API, and information such as an error code. For example, the input parameter description information of the API may include: the user id, type is String, description, example, and so on. The error code indicates that a prompt indicating an error is returned.
The staff member may perform an input operation on the SDK generating device 100, so that the SDK generating device 100 obtains the module file. Wherein, the template file may include: configuration files, uploaded dependency packages, template rules, and the infrastructure of the request corresponding to the language used by the template file. The configuration file may be a manually written configuration file meeting a specification or convention, and the configuration file may include test case generation rules. The test case generation rule may include a rule that is relied on when a test case is generated, for example, it is determined according to a service that an interface B needs to be called before an interface a is called, and then the interface B needs to be called first in the generated test case.
Other content may also be included in the configuration file, such as contact information associated with the service provider, a repository address published by the SDK, and so forth. According to the relevant contact information of the service providing terminal, corresponding prompt information can be provided for the service providing equipment or the mobile electronic equipment used by the service providing terminal. Of course, it is understood that other contents may be included in the configuration file, and the details may be determined according to actual requirements.
The template rule is a corresponding rule formulated according to a standard file of a template engine. The underlying structure of the respective request may be defined according to different linguistic characteristics.
The SDK generating device 100 may include a template engine, and further generate, by the template engine, an SDK source code and a test case source code corresponding to the SDK source code based on API information including input parameter description information and output parameter description information of the API and a template file including a test case generation rule. The template engine is generated for separating the user interface from the service data (content), and can generate a document with a specific format, and the template engine for the website generates a standard HTML document.
And step S120, compiling the SDK source code and the test case source code, and testing the SDK obtained after compiling by using the test case obtained after compiling.
And step S130, after the SDK obtained after compiling passes the test, uploading the SDK source code to a code warehouse.
Before the SDK source code is issued, the SDK source code needs to be compiled and automatically tested so as to ensure the quality of the issued SDK source code and also can give an early warning to some possible problems. Optionally, in the case of obtaining the SDK source code and the test case source code, the source code may be compiled and issued by using a CI/CD (continuous integration) and continuous delivery) system.
The obtained SDK source codes and the test case source codes can be compiled respectively to obtain the compiled SDK and the compiled test case, and then the compiled SDK is automatically tested by utilizing the compiled test case. If the compiled SDK passes all the test cases, the SDK source code can be uploaded to a code warehouse. Uploading prompt information can be sent to the service using equipment using the SDK source code so that a service user at the service using equipment can update the version of the used SDK.
In the test process, if a request inconsistent with an expected result occurs, for example, a server request error, a 404 status code, a request timeout, and the like, monitoring alarm information may be sent to the service providing device, so that a service provider at the service providing device can process the request in time.
According to the embodiment of the application, the SDK source code and the test case source code corresponding to the SDK source code are generated through the template engine based on the configured API information and the template file; and then compiling and testing the SDK source code and the test case source code, and uploading the SDK source code passing the test to a code warehouse. Therefore, the template engine, the configured API information and the template file can be used for obtaining the SDK source code and simultaneously obtaining the test case for testing the SDK, the test case does not need to be compiled manually, and a large amount of manpower can be saved; meanwhile, SDK source codes passing automated testing can be obtained.
Optionally, in this embodiment, when generating the SDK source code and the test case source code, an API information code in a target language corresponding to the template file may be generated by the template engine based on configured API information; and generating the SDK source code and the test case source code in the target language based on the API information code and the template file through the template engine. Therefore, the API information code corresponding to the API information and using the target language used by the template file can be generated by the template engine based on the API information, and the SDK source code and the test case source code corresponding to the target language can be further generated.
For example, if the template file is a template file specified by Java language, the API information code in Java language may be generated by the template engine based on the API information, and then the SDK source code and the test case source code corresponding to Java language may be generated.
Optionally, in the process of generating the source code, the template engine may be used to generate the source code directly based on the API information code and the template file. The source code corresponding to the unadjusted part may also be obtained from the stored historical version of the SDK, the source code corresponding to the adjusted part may be generated only by using the API information code and the template file, and the source code corresponding to the unadjusted part and the source code corresponding to the adjusted part may be used as the source code generated this time. This can reduce the workload.
Optionally, in this embodiment, the template file may further include a preset field processing rule. The preset field processing rule may include a field alias conversion rule, and the like. In the process of generating the SDK source code and the test case source code, if a field corresponding to the preset field processing rule is detected, processing may be performed according to the preset processing rule corresponding to the field to obtain the SDK source code and the test case source code. For example, if a field is a key of Java and cannot be used as a member variable of the source code, an alias may be used for the field, and the specific alias may be determined by a preset processing rule corresponding to the field. Therefore, the problem of subsequent source codes caused by some problems of the field can be avoided.
Optionally, when the field alias conversion rule is used, when the SDK source code and the test case source code are obtained, the special field and the alias corresponding to the used field alias conversion rule may be sent to the service providing device to notify the service provider. If a field which cannot be processed is encountered in the process of generating the SDK source code and the test case source code, processing mode prompt information can be sent to the service providing equipment according to the field so that a service provider at the service providing equipment can determine the processing mode of the field, and then the SDK source code and the test case source code are continuously generated.
Optionally, in this embodiment, the configured template files include template files corresponding to different target languages, for example, a template file corresponding to a Java language, a template file corresponding to a Python language, a template file corresponding to a C + + language, and the like. When the SDK source codes and the test case codes are generated, the SDK source codes and the test case source codes corresponding to the target language can be generated through the template engine according to the configured API information and the template file corresponding to the target language aiming at different target languages. Therefore, the SDK and the test cases in multiple languages can be obtained simultaneously, and a large amount of manpower is not needed for maintaining the test cases in different languages.
When generating an SDK in multiple languages, a template engine may be first utilized to generate API information codes corresponding to the languages in the multiple languages based on the API information; and then, generating SDK source codes and test case source codes corresponding to all the languages by using a template engine based on the API information codes corresponding to all the languages and the template files corresponding to all the languages.
Referring to fig. 3, fig. 3 is a second schematic flow chart of the SDK generation method according to the embodiment of the present application. The method may further include step S140 and step S150.
Step S140, after the SDK source code is released, the SDK source code is tested by using the test case corresponding to the SDK source code.
And step S150, if a test case which does not pass the test exists, sending prompt information to the service providing equipment and/or the service using equipment corresponding to the SDK source code.
In this embodiment, after the SDK source code is released, the released SDK source code is continuously monitored, so as to find a problem in time and improve user experience of a user. Optionally, the test case corresponding to the released SDK source code may be used to test the SDK compiled from the SDK source code. If the test fails, that is, there is a test case with failed test, the prompt message may be sent to the service providing device and/or the service using device corresponding to the SDK source code.
For example, prompt information of failing to pass the test is sent to the service providing device corresponding to the SDK source code, where the prompt information may include content such as an API corresponding to the test case that fails the test, so that the service provider at the service providing device can handle the problem in time. It is also possible to send a problem notification prompt message to the service using device corresponding to the SDK source code, so that a service user at the service using device can know the message in time.
Optionally, as an optional implementation manner, the SDK generating device 100 may use all test cases corresponding to one SDK source code at an interval of a preset duration to test the SDK corresponding to the SDK source code. The preset time period may be set according to actual requirements, for example, set to 5 groups. The preset time length can be set by the service provider on a visual page provided by the service providing equipment. It should be understood that the above-mentioned manners are merely examples, and the source code of the SDK that is issued may also be monitored in other manners, for example, testing the SDK by using a part of the test case.
In order to execute the corresponding steps in the foregoing embodiments and various possible manners, an implementation manner of the SDK generating device 200 is given below, and optionally, the SDK generating device 200 may adopt the device structure of the SDK generating apparatus 100 shown in fig. 1. Further, referring to fig. 4, fig. 4 is a block diagram of an SDK generating device 200 according to an embodiment of the present disclosure. It should be noted that the basic principle and the technical effect of the SDK generating device 200 provided in the present embodiment are the same as those of the above embodiments, and for the sake of brief description, no part of the present embodiment is mentioned, and corresponding contents in the above embodiments may be referred to. The SDK generating apparatus 200 is applicable to the SDK generating device 100, and the SDK generating apparatus 200 may include: a source code generating module 210, a testing module 220 and a sending module 230.
The source code generating module 210 is configured to generate, by the template engine, the SDK source code and the test case source code corresponding to the SDK source code according to the configured API information and the template file. The API information comprises input parameter description information and output parameter description information of the API, and the template file comprises test case generation rules.
The test module 220 is configured to compile the SDK source code and the test case source code, and test the SDK obtained after compilation by using the test case obtained after compilation.
The sending module 230 is configured to upload the SDK source code to a code repository after the compiled SDK passes the test.
Optionally, in this embodiment, the source code generating module 210 is specifically configured to: generating an API information code under a target language corresponding to the template file through the template engine based on the configured API information; and generating the SDK source code and the test case source code in the target language based on the API information code and the template file through the template engine.
Optionally, in this embodiment, the template file further includes a preset field processing rule, the preset field processing rule includes a field alias conversion rule, and the source code generating module 210 is specifically configured to: and in the process of generating the SDK source code and the test case source code, if a field corresponding to the preset field processing rule is detected, processing according to the preset processing rule corresponding to the field to obtain the SDK source code and the test case source code.
Optionally, in this embodiment, the configured template files include template files corresponding to different target languages, and the source code generating module 210 is specifically configured to:
and aiming at different target languages, generating the SDK source code and the test case source code corresponding to the target language by the template engine according to the configured API information and the template file corresponding to the target language.
Referring to fig. 5, fig. 5 is a second block diagram of an SDK generating device 200 according to an embodiment of the present disclosure. Optionally, in this embodiment, the SDK generating apparatus 200 may further include a monitoring module 240. The monitoring module 240 is configured to: after the SDK source code is released, testing the SDK source code by using a test case corresponding to the SDK source code; and if the test case which does not pass the test exists, sending prompt information to the service providing equipment and/or the service using equipment corresponding to the SDK source code.
Alternatively, the modules may be stored in the memory 110 shown in fig. 1 in the form of software or Firmware (Firmware) or be fixed in an Operating System (OS) of the SDK generating apparatus 100, and may be executed by the processor 120 in fig. 1. Meanwhile, data, codes of programs, and the like required to execute the above-described modules may be stored in the memory 110.
An embodiment of the present application further provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the SDK generation method is implemented.
To sum up, the embodiments of the present application provide an SDK generation method, apparatus, device, and readable storage medium, which generate, by a template engine, an SDK source code and a test case source code corresponding to the SDK source code according to configured API information and a template file, where the API information includes input parameter description information and output parameter description information of an API, and the template file includes a test case generation rule; and then, by compiling, testing the SDK obtained by compiling by using the test case obtained by compiling, and uploading the SDK source code to a code warehouse if the test passes. Therefore, the template engine, the configured API information and the template file can be used for obtaining the SDK and simultaneously obtaining the test case for testing the SDK, manual writing is not needed, and a large amount of manpower can be saved; meanwhile, SDK source codes passing automated testing can be obtained.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. An SDK generation method applied to an SDK generation device includes:
generating an SDK source code and a test case source code corresponding to the SDK source code by a template engine according to configured API information and a template file, wherein the API information comprises input parameter description information and output parameter description information of an API, and the template file comprises a test case generation rule;
compiling the SDK source code and the test case source code, and testing the SDK obtained after compiling by using the test case obtained after compiling;
and uploading the SDK source code to a code warehouse after the SDK test obtained after compiling passes.
2. The method of claim 1, wherein the generating, by the template engine, the SDK source code and the test case source code corresponding to the SDK source code according to the configured API information and the template file comprises:
generating an API information code under a target language corresponding to the template file through the template engine based on the configured API information;
and generating the SDK source code and the test case source code in the target language based on the API information code and the template file through the template engine.
3. The method of claim 2, wherein the template file further includes preset field processing rules, the preset field processing rules include field alias conversion rules, and the generating, by the template engine, the SDK source code and the test case source code in the target language based on the API information code and the template file includes:
and in the process of generating the SDK source code and the test case source code, if a field corresponding to the preset field processing rule is detected, processing according to the preset processing rule corresponding to the field to obtain the SDK source code and the test case source code.
4. The method according to any one of claims 1 to 3, wherein the configured template files include template files corresponding to different target languages, and the generating, by the template engine, the SDK source code and the test case source code corresponding to the SDK source code according to the configured API information and the template files includes:
and aiming at different target languages, generating the SDK source code and the test case source code corresponding to the target language by the template engine according to the configured API information and the template file corresponding to the target language.
5. The method of claim 1, further comprising:
after the SDK source code is released, testing the SDK source code by using a test case corresponding to the SDK source code;
and if the test case which does not pass the test exists, sending prompt information to the service providing equipment and/or the service using equipment corresponding to the SDK source code.
6. An SDK generation apparatus, applied to an SDK generation device, includes:
the source code generation module is used for generating an SDK source code and a test case source code corresponding to the SDK source code according to configured API information and a template file through a template engine, wherein the API information comprises input parameter description information and output parameter description information of an API, and the template file comprises a test case generation rule;
the test module is used for compiling the SDK source code and the test case source code and testing the SDK obtained after compiling by using the test case obtained after compiling;
and the sending module is used for uploading the SDK source code to a code warehouse after the SDK test obtained after compiling passes.
7. The apparatus according to claim 6, wherein the configured template files include template files corresponding to different target languages, and the source code generating module is specifically configured to:
and aiming at different target languages, generating the SDK source code and the test case source code corresponding to the target language by the template engine according to the configured API information and the template file corresponding to the target language.
8. The apparatus of claim 6, further comprising a monitoring module to:
after the SDK source code is released, testing the SDK source code by using a test case corresponding to the SDK source code;
and if the test case which does not pass the test exists, sending prompt information to the service providing equipment and/or the service using equipment corresponding to the SDK source code.
9. An SDK generation device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor to implement the SDK generation method of any one of claims 1 to 5.
10. A readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the SDK generation method according to any one of claims 1 to 5.
CN202110051565.2A 2021-01-15 2021-01-15 SDK generation method, device, equipment and readable storage medium Pending CN112380145A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110051565.2A CN112380145A (en) 2021-01-15 2021-01-15 SDK generation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110051565.2A CN112380145A (en) 2021-01-15 2021-01-15 SDK generation method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN112380145A true CN112380145A (en) 2021-02-19

Family

ID=74581843

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110051565.2A Pending CN112380145A (en) 2021-01-15 2021-01-15 SDK generation method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112380145A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515263A (en) * 2021-04-26 2021-10-19 中国汽车技术研究中心有限公司 Industrial APP mechanism model deployment method, device, equipment and readable storage medium
CN114089967A (en) * 2022-01-19 2022-02-25 武汉源启科技股份有限公司 API interface generation method and device
CN114115982A (en) * 2021-12-02 2022-03-01 建信金融科技有限责任公司 Code issuing method, device, equipment and storage medium
CN116010285A (en) * 2023-02-27 2023-04-25 北京安盟信息技术股份有限公司 SDK automatic test method, system, medium and equipment for cloud password service product
CN116382703A (en) * 2023-06-07 2023-07-04 建信金融科技有限责任公司 Software package generation method, code development method and device, electronic equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718251A (en) * 2014-12-03 2016-06-29 苏宁云商集团股份有限公司 Multilanguage SDK (software development kit) automatic implementation method and system
US20170039121A1 (en) * 2015-08-06 2017-02-09 International Business Machines Corporation Test self-verification with integrated transparent self-diagnose
CN108897687A (en) * 2018-06-29 2018-11-27 泰华智慧产业集团股份有限公司 A kind of API automated testing method and system based on data-driven
CN111930635A (en) * 2020-09-17 2020-11-13 深圳微品致远信息科技有限公司 Swagger-based rapid automatic testing method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718251A (en) * 2014-12-03 2016-06-29 苏宁云商集团股份有限公司 Multilanguage SDK (software development kit) automatic implementation method and system
US20170039121A1 (en) * 2015-08-06 2017-02-09 International Business Machines Corporation Test self-verification with integrated transparent self-diagnose
CN108897687A (en) * 2018-06-29 2018-11-27 泰华智慧产业集团股份有限公司 A kind of API automated testing method and system based on data-driven
CN111930635A (en) * 2020-09-17 2020-11-13 深圳微品致远信息科技有限公司 Swagger-based rapid automatic testing method and system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515263A (en) * 2021-04-26 2021-10-19 中国汽车技术研究中心有限公司 Industrial APP mechanism model deployment method, device, equipment and readable storage medium
CN114115982A (en) * 2021-12-02 2022-03-01 建信金融科技有限责任公司 Code issuing method, device, equipment and storage medium
CN114089967A (en) * 2022-01-19 2022-02-25 武汉源启科技股份有限公司 API interface generation method and device
CN116010285A (en) * 2023-02-27 2023-04-25 北京安盟信息技术股份有限公司 SDK automatic test method, system, medium and equipment for cloud password service product
CN116382703A (en) * 2023-06-07 2023-07-04 建信金融科技有限责任公司 Software package generation method, code development method and device, electronic equipment and medium
CN116382703B (en) * 2023-06-07 2023-08-22 建信金融科技有限责任公司 Software package generation method, code development method and device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN112380145A (en) SDK generation method, device, equipment and readable storage medium
CN110018955B (en) Generating automated test scripts by transforming manual test cases
US10698797B2 (en) Mobile application program testing method, server, terminal, and storage medium
US11030085B2 (en) User defined mocking service behavior
US11138645B2 (en) Virtualized services discovery and recommendation engine
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN111858376A (en) Request message generation method and interface test method
CN111767208A (en) Automatic test method and device
CN113114680A (en) Detection method and detection device for file uploading vulnerability
CN116069341A (en) Automatic deployment method, equipment and storage medium for application program
CN108959508B (en) SQL data generation method and device
CN112306568A (en) Service instance configuration method and device, electronic equipment and storage medium
CN111078529B (en) Client writing module testing method and device and electronic equipment
CN112882948A (en) Stability testing method, device and system for application and storage medium
CN115774707B (en) Object attribute-based data processing method and device, electronic equipment and storage medium
WO2023151397A1 (en) Application program deployment method and apparatus, device, and medium
CN112084114B (en) Method and apparatus for testing interfaces
CN115185841A (en) System reconfiguration test method, device, equipment and storage medium
CN114691527A (en) Unit test case generation method, apparatus, device, medium, and program product
CN114296793A (en) Anti-obfuscation method and device for obfuscated codes, readable medium and electronic device
CN113986768A (en) Application stability testing method, device, equipment and medium
CN114218313A (en) Data management method, device, electronic equipment, storage medium and product
CN111726373B (en) Communication link construction method, device and equipment
CN113626409B (en) Test data processing method, device, equipment and storage medium
CN112487014A (en) SQL data processing method and device and background server

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210219

RJ01 Rejection of invention patent application after publication