Method, device, SDK testing method and equipment for passing parameters to SDK

By obtaining and passing SDK startup parameters via command line, the inefficiency caused by manually setting parameters in existing technologies is solved, and efficient automation of SDK testing is achieved.

CN116010243BActive Publication Date: 2025-12-09WELLINK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211543216.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-02
Publication Date
2025-12-09
Estimated Expiration
2042-12-02

AI Technical Summary

Technical Problem

In existing technologies, SDK startup parameters need to be set manually, resulting in low testing efficiency.

Method used

The startup parameters of the SDK can be obtained and passed through the command line, including obtaining parameters from the PaaS platform, and the startup function of the SDK can be called in the script to achieve automatic parameter passing.

Benefits of technology

This avoids the tedious compilation and packaging steps required every time startup parameters are changed, significantly improving the efficiency of SDK testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116010243B_ABST
    Figure CN116010243B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of SDK testing, and particularly relates to a method and device for passing parameters to an SDK, an SDK testing method and equipment, and aims to solve the problem of low SDK testing efficiency. The method for passing parameters to an SDK comprises: obtaining startup parameters of the SDK; triggering the calling of a startup function encapsulated in the SDK through a command line mode, and passing the startup parameters to the SDK in the form of command line parameters. Specifically, a script can be run through the command line mode, and the startup parameters are passed to the script; then the startup function encapsulated in the SDK is called in the script, and the startup parameters are passed to the SDK. The startup parameters are passed to the SDK in the form of a command line, thereby avoiding the cumbersome steps of recompiling and encapsulating the SDK every time the startup parameters are changed, and greatly improving the testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of SDK testing, and particularly relates to a method and device for passing parameters to an SDK and equipment. BACKGROUND

[0002] Service programs for certain specific projects or functions are usually integrated into third-party SDKs (Software Development Kit, i.e. software development kit), which can provide professional services and encapsulate complex logic implementation and request response processes, making them more convenient for developers to use.

[0003] Before these SDKs are formally put into use, a large amount of testing needs to be performed to ensure that various functions therein can be executed correctly. Since an SDK needs to run an independent running process, the overall environment is independent, and in related technologies, startup parameters are usually fixedly set in SDK code.

[0004] In view of the above related technologies, the inventors believe that if the startup parameters are to be changed for testing, the SDK startup parameters need to be manually set, which is low in efficiency. SUMMARY

[0005] To solve the above problems in the prior art, the present application provides a method, device and equipment for passing parameters to an SDK, which improves testing efficiency.

[0006] In a first aspect, the present application provides a method for passing parameters to an SDK, which comprises:

[0007] obtaining startup parameters of the SDK;

[0008] triggering, in a command line mode, calling of a startup function encapsulated in the SDK, and passing the startup parameters to the SDK in the form of command line parameters.

[0009] Preferably, the SDK encapsulates a game program.

[0010] The obtaining of the startup parameters of the SDK comprises:

[0011] obtaining the startup parameters of the SDK sent by a PaaS platform.

[0012] Preferably, the triggering, in a command line mode, of calling of a startup function encapsulated in the SDK, and the passing of the startup parameters to the SDK in the form of command line parameters, comprise:

[0013] running a script in a command line mode, and passing the startup parameters to the script;

[0014] The start function encapsulated in the SDK is called in the script, and the start parameter is passed into the SDK.

[0015] Preferably, the method further comprises:

[0016] The SDK is encapsulated in a manner supporting the passing-in of command line parameters.

[0017] The second aspect of the present application provides an SDK testing method, which comprises:

[0018] The start parameter is passed into the SDK according to the method as described above;

[0019] The function functions in the SDK are called for testing.

[0020] The third aspect of the present application provides an apparatus for passing a parameter into an SDK, which comprises:

[0021] A parameter obtaining module is configured to obtain a start parameter of the SDK;

[0022] A parameter passing module is configured to trigger the calling of a start function encapsulated in the SDK through a command line manner, and pass the start parameter into the SDK in the form of a command line parameter.

[0023] Preferably, the SDK encapsulates a game program;

[0024] The parameter obtaining module is specifically configured to:

[0025] Obtain the start parameter of the SDK sent by a PaaS platform;

[0026] The parameter passing module is specifically configured to:

[0027] Run a script through a command line manner, and pass the start parameter into the script; call the start function encapsulated in the SDK in the script, and pass the start parameter into the SDK.

[0028] Preferably, the apparatus further comprises:

[0029] An SDK encapsulating module is configured to encapsulate the SDK in a manner supporting the passing-in of command line parameters.

[0030] The fourth aspect of the present application provides an SDK testing device, which comprises a memory and a processor, and the memory stores a computer program capable of being loaded and executed by the processor and performing the method as described above.

