Cloud object interface test method and device, equipment, storage medium and program product
By generating and using cloud object tables, interface version tables and interface tables, the software development toolkits are automatically generated, which solves the problem of difficult to maintain multi-version coexistence interface tests, and achieves efficient interface automation testing and cost-reducing effects.
Patent Information
- Application Number
- CN202411535446.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art is difficult to maintain in multi-version interface testing, resulting in increased development and maintenance costs.
By obtaining the information and interface information of cloud objects, a cloud object table, interface version table and interface table are generated, and a software development toolkit that sets the programming language is automatically generated to realize automated interface testing.
Effectively manage different versions of interfaces, reducing the workload of manually writing and updating software development kits, improving testing efficiency, and reducing development and maintenance costs.
Smart Images

Figure CN119415396A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software testing technology, and in particular to a cloud object interface testing method, device, equipment, storage medium and program product. Background Art
[0002] As the scale of software systems increases, their complexity also increases. Therefore, interface automation testing has become an important topic in the field of software testing. Interface automation testing refers to the use of relevant technical means to verify the correctness of the interaction between software components, systems or applications through interfaces. In a multi-version software system, the interface may change, so it is necessary to perform automated testing on the multi-version interface.
[0003] In the prior art, multi-version interface testing is generally implemented through version management based on the Application Programming Interface (API), which can introduce new API functions or modify existing functions in a backward-compatible manner without affecting existing users. The core idea is to create independent test cases for different versions of interfaces and manually update the corresponding test cases when the interface changes.
[0004] However, as the API versions increase and the corresponding interfaces change, the test cases that need to be maintained and updated will also increase, resulting in increased development and maintenance costs. Summary of the invention
[0005] The present application provides a cloud object interface testing method, apparatus, device, storage medium and program product to solve the technical problem of the prior art that it is difficult to maintain interfaces with multiple versions coexisting.
[0006] In a first aspect, the present application provides a cloud object interface testing method, comprising:
[0007] Obtain cloud object information and interface information of the cloud object to be tested, where the interface information includes interface version information and interface parameter information;
[0008] Generate a cloud object table, an interface version table, and an interface table corresponding to the cloud object to be tested based on the cloud object information and the interface information. The cloud object table is used to record the cloud object information, the interface version table is used to record the interface version information, and the interface table is used to record the interface parameter information.
[0009] Generate a software development kit in a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table, the software development kit is used to provide automated testing of the interface;
[0010] Based on the functional documentation of the cloud object to be tested, the software development kit is called to perform automated testing and obtain test results.
[0011] Optionally, the cloud object information includes version information of the cloud object to be tested. According to the cloud object information and the interface information, a cloud object table, an interface version table, and an interface table corresponding to the cloud object to be tested are generated, including:
[0012] Determine whether there is an interface update for the cloud object to be tested;
[0013] In the case that the cloud object to be tested has an interface update, determining whether the version information of the cloud object to be tested exists in the cloud object table according to the version information of the cloud object to be tested;
[0014] If the version information of the cloud object to be tested exists in the cloud object table, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested;
[0015] If version information of the cloud object to be tested does not exist in the cloud object table, the cloud object information of the cloud object to be tested is added to the cloud object table corresponding to the cloud object to be tested, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested.
[0016] Optionally, it also includes:
[0017] When there is no interface update for the cloud object to be tested, the cloud object information is added to the preset cloud object table, the interface version information is added to the preset interface version table, and the interface parameter information is added to the preset interface table.
[0018] Optionally, determining whether the cloud object to be tested has an interface update includes:
[0019] If the field name in the interface table corresponding to the cloud object to be tested is a placeholder and there is no interface parameter information, it is determined that there is an interface update for the cloud object to be tested;
[0020] If the field name in the interface table corresponding to the cloud object to be tested is not a placeholder and interface parameter information exists, it is determined that there is no interface update for the cloud object to be tested.
[0021] Optionally, generating a software development kit of a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table includes:
[0022] According to the cloud object table, interface version table, and interface table, obtain the name of the cloud product to be tested, the interface name, interface address, interface version, input parameters, and output parameters corresponding to the cloud object to be tested;
[0023] Determine the basic structure of the software development kit of the set programming language according to the name of the cloud product to be tested, the interface name and interface address corresponding to the cloud object to be tested;
[0024] Based on the basic structure of the software development kit of the set programming language, the incoming parameters are encapsulated, and the execution results are obtained according to the outgoing parameters, so as to generate the software development kit of the set programming language corresponding to the interface of the cloud object to be tested.
[0025] Optionally, based on the functional documentation of the cloud object to be tested, a software development kit is called to perform automated testing to obtain test results, including:
[0026] Write scenario use cases based on the functional documentation of the cloud object to be tested;
[0027] According to the scenario use case, call the interface of the software development kit for automated testing and receive the corresponding return value, which is used to determine whether the interface call of the software development kit is successful;
[0028] Get the test result based on the return value.
[0029] In a second aspect, the present application provides a cloud object interface testing device, comprising:
[0030] An acquisition module is used to acquire cloud object information and interface information of the cloud object to be tested, where the interface information includes interface version information and interface parameter information;
[0031] The first processing module is used to generate a cloud object table, an interface version table and an interface table corresponding to the cloud object to be tested according to the cloud object information and the interface information, wherein the cloud object table is used to record the cloud object information, the interface version table is used to record the interface version information, and the interface table is used to record the interface parameter information;
[0032] The second processing module is used to generate a software development kit in a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table, wherein the software development kit is used to provide automated testing of the interface;
[0033] The calling module is used to call the software development kit to perform automated testing based on the functional documentation of the cloud object to be tested and obtain the test results.
[0034] Optionally, the cloud object information includes version information of the cloud object to be tested. The first processing module is specifically configured to:
[0035] Determine whether there is an interface update for the cloud object to be tested;
[0036] In the case that the cloud object to be tested has an interface update, determining whether the version information of the cloud object to be tested exists in the cloud object table according to the version information of the cloud object to be tested;
[0037] If the version information of the cloud object to be tested exists in the cloud object table, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested;
[0038] If version information of the cloud object to be tested does not exist in the cloud object table, the cloud object information of the cloud object to be tested is added to the cloud object table corresponding to the cloud object to be tested, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested.
[0039] Optionally, the first processing module is further used for:
[0040] When there is no interface update for the cloud object to be tested, the cloud object information is added to the preset cloud object table, the interface version information is added to the preset interface version table, and the interface parameter information is added to the preset interface table.
[0041] Optionally, to determine whether there is an interface update for the cloud object to be tested, the first processing module is specifically configured to:
[0042] If the field name in the interface table corresponding to the cloud object to be tested is a placeholder and there is no interface parameter information, it is determined that there is an interface update for the cloud object to be tested;
[0043] If the field name in the interface table corresponding to the cloud object to be tested is not a placeholder and interface parameter information exists, it is determined that there is no interface update for the cloud object to be tested.
[0044] Optionally, the second processing module is specifically configured to:
[0045] According to the cloud object table, interface version table, and interface table, obtain the name of the cloud product to be tested, the interface name, interface address, interface version, input parameters, and output parameters corresponding to the cloud object to be tested;
[0046] Determine the basic structure of the software development kit of the set programming language according to the name of the cloud product to be tested, the interface name and interface address corresponding to the cloud object to be tested;
[0047] Based on the basic structure of the software development kit of the set programming language, the incoming parameters are encapsulated, and the execution results are obtained according to the outgoing parameters, so as to generate the software development kit of the set programming language corresponding to the interface of the cloud object to be tested.
[0048] Optionally, call a module specifically for:
[0049] Write scenario use cases based on the functional documentation of the cloud object to be tested;
[0050] According to the scenario use case, call the interface of the software development kit for automated testing and receive the corresponding return value, which is used to determine whether the interface call of the software development kit is successful;
[0051] Get the test result based on the return value.
[0052] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0053] Memory stores computer-executable instructions;
[0054] The processor executes the computer-executable instructions stored in the memory to implement the method as described in the first aspect and various possible implementations of the first aspect.
[0055] In a fourth aspect, the present application provides a computer-readable storage medium, comprising computer-executable instructions. When a processor executes the computer-executable instructions, it executes methods such as the first aspect, the second aspect, and various possible implementation methods of the first aspect and the second aspect mentioned above.
[0056] The cloud object interface testing method, apparatus, device, storage medium and program product provided by the present application provide systematic document support for the subsequent testing process by correspondingly generating a cloud object table, an interface version table and an interface table of the cloud object to be tested according to the cloud object information and the interface information, and are easy to manage and query, and can ensure the consistency of all information, so that different versions of interfaces can be effectively managed; then, by automatically generating a software development kit of a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table, the workload of manually writing and updating the software development kit is reduced, and it is ensured that each interface version has corresponding software development kit support, so that even if the interface version is updated, the newly added or modified version can be quickly adapted by updating the table information and regenerating the software development kit; in addition, automated testing is performed according to the software development kit, which reduces the need for manual testing, thereby improving testing efficiency and reducing development costs and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0058] Figure 1 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 1 ;
[0059] Figure 2 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 2 ;
[0060] Figure 3 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 3 ;
[0061] Figure 4 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 4 ;
[0062] Figure 5 A schematic diagram of the architecture of a cloud object interface testing system provided in an embodiment of the present application;
[0063] Figure 6 A schematic diagram of the structure of a cloud object interface testing device provided in an embodiment of the present application;
[0064] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0065] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0066] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0067] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0068] In the prior art, for the multi-version interfaces of cloud objects, the test scripts may need to be frequently modified to adapt to the changes in the interfaces, which increases the workload of test script maintenance and updating. At present, there are some methods and technologies for realizing automated testing of multi-version interfaces, such as API-based version management, which means creating independent test cases for different versions of interfaces and manually updating the corresponding test cases when the interfaces change. The specific process is: first identify the multiple versions of interfaces existing in the cloud object and assign a unique version number to each version, then design corresponding test cases for each version of the interface, and organize the test cases for the same version of the interface together to form a test suite, and then use the automated testing tool to execute the test suite to verify the correctness of the interface. After the test is completed, analyze the test results to confirm whether the interface meets the expected functional requirements, and generate a test report to record the test process, test results and problems found in detail.
[0069] However, in the prior art, interface testing for different versions relies on testers to update test cases. During the testing process, when the interface changes, the corresponding test cases need to be manually updated, resulting in high development and maintenance costs, difficulty in coping with frequent interface changes, and poor versatility.
[0070] In the process of solving the above technical problems, the inventor's technical conception is as follows: Since a cloud object may have multiple interface versions, each version of the interface has independent interface information, it is time-consuming to write test cases one by one. Therefore, if each interface version and the corresponding interface information can be stored and maintained in a structured and systematic manner, it will be possible to quickly retrieve and update, and more clearly manage and track different versions of interfaces and their changes. At the same time, when the interface version is updated, the interface parameters will change, making it difficult to update the test cases. If, on the basis of structured information, the complex interface calls corresponding to this information are encapsulated into simple functions and methods, that is, a software development kit, automated testing can be performed to simplify the operations of testers.
[0071] First, the terms involved in the embodiments of the present application are explained:
[0072] Cloud objects: can refer to specific services or applications provided by various cloud products (including cloud platforms), including software, platforms, infrastructure, etc., covering various functions from data storage, database management, machine learning to development tools.
[0073] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0074] Figure 1 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 1 .like Figure 1 As shown, the method may include the following steps:
[0075] S101. Obtain cloud object information and interface information of a cloud object to be tested.
[0076] The interface information includes interface version information and interface parameter information. The interface version information identifies different versions of the interface, including the interface version unique identifier (ID), the associated cloud object ID, the interface version name, the interface version description, etc. The interface parameter information includes basic information of the interface such as the interface name and interface description, as well as parameter information such as the output and input parameters required by the interface. Cloud object information includes various basic information of cloud products, such as cloud object ID, cloud object name, cloud object description, creation time, update time, etc.
[0077] In this embodiment, the latest API documentation, including descriptions of cloud objects, available interfaces, version information, and parameter information, can be obtained by visiting the official website or developer portal of the cloud service provider.
[0078] In some embodiments, the service discovery mechanism provided by the cloud platform may also be used to dynamically query currently available cloud objects and their interface information using a service discovery API or tool.
[0079] It should be noted that a single product can correspond to multiple versions of interfaces, while a single interface corresponds to a single version and a single product. Therefore, when obtaining various types of information, it is necessary to pay attention to the correspondence between cloud objects and interfaces to ensure data consistency.
[0080] It can be understood that by collecting detailed cloud object information and interface information, a sufficient data foundation is prepared for subsequent automated testing. Since all relevant information is systematically collected and organized, the accuracy and comprehensiveness of the test are ensured.
[0081] S102: Generate a cloud object table, an interface version table, and an interface table corresponding to the cloud object to be tested according to the cloud object information and the interface information.
[0082] Among them, the cloud object table is used to record cloud object information, the interface version table is used to record interface version information, and the interface table is used to record interface parameter information.
[0083] In this embodiment, the database table structure is designed based on the cloud object information and interface information to generate the cloud object table, interface version table and interface table corresponding to the cloud object to be tested. For example, as shown in Table 1, it is a cloud product (cloud object) table; as shown in Table 2, it is an interface version table; as shown in Table 3, it is an interface table.
[0084] Optionally, since the interface information includes interface parameter information, a parameter table as shown in Table 4 and a member parameter table as shown in Table 5 may also be generated.
[0085] Table 1 Cloud products (products)
[0086]
[0087] Table 2 Interface version table (versions)
[0088]
[0089] Table 3 Interface table (interfaces)
[0090]
[0091] Table 4 Parameters
[0092]
[0093] Table 5 Member parameter table (member_parameters)
[0094]
[0095] It can be understood that the structured information storage method of the above data table makes the management of cloud object information and interface information clearer and more efficient, provides an organized data foundation for the subsequent generation of automated testing toolkits, and facilitates version control and information tracking.
[0096] S103: Generate a software development kit of a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table.
[0097] Among them, the Software Development Kit (SDK) is used to provide automated testing of the interface. The SDK is written in a specific programming language and can directly interact with the interface of the cloud object. The programming language depends on the target platform and development requirements and can be Java, C / C++, Python, etc. This embodiment does not limit this.
[0098] In this embodiment, the SDK generation tool can be implemented by maintaining a multi-version cloud interface management database. By querying the cloud object table, interface version table, and interface table, and passing in different version numbers, product names, and other information, the SDK generation for the specified version of the interface is completed.
[0099] It should be noted that after the interface version table is output, it will no longer be adjusted. The corresponding version will be output to the cloud interface management database using a script. Each time the version is updated, the cloud interface management database will add new version interface information.
[0100] As an example, taking version iteration as an example, when performing iterative upgrades, a new version of SDK is output, and the automated interface test content is quickly adapted to perform automated testing on the current version to find problems. At the same time, if a version rollback occurs, only the old version SDK needs to be regenerated to quickly restore the SDK, thereby reducing the testing workload. In addition, interface management through the cloud interface management database can handle the coexistence of multiple versions of products on the cloud platform. For different product version environments, SDKs of different product versions are generated in a targeted manner, which is more applicable.
[0101] It can be understood that the automatically generated SDK reduces the need for manual writing of test code, can quickly adapt to changes in interfaces, can regenerate the SDK each time the interface information is updated, and can generate different versions of the SDK according to test needs, thereby improving the flexibility and responsiveness of the test.
[0102] S104: Based on the functional document of the cloud object to be tested, call the software development kit to perform automated testing and obtain test results.
[0103] The functional documentation of the cloud object to be tested refers to a document that describes in detail the functions, interfaces, usage methods and related technical details of the cloud object to be tested. The document contains all interfaces provided by the cloud object, as well as the version history and change records of the interfaces. Based on the functional documentation of the cloud object to be tested, scenario testing can be performed to obtain test results.
[0104] By specifying a version of SDK and calling the SDK for testing, you can implement interface testing of the specified version of cloud products to ensure that the application is correctly integrated with the specific version of SDK and works properly.
[0105] It should be noted that the process of connecting to the SDK and testing the input and output parameters of the encapsulated interface is an atomic use case, which usually directly calls a function or interface in the SDK. It is a basic and independent test case that focuses on verifying the correctness of a single function or interface. The cloud object interface test is a scenario use case, which is composed of multiple atomic use cases and is used to simulate more complex business processes or usage scenarios. It does not call the SDK directly, but indirectly calls the SDK by calling multiple atomic use cases to implement complex business test logic and ensure that the interfaces of cloud objects can interact with data normally.
[0106] In this embodiment, an automated testing framework based on QTAF (python Quick Test Automation framework) can be used to write and execute automated testing scripts. The automated testing process includes interface input preprocessing, scenario test cases (i.e., unit test cases in the QTAF framework), and test report output.
[0107] Specifically, interface input parameter preprocessing refers to pre-storing the interface input parameters in JSON format, including fixed parameters and variable parameters. Fixed parameters are mainly system parameters, such as product specifications, image versions and other fixed parameters. By calling the relevant query interface, the parameters are fixed locally for testing; variable parameters are usually user-specified or customized parameters, such as resource names, customized instructions, notes, etc. Such parameters are saved as placeholders in the JSON file, and in the scenario use case, the placeholders are replaced with the actual values used.
[0108] Scenario use cases include identity authentication, scene preset resource acquisition, and scenario testing. Among them, identity authentication means that before conducting scenario testing, first ensure that you have the permission to access the SDK interface, which can be done by providing valid identity credentials, such as API keys or access tokens. Depending on the cloud platform version used, the specific identity authentication method may vary. Scenario preset resource acquisition means that before writing test cases, you usually need to obtain some preset resources, such as creating a test environment, preparing test data, etc., which can be achieved by calling the SDK interface. By writing one or more test fixture functions, you can complete the acquisition and cleanup of preset resources. Scenario testing can use the interface provided by the SDK for functional testing, by calling the appropriate SDK method, passing the necessary parameters, and using assertion conditions to determine whether the interface call is successful. Among them, the assertion condition refers to a conditional expression used in the test case to verify whether the program behavior or output is as expected, which can be used to check whether the output of the interface is consistent with the expected result.
[0109] The test report output can be displayed in the form of a report by calling the QTAF framework. The test report output is the process of collating and displaying the test results of the scenario use case. It can intuitively display the test coverage, test steps, error details and other statistical information about the test.
[0110] It is understandable that the above automated testing reduces manual intervention and improves the efficiency and accuracy of testing. By using the QTAF automated testing framework to directly call the SDK, generate atomic use cases, and then generate scenario use cases, it ensures that the test can be executed quickly, further improves the efficiency of scenario use case writing, and realizes the output of test reports.
[0111] The cloud object interface testing method provided in the embodiment of the present application can reduce human errors by managing and maintaining the cloud object information and interface information of the cloud object to be tested in a data table structure. At the same time, the interface version can be dynamically adjusted, solving the problem of rapid platform version updates and difficult maintenance of interfaces with multiple versions coexisting. By automatically generating and updating SDKs, the testing efficiency is improved and the development and maintenance costs of cloud objects are reduced.
[0112] Based on the above embodiments, Figure 2 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, S102 is described in detail. The cloud object information includes the version information of the cloud object to be tested, and specifically includes the following steps:
[0113] S201: Determine whether there is any interface update for the cloud object to be tested.
[0114] The determination of whether the cloud object to be tested has an interface update may be determined by checking whether the field name is a placeholder or by checking interface parameter information.
[0115] In one achievable manner, S201 may be specifically implemented through the following steps:
[0116] If the field name in the interface table corresponding to the cloud object to be tested is a placeholder and there is no interface parameter information, it is determined that there is an interface update for the cloud object to be tested; if the field name in the interface table corresponding to the cloud object to be tested is not a placeholder and there is interface parameter information, it is determined that there is no interface update for the cloud object to be tested.
[0117] During the development and testing phase, when the interface of the cloud object to be tested is updated, the field name may be added as a placeholder (usually a general marker symbol, indicating an undefined field) to fill in detailed information later, indicating that the interface structure has changed. If the field name in the interface table corresponding to the cloud object to be tested is not a placeholder, that is, the field name is a specific and clear name, it indicates that the interface structure has not changed.
[0118] If no interface parameter information is recorded in the interface table, this may mean that the interface definition is incomplete or has changed. If detailed interface parameter information exists in the interface table, it indicates that the interface definition is complete and has not changed.
[0119] It is understandable that by checking the structure and content of the interface table to determine whether the interface has changed, it is possible to automatically determine whether the interface of the cloud object has been updated, reduce the workload of manual inspection, and help testers identify changes in the interface in a timely manner so as to take corresponding measures.
[0120] S202: When there is an interface update of the cloud object to be tested, determine whether there is version information of the cloud object to be tested in the cloud object table according to the version information of the cloud object to be tested.
[0121] In this embodiment, if there is an interface update, it is further checked whether the cloud object table has recorded the version information of the cloud object.
[0122] It is understandable that by checking the version information, it can be determined whether a new version record needs to be added to the database, which helps maintain the version history of the cloud object and ensures the accuracy of version management.
[0123] Correspondingly, S203, when there is no interface update for the cloud object to be tested, the cloud object information is added to the preset cloud object table, the interface version information is added to the preset interface version table, and the interface parameter information is added to the preset interface table.
[0124] It is understandable that if there is no interface update, it is necessary to add all the cloud object information and interface information to the preset table to ensure that the current version of the cloud object is consistent with the recorded version.
[0125] S204. If version information of the cloud object to be tested exists in the cloud object table, add interface version information to the interface version table corresponding to the cloud object to be tested, and add interface parameter information to the interface table corresponding to the cloud object to be tested;
[0126] S205. When the version information of the cloud object to be tested does not exist in the cloud object table, the cloud object information of the cloud object to be tested is added to the cloud object table corresponding to the cloud object to be tested, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested.
[0127] It can be understood that when there is an interface update of the cloud object to be tested, the existence of the version information of the cloud object to be tested can not only add new interface version information and interface parameter information, but also ensure that when a new cloud object version is discovered, all relevant information of the cloud object is fully recorded, so that the system can maintain data consistency and integrity when introducing a new cloud object version.
[0128] The cloud object interface testing method provided in the embodiment of the present application adds relevant information to the corresponding table according to the update status of the interface version and the version update status of the cloud object. It can retain the previous version information while entering the new version of cloud object information and interface information, thereby ensuring the consistency of information and realizing cross-version interface management.
[0129] Based on the above embodiments, Figure 3 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 3 .like Figure 3 As shown, in this embodiment Figure 1 Based on the embodiment, S103 is described in detail, which specifically includes the following steps:
[0130] S301. According to the cloud object table, the interface version table and the interface table, obtain the name of the cloud product to be tested, the interface name, interface address, interface version, input parameters and output parameters corresponding to the cloud object to be tested.
[0131] It can be understood that by extracting this information from the table data, the interface details of the cloud object to be tested can be fully understood, providing necessary data support for generating SDK in the subsequent steps.
[0132] S302: Determine the basic structure of a software development kit of a set programming language according to the name of the cloud product to be tested, the interface name and the interface address corresponding to the cloud object to be tested;
[0133] The basic structure of the software development kit includes namespace, class name and method name, which are usually generated based on the name of the cloud product to be tested and the interface name corresponding to the cloud object to be tested, and the necessary directory structure of the SDK is created according to the interface address.
[0134] Specifically, the namespace is usually determined based on the name of the cloud product to avoid naming conflicts in the programming language; the class name and method name are usually determined based on the interface name to ensure that the interface function is clearly represented in the SDK; the directory structure is usually determined based on the interface address to organize code and resources.
[0135] S303: Based on the basic structure of the software development kit of the set programming language, encapsulate the incoming parameters, obtain the execution results according to the outgoing parameters, and generate the software development kit of the set programming language corresponding to the interface of the cloud object to be tested.
[0136] In this embodiment, the process of generating a software development kit can be: performing parameter processing based on the basic structure of the software development kit of the set programming language, generating a method parameter list for the incoming parameters, and processing types, such as mapping JSON to a suitable object, and then performing return value processing, generating corresponding return value processing code for the outgoing parameters, ensuring that the data format returned by the interface can be correctly parsed, and finally, adding error handling logic to handle abnormal situations that may occur when the interface is called.
[0137] As an example, take product A of a cloud platform as an example, the interface name is "Add Instance", the interface address is "CreateIenstance", the product name is "A", the interface version is "1", the input parameter is "CreateInstanceRequest", and the output parameter is "CreateInstanceResponse". The following SDK is generated based on this information:
[0138] # File path such as platform / lib / A.py
[0139] def CreateInstanceV1(CreateInstanceRequest):
[0140] # Create instance interface
[0141] req = CreateInstanceRequest
[0142] # Encapsulate incoming parameters
[0143] CreateInstanceResponse = requests.post(req)
[0144] # Get execution results
[0145] return CreateInstanceResponse
[0146] If you need to add a new interface with the same name, the interface version will be used as a distinction. For example, if you add a new interface with the same name with version number "2", the server will add the interface to the original file in an appended manner and generate a new SDK, such as:
[0147] # File path such as platform / lib / A.py
[0148] def CreateInstanceV1(CreateInstanceRequest):
[0149] pass
[0150] def CreateInstanceV2(CreateInstanceRequest):
[0151] # Create instance interface
[0152] req = CreateInstanceRequest
[0153] # Encapsulate incoming parameters
[0154] CreateInstanceResponse = requests.post(req)
[0155] # Get execution results
[0156] return CreateInstanceResponse
[0157] The same is true for other products. Use the product name as the SDK file name and save the generated SDK in the lib directory. When testing, you only need to import the SDK of the specified product to call the interface.
[0158] It can be understood that the generated SDK enables testers to easily call the interface of cloud objects in a specific programming language environment, and simplifies the complexity of interface calls and improves testing efficiency by encapsulating parameters and processing return results.
[0159] The cloud object interface testing method provided in the embodiment of the present application automatically generates an SDK by obtaining relevant information from the cloud object table, the interface version table, and the interface table, so that the SDK not only meets the standards of the set programming language, but also provides simplified access to the cloud service interface, which helps to speed up the development process, reduce manual coding errors, and improve the availability and accessibility of cloud services.
[0160] Based on the above embodiments, Figure 4 Schematic diagram of the process of the cloud object interface testing method provided in the embodiment of the present application Figure 4 .like Figure 4 As shown, in this embodiment Figure 1 Based on the embodiment, S104 is described in detail, which specifically includes the following steps:
[0161] S401. Write scenario use cases based on the functional documentation of the cloud object to be tested.
[0162] In this embodiment, functional requirements and interface behavior descriptions are extracted from the functional documents of the cloud objects to be tested, so as to compile corresponding test scenario use cases, which cover various possible usage scenarios, including normal operation, boundary conditions and exception handling.
[0163] S402: According to the scenario use case, call the interface of the software development kit to perform automated testing and receive the corresponding return value;
[0164] The return value refers to the data or status information returned by a function or interface after calling it, which may include success or failure status, error code, data results, etc., and can be used to determine whether the interface call of the software development kit is successful.
[0165] In this embodiment, the functions and steps required to be completed in the scenario can be determined according to the scenario use case, and then the SDK interface is selectively called to perform a certain operation step, and the return value is used to determine whether the call is successful. The test scenario can be marked by the test case tag provided by the QTAF framework. In this way, the QTAF framework can organize and display the test results according to the scenario when generating a report later.
[0166] S403. Get the test result according to the returned value.
[0167] Among them, the assertion condition can be used to automatically check whether the return value meets the expected conditions, helping to determine whether the result of the test case is success or failure.
[0168] In this embodiment, after executing the test case, the QTAF framework can generate test results based on the return value, and generate a report of the test results and save it in a specified directory. Usually, the report will be saved in a folder generated with the product name and timestamp in the current directory. Further, the execution status of the test, the passed use cases, the failed use cases, and the error information can be viewed through the report.
[0169] It can be understood that by using the QTAF framework to generate test reports and clearly display and analyze test results, testers can better understand the test coverage and error details, thereby improving the quality and stability of cloud objects.
[0170] The cloud object interface testing method provided in the embodiment of the present application writes scenario use cases according to the functional document of the cloud object to be tested, and then calls the interface of the software development kit to perform automated testing and output a test report, so that testers can implement specific functional tests by calling methods without having to deal with the details of network requests, thereby simplifying the testing process.
[0171] Figure 5 This is a schematic diagram of the architecture of the cloud object interface testing system provided in the embodiment of the present application. Figure 5 As shown, the system includes: a multi-version interface management module 501 and an automated testing module 502, wherein:
[0172] The multi-version interface management module 501 is used for cloud product management, interface version management, parameter management, and interface management, and then exports the interface and outputs the SDK.
[0173] The automated testing module 502 is used to perform interface input parameter pre-processing according to the output SDK, and generate scenario use cases according to the product function document of the cloud product, thereby performing automated testing and outputting a test report.
[0174] The cloud object interface testing system provided in the embodiment of the present application standardizes interface iteration through a multi-version interface management module, solves the problem of rapid platform version updates and difficult maintenance of multi-version coexisting interfaces, and implements the writing process of scenario automation test cases through an automated testing module, which can improve the efficiency of case writing and realize the output of test reports, making it easier for testers to understand the test situation.
[0175] Figure 6 This is a schematic diagram of the structure of the cloud object interface testing device provided in the embodiment of the present application. Figure 6 As shown, the cloud object interface testing device 60 provided in the embodiment of the present application includes:
[0176] An acquisition module 601 is used to acquire cloud object information and interface information of a cloud object to be tested, where the interface information includes interface version information and interface parameter information;
[0177] A first processing module 602 is used to generate a cloud object table, an interface version table and an interface table corresponding to the cloud object to be tested according to the cloud object information and the interface information, wherein the cloud object table is used to record the cloud object information, the interface version table is used to record the interface version information, and the interface table is used to record the interface parameter information;
[0178] The second processing module 603 is used to generate a software development kit in a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table, and the software development kit is used to provide automated testing of the interface;
[0179] The calling module 604 is used to call the software development kit to perform automated testing based on the functional document of the cloud object to be tested, and obtain the test results.
[0180] Optionally, the cloud object information includes version information of the cloud object to be tested. The first processing module 602 is specifically configured to:
[0181] Determine whether there is an interface update for the cloud object to be tested;
[0182] In the case that the cloud object to be tested has an interface update, determining whether the version information of the cloud object to be tested exists in the cloud object table according to the version information of the cloud object to be tested;
[0183] If the version information of the cloud object to be tested exists in the cloud object table, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested;
[0184] If version information of the cloud object to be tested does not exist in the cloud object table, the cloud object information of the cloud object to be tested is added to the cloud object table corresponding to the cloud object to be tested, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested.
[0185] Optionally, the first processing module 602 is further configured to:
[0186] When there is no interface update for the cloud object to be tested, the cloud object information is added to the preset cloud object table, the interface version information is added to the preset interface version table, and the interface parameter information is added to the preset interface table.
[0187] Optionally, to determine whether the cloud object to be tested has an interface update, the first processing module 602 is specifically configured to:
[0188] If the field name in the interface table corresponding to the cloud object to be tested is a placeholder and there is no interface parameter information, it is determined that there is an interface update for the cloud object to be tested;
[0189] If the field name in the interface table corresponding to the cloud object to be tested is not a placeholder and interface parameter information exists, it is determined that there is no interface update for the cloud object to be tested.
[0190] Optionally, the second processing module 603 is specifically configured to:
[0191] According to the cloud object table, interface version table, and interface table, obtain the name of the cloud product to be tested, the interface name, interface address, interface version, input parameters, and output parameters corresponding to the cloud object to be tested;
[0192] Determine the basic structure of the software development kit of the set programming language according to the name of the cloud product to be tested, the interface name and interface address corresponding to the cloud object to be tested;
[0193] Based on the basic structure of the software development kit of the set programming language, the incoming parameters are encapsulated, and the execution results are obtained according to the outgoing parameters, so as to generate the software development kit of the set programming language corresponding to the interface of the cloud object to be tested.
[0194] Optionally, calling module 604 is specifically used to:
[0195] Write scenario use cases based on the functional documentation of the cloud object to be tested;
[0196] According to the scenario use case, call the interface of the software development kit for automated testing and receive the corresponding return value, which is used to determine whether the interface call of the software development kit is successful;
[0197] Get the test result based on the return value.
[0198] The cloud object interface testing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.
[0199] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device 70 provided in this embodiment includes: at least one processor 701 and a memory 702. Optionally, the electronic device 70 further includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus 704.
[0200] In a specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that at least one processor 701 executes the above method.
[0201] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0202] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in the invention may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0203] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0204] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0205] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0206] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0207] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0208] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0209] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0210] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0211] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0212] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0213] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0214] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0215] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0216] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0217] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc.
[0218] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0219] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0220] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A cloud object interface testing method, characterized in that: include: Obtaining cloud object information and interface information of the cloud object to be tested, wherein the interface information includes interface version information and interface parameter information; Generate a cloud object table, an interface version table, and an interface table corresponding to the cloud object to be tested according to the cloud object information and the interface information, wherein the cloud object table is used to record the cloud object information, the interface version table is used to record the interface version information, and the interface table is used to record the interface parameter information; Generate a software development kit in a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table, wherein the software development kit is used to provide automated testing of the interface; Based on the functional document of the cloud object to be tested, the software development kit is called to perform automated testing to obtain test results.
2. The method according to claim 1, characterized in that The cloud object information includes version information of the cloud object to be tested, and generating a cloud object table, an interface version table, and an interface table corresponding to the cloud object to be tested according to the cloud object information and the interface information includes: Determine whether there is an interface update for the cloud object to be tested; In the case that the cloud object to be tested has an interface update, determining whether the version information of the cloud object to be tested exists in the cloud object table according to the version information of the cloud object to be tested; If the version information of the cloud object to be tested exists in the cloud object table, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested; When the version information of the cloud object to be tested does not exist in the cloud object table, the cloud object information of the cloud object to be tested is added to the cloud object table corresponding to the cloud object to be tested, the interface version information is added to the interface version table corresponding to the cloud object to be tested, and the interface parameter information is added to the interface table corresponding to the cloud object to be tested.
3. The method according to claim 2, characterized in that Also includes: When there is no interface update for the cloud object to be tested, the cloud object information is added to a preset cloud object table, the interface version information is added to a preset interface version table, and the interface parameter information is added to a preset interface table.
4. The method according to claim 2, characterized in that: The determining whether the cloud object to be tested has an interface update includes: If the field name in the interface table corresponding to the cloud object to be tested is a placeholder and there is no interface parameter information, it is determined that there is an interface update for the cloud object to be tested; If the field name in the interface table corresponding to the cloud object to be tested is not the placeholder and the interface parameter information exists, it is determined that there is no interface update for the cloud object to be tested.
5. The method according to any one of claims 1 to 4, characterized in that The step of generating a software development kit in a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table comprises: According to the cloud object table, the interface version table and the interface table, obtain the name of the cloud product to be tested, the interface name, interface address, interface version, input parameters and output parameters corresponding to the cloud object to be tested; Determine the basic structure of the software development kit of the set programming language according to the name of the cloud product to be tested, the interface name corresponding to the cloud object to be tested, and the interface address; Based on the basic structure of the software development kit of the set programming language, the input parameters are encapsulated, and the execution results are obtained according to the output parameters, so as to generate the software development kit of the set programming language corresponding to the interface of the cloud object to be tested.
6. The method according to any one of claims 1 to 4, characterized in that The step of calling the software development kit to perform automated testing based on the functional document of the cloud object to be tested and obtaining the test result includes: Write scenario use cases based on the functional documentation of the cloud object to be tested; According to the scenario use case, call the interface of the software development kit to perform automated testing, and receive a corresponding return value, wherein the return value is used to determine whether the interface call of the software development kit is successful; The test result is obtained according to the return value.
7. A cloud object interface testing device, characterized in that: include: An acquisition module, used to acquire cloud object information and interface information of the cloud object to be tested, wherein the interface information includes interface version information and interface parameter information; A first processing module is used to generate a cloud object table, an interface version table and an interface table corresponding to the cloud object to be tested according to the cloud object information and the interface information, wherein the cloud object table is used to record the cloud object information, the interface version table is used to record the interface version information, and the interface table is used to record the interface parameter information; A second processing module is used to generate a software development kit in a set programming language corresponding to the interface of the cloud object to be tested according to the cloud object table, the interface version table and the interface table, wherein the software development kit is used to provide automated testing of the interface; The calling module is used to call the software development kit to perform automated testing based on the functional document of the cloud object to be tested, and obtain the test result.
8. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, characterized in that The method comprises a computer program, which is used to implement the method according to any one of claims 1 to 6 when the computer program is executed by a processor.