[0031] The fifth aspect of the present application provides a computer readable storage device, which stores a computer program capable of being loaded and executed by a processor and performing the method as described above.

[0032] Compared with the closest prior art, the present application has the following beneficial effects:

[0033] The present application passes the starting parameters of the use case layer to the SDK in the form of a command line, avoids the cumbersome steps of recompilation and packaging of the SDK each time the starting parameters are changed, and greatly improves the test efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 is a main step schematic diagram of the method embodiment one of the present application for passing parameters to the SDK;

[0035] Figure 2 is a main step schematic diagram of the method embodiment two of the present application for passing parameters to the SDK;

[0036] Figure 3 is a main structure schematic diagram of the device embodiment one of the present application for passing parameters to the SDK;

[0037] Figure 4 is a main structure schematic diagram of the device embodiment two of the present application for passing parameters to the SDK. DETAILED DESCRIPTION

[0038] The preferred embodiments of the present application will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application, and are not intended to limit the protection scope of the present application.

[0039] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.

[0040] It should be noted that, in the description of the present application, the terms "first", "second" are only for the convenience of description, and do not indicate or imply the relative importance of the devices, elements or parameters, and therefore cannot be understood as a limitation of the present application. In addition, the term "and / or" in the present application is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " in this paper, if not specially stated, generally represents an "or" relationship between the associated objects before and after it.

[0041] Figure 1is the main step schematic diagram of the method embodiment one for passing parameters to SDK of the present application. As Figure 1 As described above, the method of the embodiment includes steps A10-A20:

[0042] Step A10, obtaining the starting parameters of SDK.

[0043] In the embodiment, the game program is encapsulated in the SDK, and the starting parameters of the SDK sent by the PaaS platform can be obtained through the http protocol. For example, in the test case written by python below, the starting parameters r sent by the PaaS can be received by executing the PaasApi().dispatch_slot function, and saved to the resource file context.r:

[0044] r = PaasApi().dispatch_slot(context, api_data=data)

[0045] print("interface return:", r)

[0046] assert_equal(int(code), r['code'])

[0047] assert_equal(msg, r['msg'])

[0048] context.r = r

[0049] Step A20, triggering the call of the starting function encapsulated in the SDK through the command line mode, and passing the starting parameters to the SDK in the form of command line parameters.

[0050] The step can specifically include steps A21-A22:

[0051] Step A21, running a script through the command line mode, and passing the starting parameters to the script.

[0052] For example, in the test case written by python, the starting parameters in the resource file context.r are stored in gamedata, then the script cmd_run_game.py is called through the command line mode, and gamedata (containing the starting parameters) is passed to the script cmd_run_game.py in the form of command line parameters:

[0053]

[0054]

[0055] Step A22: Call the startup function encapsulated in the SDK in the script and pass the startup parameters to the SDK.

[0056] For example, in the script cmd_run_game.py, the launch parameter game_data can be passed to the CmdRunGame.run_game function:

[0057] @click.command()

[0058] @click.option('--game_data','-gd',type=str,help='json format string format')

[0059] @click.option('--paas_url','-pu',type=str,help='paas URL address')

[0060] @click.option('--tenant_key','-tk',type=str,help='tenant's key')

[0061] @click.option('--tenant_client_secret','-tcs',type=str,help='client key')

[0062] @click.option('--play_name','-pn',type=str,help='userid')

[0063] def run(game_data,paas_url,tenant_key,tenant_client_secret,playname):

[0064] CmdRunGame.run_game(game_data=game_data,

[0065] paas_url=paas_url,

[0066] tenant_key = tenant_key,

[0067] tenant_client_secret=tenant_client_secret,

[0068] play_name = play_name)

[0069] ...

[0070] In the CmdRunGame.run_game function, the following code can be included:

[0071]

[0072] In this embodiment, the CmdRunGame.run_game function finally calls the start function game_obj.run() encapsulated in the SDK, and passes the start parameter game_data to the SDK.

[0073] Figure 2 is the main step schematic diagram of the second method embodiment of the application for passing parameters to the SDK. As Figure 2 described, the method of this embodiment includes steps B10-B30:

[0074] Step B10, encapsulate the SDK in a way that supports the passing-in of command line parameters.

[0075] Step B20, obtain the start parameter of the SDK.

[0076] Step B30, trigger the call of the start function encapsulated in the SDK through the command line mode, and pass the start parameter to the SDK in the form of a command line parameter.

[0077] Wherein, the specific execution method of steps B20-B30 is the same as the corresponding steps A10-A20 in the above-mentioned first embodiment, which will not be repeated here.

[0078] Further, based on the above method of passing parameters to the SDK, the application also provides an SDK testing method, and the testing method of this embodiment includes steps C10-C20:

[0079] Step C10, pass the start parameter to the SDK according to the above-mentioned method.

[0080] Step C20, call each function in the SDK for testing.

[0081] Although the steps in the above-mentioned embodiments are described in the above-mentioned order, those skilled in the art can understand that, in order to achieve the effect of this embodiment, different steps do not have to be executed in such an order, they can be executed simultaneously (in parallel) or in a reversed order, and these simple changes are within the protection scope of the application.

[0082] Figure 3 is the main structure schematic diagram of the first device embodiment of the application for passing parameters to the SDK. As Figure 3As shown, the device 100 for passing parameters to an SDK in this embodiment comprises a parameter acquisition module 110 and a parameter passing module 120.

[0083] The parameter acquisition module 110 is configured to acquire the startup parameters of the SDK, and the parameter passing module 120 is configured to trigger the calling of the startup function encapsulated in the SDK through a command line mode and pass the startup parameters to the SDK in the form of command line parameters.

[0084] In this embodiment, the game program is encapsulated in the SDK, the parameter acquisition module 110 can be specifically configured to acquire the startup parameters of the SDK sent by a PaaS (Platform as a Service) platform, and the parameter passing module 120 can be specifically configured to run a script through a command line mode and pass the startup parameters to the script, call the startup function encapsulated in the SDK in the script, and pass the startup parameters to the SDK.

[0085] Figure 4 FIG. 2 is a main structure diagram of an embodiment two of the device for passing parameters to an SDK according to the present application. Figure 4 As shown, the device 200 for passing parameters to an SDK in this embodiment comprises an SDK encapsulation module 210, a parameter acquisition module 220 and a parameter passing module 230.

[0086] The SDK encapsulation module 210 is configured to encapsulate the SDK into a mode supporting the passing-in of command line parameters, the parameter acquisition module 220 is configured to acquire the startup parameters of the SDK, and the parameter passing module 230 is configured to trigger the calling of the startup function encapsulated in the SDK through a command line mode and pass the startup parameters to the SDK in the form of command line parameters.

[0087] Further, based on the above method, the present application further provides an embodiment of an SDK testing device. The testing device in this embodiment comprises a memory and a processor, and the memory stores a computer program capable of being loaded and executed by the processor to perform the above method.

[0088] Still further, the present application further provides an embodiment of a computer readable storage device. The storage device in this embodiment stores a computer program capable of being loaded and executed by a processor to perform the above method.

[0089] The computer readable storage device may, for example, include a U disk, a mobile hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.

[0090] Those skilled in the art should be able to appreciate that the method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been described in general terms in the above description. Whether the functions are performed in electronic hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0091] So far, the technical solutions of the present application have been described in conjunction with the preferred embodiments shown in the drawings. However, those skilled in the art will readily understand that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make equivalent changes or replacements to the relevant technical features without deviating from the principles of the present application, and the technical solutions after such changes or replacements will all fall within the protection scope of the present application.

Claims

1. A method of passing parameters to an SDK, characterized by, The method comprises: obtaining a starting parameter of an SDK; triggering a call of a starting function encapsulated in the SDK by a command line mode, and passing the starting parameter to the SDK in the form of a command line parameter; the SDK encapsulates a game program; the obtaining of the starting parameter of the SDK comprises: obtaining the starting parameter of the SDK sent by a PaaS platform; the triggering of the call of the starting function encapsulated in the SDK by the command line mode and the passing of the starting parameter to the SDK in the form of the command line parameter comprise: running a script by the command line mode, and passing the starting parameter to the script; calling the starting function encapsulated in the SDK in the script, and passing the starting parameter to the SDK; the method further comprises: encapsulating the SDK into a mode supporting the passing-in of a command line parameter.

2. An SDK testing method, characterized by, The method comprises: passing a starting parameter to the SDK according to the method in claim 1; and calling each function in the SDK for testing.

3. An apparatus for passing parameters to an SDK, the apparatus comprising: The device comprises: a parameter obtaining module configured to obtain a starting parameter of an SDK; and a parameter passing module configured to trigger a call of a starting function encapsulated in the SDK by a command line mode, and pass the starting parameter to the SDK in the form of a command line parameter; the SDK encapsulates a game program; the parameter obtaining module is specifically configured to obtain the starting parameter of the SDK sent by a PaaS platform; the parameter passing module is specifically configured to run a script by the command line mode, and pass the starting parameter to the script; call the starting function encapsulated in the SDK in the script, and pass the starting parameter to the SDK; the device further comprises an SDK encapsulating module configured to encapsulate the SDK into a mode supporting the passing-in of a command line parameter.

4. An SDK test device, characterized by A computer program is stored on a memory and loaded and executed by a processor, and the computer program is configured to perform the method in any one of claims 1-2.

5. A computer-readable storage device, comprising: A computer program is stored on a memory and loaded and executed by a processor, and the computer program is configured to perform the method in any one of claims 1-2.