CN115757173A - High-compatibility block chain SDK test method, system and storage medium - Google Patents

High-compatibility block chain SDK test method, system and storage medium Download PDF

Info

Publication number
CN115757173A
CN115757173A CN202211526124.4A CN202211526124A CN115757173A CN 115757173 A CN115757173 A CN 115757173A CN 202211526124 A CN202211526124 A CN 202211526124A CN 115757173 A CN115757173 A CN 115757173A
Authority
CN
China
Prior art keywords
test
execution
sdk
layer
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211526124.4A
Other languages
Chinese (zh)
Inventor
黄方蕾
张珂杰
张鑫杰
尚璇
胡麦芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202211526124.4A priority Critical patent/CN115757173A/en
Publication of CN115757173A publication Critical patent/CN115757173A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of block chain testing, in particular to a high-compatibility block chain SDK testing method, a system and a storage medium, wherein the method comprises the following steps: the case layer stores a plurality of test cases; the adaptation layer provides a function calling interface for adapting the SDKs of multiple categories; the executive layer receives a first test instruction, and the test comprises executing a test script according to the parameter configuration table; recording the execution result of the functional test program segment, and writing a result reference file; receiving test instructions aiming at other kinds of SDKs, and executing a test script on the SDKs; comparing the execution result of the functional test program segment with the result reference file, and if the execution result is consistent with the result reference file, the functional test is passed; if all the functional tests are passed, the SDK test is passed. The beneficial technical effects of the invention comprise: after the operation of one-time testing is realized, subsequent SDK testing of other language types can be automatically carried out, and the compatibility and the testing efficiency of the SDK testing are obviously improved.

Description

High-compatibility block chain SDK testing method, system and storage medium
Technical Field
The invention relates to the technical field of block chain testing, in particular to a high-compatibility block chain SDK testing method, a system and a storage medium.
Background
The blockchain is essentially a decentralized database. The blockchain is a novel combined application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. The blockchain system can naturally establish credible proofs among users, and has the characteristics of common maintenance, public transparency and traceability, so that the blockchain system gradually gets wide attention. The system is widely used in the fields of finance, logistics, public service, digital copyright and insurance. The use of block chains by users is called by SDKs at present. The method mainly comprises the following steps: deployment, invocation, upgrading, freezing and the like of the intelligent contracts, and in order to meet the requirements of customers for different languages, SDKs of various language types are realized. Each SDK for a different language provides a complete interface to which the blockchain can be invoked. Although convenient for users, each SDK needs to be functionally tested, resulting in a large amount of repetitive SDK testing work. There is therefore a need to develop techniques that can reduce the testing effort for different language classes of SDKs.
Chinese patent document CN115292174A discloses a method and a system for testing a block chain, where the block chain test system is a test system generated by integrating a block chain test plug-in an interface test tool, and the block test plug-in includes a block chain software development kit SDK and multiple function test interfaces. The technical scheme includes that a block chain function test request is obtained, and the block chain function test request carries a function type identifier; responding to the block chain function test request, and determining a target function test interface matched with the function type identifier from the plurality of function test interfaces; and calling the block chain SDK to perform corresponding function test through the target function test interface. However, this solution does not solve the problem of testing multiple SDKs adapted to different language classes.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the technical problem of the lack of block chain SDK test compatible with multiple language types at present. The high-compatibility block chain SDK testing method, the system and the storage medium are provided, and the testing efficiency of the multi-language SDK can be improved.
To solve the technical problem, the invention adopts the following technical scheme: a high-compatibility block chain SDK testing method is used for being executed on a testing system comprising a use case layer, an execution layer and an adaptation layer, and comprises the following steps:
the case layer stores a plurality of test cases, the test cases comprise parameter configuration tables and test scripts, and the test scripts comprise a plurality of functional test program segments;
the adaptation layer provides a function calling interface for adapting to multiple kinds of SDKs;
the execution layer receives a first test instruction and tests the selected type of SDK, wherein the test comprises executing a test script according to a parameter configuration table;
recording the execution result of the functional test program segment by the execution layer in the first test process, and packaging the execution result into a result reference file;
the execution layer receives test instructions aiming at other types of SDKs, reads test cases, and executes test scripts on the SDKs through function calling interfaces corresponding to the types of the SDKs;
in the process of executing the test script by the execution layer, comparing the execution result of the functional test program segment with the result reference file, if the execution result is consistent with the result reference file, the functional test is passed, and if the execution result is inconsistent with the result reference file, the functional test is not passed;
if all the functional tests are passed, the SDK test is passed, otherwise, if the functional tests are not passed, the SDK test is not passed.
Preferably, the parameter configuration table of the test case records the execution times, thread count, data set path and execution timeout time of the test script, the adaptation layer provides a configuration interface for modifying the parameter configuration table, and the test instruction includes an instruction for modifying the parameter configuration table.
Preferably, the test instruction includes a list of functions to be tested, and when the execution layer executes the test script, the following steps are executed:
the execution layer selects a corresponding test case according to the function list to be tested;
executing a function test program segment of the test script according to the execution times and the thread number of the parameter configuration table;
if the execution of the functional test program segment is finished and the functional test program segment is matched with the result reference file within the execution overtime, the corresponding functional test is judged to pass, otherwise, if the execution overtime or the execution result is not matched with the result reference file, the corresponding functional test is judged not to pass.
Preferably, when the execution layer executes the test script, the following steps are further executed:
the execution layer randomly generates a concurrency number;
the execution layer concurrently executes a corresponding number of functional test program segments according to the generated concurrent number;
if the concurrent functional test program segments are executed within the execution overtime time and the execution result is matched with the result reference file, the corresponding functional test is judged to pass, otherwise, if any one functional test program segment is executed overtime or the execution result is not matched with the result reference file, the corresponding functional test is judged not to pass.
Preferably, the method for executing the functional test program segment of the test script by the execution layer includes:
the execution layer randomly generates data required by the functional test program segment and stores the data into a data set path in a parameter configuration table;
the execution layer calls a function calling interface provided by the adaptation layer to execute a function in the function testing program segment, and the function calling interface uses data specified by the data set path;
and the execution layer records the execution result of the execution function test program segment.
Preferably, the method for recording the execution result of the functional test program segment by the execution layer comprises the following steps:
the execution layer records the execution result of the functional test program segment which is irrelevant to the data.
Preferably, the method for recording the data-independent execution result of the functional test program segment by the execution layer comprises the following steps:
the execution layer executes the function test program segment for multiple times by using different data and records the execution result of each execution;
and comparing the multiple execution results, wherein the same part is used as the execution result of the finally recorded functional test program segment, which is not related to the data.
A block chain SDK test system for executing the high-compatibility block chain SDK test method comprises a use case layer, an execution layer and an adaptation layer,
the case layer stores a plurality of test cases, the test cases comprise a parameter configuration table and a test script, the test script comprises a plurality of functional test program segments,
the adaptation layer provides a function call interface that adapts multiple classes of SDKs,
the executive layer receives a first test instruction and tests the selected type of SDK, wherein the test comprises executing a test script according to a parameter configuration table,
the execution layer records the execution result of the functional test program segment in the first test process, packs the execution result into a result reference file,
the executive layer receives the test instruction for other types of SDK, reads the test case, executes the test script on the SDK through the function calling interface corresponding to the type of SDK,
in the process of executing the test script by the execution layer, comparing the execution result of the functional test program segment with the result reference file, if the execution result is consistent with the result reference file, the functional test is passed, and if the execution result is inconsistent with the result reference file, the functional test is not passed;
and if all the functional tests are passed, the SDK test is passed, otherwise, if the functional tests are not passed, the SDK test is not passed.
A computer system comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the computer program when executed by the processor implementing a highly compatible blockchain SDK testing method as aforesaid.
A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which when executed by a processor implements a high compatibility blockchain SDK testing method as described above.
The beneficial technical effects of the invention comprise: when a first test instruction is executed, an execution result is recorded, a result reference file is generated, basic function calls of different languages are provided by means of an adaptation layer, so that the execution of a function test program segment under multiple languages can be realized, and the execution result of the function test program segment can be obtained through the result reference file, so that after one test operation, subsequent SDK tests of other languages can be automatically carried out, and the compatibility and the test efficiency of the SDK test are obviously improved; the execution times, execution overtime time and the like of the test can be controlled through the parameter configuration table, rich test configuration means are provided, and the application range of the SDK test is widened; the key execution result of the functional test program segment can be accurately recorded through the execution result irrelevant to the data, and a reference result with reference value is provided for the test of other SDKs.
Other features and advantages of the present invention will be disclosed in more detail in the following detailed description of the invention and the accompanying drawings.
Drawings
The invention is further described with reference to the accompanying drawings:
fig. 1 is a schematic flow chart of a block chain SDK testing method according to an embodiment of the present invention.
FIG. 2 is a flowchart illustrating a method for executing a test script by an execution layer according to an embodiment of the present invention.
FIG. 3 is a flowchart illustrating a method for executing a test script concurrently by an execution layer according to an embodiment of the present invention.
FIG. 4 is a flowchart illustrating a method for executing a functional test program segment according to an embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a block chain SDK testing system according to an embodiment of the invention.
FIG. 6 is a block diagram of a computer system according to an embodiment of the present invention.
Wherein: 10. the system comprises a case layer 11, a parameter configuration table 12, a test script 20, an execution layer 21, a test case execution module 22, a random Data generation and concurrency number module 23, a recording module 24, an automatic execution module 30, an adaptation layer 31, service Api 32, config 33, utils 34, data 40, a computer system 41, a memory 42, a computer program 43 and a processor.
Detailed Description
The technical solutions of the embodiments of the present invention are explained and illustrated below with reference to the drawings of the embodiments of the present invention, but the following embodiments are only preferred embodiments of the present invention, and not all embodiments. Based on the embodiments in the implementation, other embodiments obtained by those skilled in the art without any creative effort belong to the protection scope of the present invention.
In the following description, the appearances of the terms "inner", "outer", "upper", "lower", "left", "right", and the like, indicating an orientation or positional relationship, are only for convenience in describing the embodiments and for simplicity of description, but do not indicate or imply that the referenced device or element must have a particular orientation, be constructed and operated in a particular orientation, and are not to be construed as limiting the present invention.
It should be understood that reference to "a plurality" in this application means two or more. In the description of the present application, "/" means "or" unless otherwise stated, for example, a/B may mean a or B; "and/or" herein is only an association relationship describing an association object, and means that there may be three relationships, for example, a and/or B, and may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, for the convenience of clearly describing the technical solutions of the present application, the terms "first", "second", and the like are used to distinguish the same items or similar items having substantially the same functions and actions. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
The statement that "one embodiment" or "some embodiments" or the like are described in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. Furthermore, the terms "including," "comprising," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
Before the technical solution of the present embodiment is introduced, an application scenario and related technologies of the present embodiment are introduced.
The SDK, an abbreviation for Software Development Kit, is translated into a Software Development toolkit, referred to in this example as the blockchain invocation toolkit. In the block chain application, an application program directly providing service for a user does not directly interact with the block chain, and then the operation on the block chain is indirectly realized by means of the SDK. As general operations on blockchains: deployment of contracts (deployoy), invocation of contracts (invoke), upgrade of contracts (update), etc.; some query operations on blockchains: query block information (getBlockByHash), query node information (getnodehsh), and the like. Common SDKs include JavaSdk, goSdk, and JsSdk, which correspond to Java-language-programmed applications, go-language-programmed applications, and Java-script-language-programmed applications, respectively. When testing the block chain SDK, it is also necessary to test SDKs of different language types. This results in a very heavy test workload for the block chain SDK. Therefore, it is necessary to research a block chain SDK test scheme with high compatibility, which can implement cross-language variety, so as to reduce the workload of block chain SDK test.
The embodiment provides a high-compatibility blockchain SDK testing method, which is used for being executed on a testing system including a use case layer 10, an execution layer 20 and an adaptation layer 30, and referring to fig. 1, the method includes the following steps:
step A01), the case layer 10 stores a plurality of test cases, the test cases comprise a parameter configuration table 11 and a test script 12, and the test script 12 comprises a plurality of functional test program segments;
step A02) the adaptation layer 30 provides function call interfaces for adapting multiple types of SDKs;
step A03) the execution layer 20 receives a first test instruction and tests the selected type of SDK, wherein the test comprises executing a test script 12 according to a parameter configuration table 11;
step A04) recording the execution result of the functional test program segment by the execution layer 20 in the first test process, and packaging the execution result into a result reference file;
step A05) the execution layer 20 receives test instructions aiming at other types of SDKs, reads test cases, and executes the test scripts 12 on the SDKs through function call interfaces corresponding to the SDK types;
step A06), in the process that the execution layer 20 executes the test script 12, comparing the execution result of the functional test program segment with the result reference file, if the execution result is consistent with the result reference file, the functional test is passed, and if the execution result is inconsistent with the result reference file, the functional test is not passed;
and step A07), if all the functional tests are passed, the SDK test is passed, otherwise, if the functional tests are not passed, the SDK test is not passed.
When testing the block chains SDK of different languages, the calling of the function is easy to realize, and the total quantity of the types of the function is small and can be realized in an exhaustive mode. In the SDK tests of different languages, the judgment of the result of each function test cannot be realized by the prior art. The block chain SDK testing method provided in this embodiment selects a block chain SDK in one language at first, and performs a test under manual operation by using the operation methods of the use case layer 10, the execution layer 20, and the adaptation layer 30 provided in this embodiment. Meanwhile, during the testing process, the execution result of each functional test program segment is recorded by the execution layer 20. Since the execution result will necessarily differ because of the difference in data and parameters, the parts that are not related to the data will be consistent. For example, as a function of contract deployment, when a smart contract is successfully deployed on a blockchain by means of a blockchain SDK, a contract ID fed back by the blockchain will be received, and when the contract ID is not empty, the contract deployment is successful, so that the contract ID is not empty as an execution result. Rather than having the contract ID directly as the result of execution. The decision as to which contents each functional program segment records as a result of execution is directly and unanimously made by the functional program segment itself, and can therefore be determined and implemented by a person skilled in the art. In the block chain SDK test of other language types, the execution result of the functional test program segment is compared with the result reference file, so that whether the corresponding function of the corresponding block chain SDK can be correctly executed or not can be determined.
The test case in this embodiment includes both the parameter configuration table 11 and the test script 12, and the test script 12 includes a plurality of functional test program segments. Each test case is tested for one SDK function, or for a test having several SDK functions associated. The test script 12 includes a plurality of functional test program segments, which are correspondingly programmed functional test program segments for different test modes of the same SDK function. The function test of the block chain SDK contract call includes a direct call mode and a condition triggering call mode. Therefore, two corresponding functional test program segments exist, one is a test mode of direct calling, and the other is a test mode of setting a trigger condition and automatically providing the trigger condition through a program after the trigger condition is set.
The test scripts 12 in different languages are also easy to implement, the test scripts 12 may be written in an exhaustive manner by a human operator, or the test scripts 12 in one language may be converted into scripts in another language by means of a language conversion tool existing in the prior art. However, the present embodiment provides function call interfaces of different language types through the adaptation layer 30, so that the test script 12 can be written in any language. When the function is required to be called in the test script 12, the function calling interface corresponding to the SDK language is automatically selected from the adaptation layer 30.
The parameter configuration table 11 of the test case records the execution times, thread number, data set path and execution timeout time of the test script 12, the adaptation layer 30 provides a configuration interface for modifying the parameter configuration table 11, and the test instruction includes an instruction for modifying the parameter configuration table 11.
The execution of the test script 12 can be guided by recording the execution times, thread count, data set path, and execution timeout time of the test script 12 through the parameter configuration table 11. And the configuration interface of the modified parameter configuration table 11 provided by the adaptation layer 30 can customize the appropriate parameter configuration, thereby providing richer test means. Although the number of executions and the number of threads used are different for the test script 12 after changing the parameter configuration, the result after each execution should still conform to the result reference file. The data corresponding to the data set path used may also be different, but the execution result recorded in the result reference file is data-independent, so that the execution result of the test script 12 segment of the corresponding function can be determined to be correct by comparing with the execution result file.
The test instruction includes a list of functions to be tested, referring to fig. 2, when the execution layer 20 executes the test script 12, the following steps are performed:
step B01) the execution layer 20 selects a corresponding test case according to the function list to be tested;
step B02) executing the function test program segment of the test script 12 according to the execution times and the thread number of the parameter configuration table 11;
and B03) if the execution of the functional test program segment is finished within the execution overtime time and the functional test program segment is matched with the result reference file, judging that the corresponding functional test is passed, otherwise, if the execution overtime time or the execution result is not matched with the result reference file, judging that the corresponding functional test is not passed.
Embodiments may establish one list of functions to be tested for each test, or may use a unified list of functions to be tested because the functions that can be provided are the same although the language of the blockchain SDK is different. And within the execution overtime, the function test program segment is executed and matched with the result reference file, the corresponding function test is judged to pass, a test result file is generated, and the test result of each function is displayed.
When the execution layer 20 executes the test script 12, the test script 12 is executed concurrently to test the concurrent functions of the block chain SDK, please refer to fig. 3, and the concurrently executing the test script 12 includes the following steps:
step C01) the execution layer 20 randomly generates a concurrency number;
step C02) executing the layer 20 to generate a concurrent number, and concurrently executing a corresponding number of functional test program segments;
and C03) if the execution of the concurrent functional test program segments is completed within the execution overtime and the execution result is matched with the result reference file, judging that the corresponding functional test passes, otherwise, if any functional test program segment is executed overtime or the execution result is not matched with the result reference file, judging that the corresponding functional test does not pass.
The execution layer 20 randomly generates a concurrency number and concurrently executes the functional test program segment according to the concurrency number. If the SDK has normal concurrent functions, all the concurrently executed functional test program segments should be correctly executed, and the execution result of each functional test program segment should be consistent with the result reference file.
Referring to FIG. 4, a method for executing the functional test program segments of the test script 12 by the execution layer 20 includes:
step D01) the execution layer 20 randomly generates data required by the functional test program segment and stores the data into a data set path in the parameter configuration table 11;
step D02) the execution layer 20 calls a function calling interface provided by the adaptation layer 30 to execute the function in the function testing program segment, and the function calling interface uses the data specified by the data set path;
step D03) the execution layer 20 records the execution result of the execution function test program segment.
In the test, the data set path in the parameter configuration table 11 is modified by the adaptation layer 30 according to the position of the actual data, or the actual data may be placed in the corresponding position according to the data set path in the parameter configuration table 11 and directly called by the functional test program segment. The execution layer 20 implements the execution of the code through the function call interface provided by the adaptation layer 30 when executing the functional test program segment. Such as read file code in the functional test program segment, is embodied in a language read file code provided by the adaptation layer 30 that is consistent with the SDK language currently being tested. Therefore, the function test program segment can be programmed by only one language, and the function calling interface of the corresponding language is provided for different language types of SDKs by the adaptation layer 30.
The method for recording the execution result of the functional test program segment by the execution layer 20 comprises the following steps: the execution layer 20 records the data-independent execution results of the functional test program segments.
The method for recording the execution result of the functional test program segment independent of the data by the execution layer 20 comprises the following steps:
the execution layer 20 uses different data to execute the functional test program segment for multiple times, and records the execution result of each execution;
and comparing the multiple execution results, wherein the same part is used as the finally recorded execution result of the functional test program segment, which is not related to the data. The test is repeatedly carried out by using different data, the successful test is manually calibrated, the test results obtained by the successful test are compared, the same part is used as the execution result of the finally recorded functional test program segment which is irrelevant to the data, and a result reference file is recorded.
For reference, the result reference file in the present embodiment includes account information, contract information, call information, and result information, and is recorded in a json file in a predetermined format. The content of json generated by the embodiment is as follows:
{
"Contracts":{
"DemoContract":{
"PropPath":"contracts/fvm/docJson/demo/demo.properties",
"CodePath":"contracts/fvm/docJson/demo/lib.rs",
"Type":"fvm",
"Address":
}
},
"Accounts":{
a:{
"accountJson":"{\"address\":\"0x46df0dadcb2b7c5687fb1b0d0c219cfd\"}",
"adress":"0x611237c1e0730987cb67b06081619af1",
"passwd":"12345600",
"type":"ECDSA_GENESIS_4"
}
}
"Prepares":[{
"AccountRef":"a",
"ContractRef":"DemoContract",
"IsArgs":"false",
"Args":[{
"ArgsType":"",
"ArgsData34":""
}]
}],
"Invokes":[{
"ContractRef":"DemoContract",
"AccountRef":"a",
"Method":{
"MethodName":"set_hash",
"Args":[{
"ArgsType":"String",
"ArgsData34":["key001","key002"]
},{
"ArgsType":"String",
"ArgsData34":["value001","value002"]
}]
}
},
"OptType":"invoke",
"Extra":"",
"Expected":{
"Receipt":["",""],
"ReceiptLog":["",""],
"ReceiptErr":["",""]
}
}]
}
the contexts field includes contract-related information: contract name, api, source file, type, address.
The Accounts field includes information about the account: json, password, type of account.
The Prepares field includes information about the deployment contract: deployer account, contract, with or without configuration parameters.
The invoke field includes information about the contract operation: called contract, caller's account, method, parameters, type of operation on the contract, return value.
The above is a simple json file sample recorded after the use case is executed, and other SDKs may compare execution results with the json file.
A block chain SDK testing system for executing the above-mentioned high-compatibility block chain SDK testing method, please refer to fig. 5, which includes a case layer 10, an execution layer 20 and an adaptation layer 30,
the case layer 10 stores a plurality of test cases, each test case includes a parameter configuration table 11 and a test script 12, the test script 12 includes a plurality of functional test program segments,
the adaptation layer 30 provides a function call interface that adapts multiple classes of SDKs,
the execution layer 20 receives the first test instruction and performs a test on the selected type of SDK, the test including executing the test script 12 according to the parameter configuration table 11,
the execution layer 20 records the execution result of the functional test program segment during the first test, packages the execution result into a result reference file,
the execution layer 20 receives test instructions for other types of SDKs, reads test cases, executes the test script 12 on the SDK through a function call interface corresponding to the SDK type,
in the process of executing the test script 12 by the execution layer 20, comparing the execution result of the functional test program segment with the result reference file, if the execution result is consistent with the result reference file, the functional test is passed, and if the execution result is inconsistent with the result reference file, the functional test is not passed;
and if all the functional tests are passed, the SDK test is passed, otherwise, if the functional tests are not passed, the SDK test is not passed.
Further, the present embodiments provide a system for implementing a blockchain SDK test. Wherein the use case layer 10 stores test cases. The adaptation layer 30 provides a function call interface corresponding to the SDKs in multiple languages to implement basic function, so that the test cases only need to be compiled in one language.
Specifically, the adaptation layer 30 includes the following four modules: the Service Api31 provides the realization and the encapsulation of a function calling interface; the Config32 provides reading and modification of various configuration files, including modification of the parameter configuration table 11 of the test case; utils33 provides the implementation and encapsulation of the function call interface of the underlying public method; data34 provides various Data generation interfaces for generating Data matching the test script 12 for the execution layer 20, such as a randomly generated block chain virtual account and a corresponding private key, and provides randomly generated transaction information, an intelligent contract name, and a randomly generated intelligent contract invocation request for the execution layer 20. The Service Api31 includes: the http service sends the transaction to the block link point; the type of Data required for fuzzy Data34 generation; parsing and modifying various files by using the parse Data 34; controlling the number of multitreaded concurrent threads.
The execution layer 20 is used for executing the test case and testing the target SDK. Specifically, the execution layer 20 includes a test case execution module 21, a random data generation and concurrency number module 22, a recording module 23, and an automatic execution module 24. The test case execution module 21 is configured to execute a first test instruction. The random Data generation and concurrency number generation module 22 is configured to invoke a Data34 interface of the adaptation layer 30, generate Data required by the test case, and generate a concurrency number at the same time. The recording module 23 is configured to record an execution result of the functional test program segment generated when the instruction is tested for the first time, and package the execution result into a result reference file. The automatic execution module 24 is used for automatically realizing the test of the SDKs in other language types according to the test cases and the result reference files.
Referring to fig. 6, a computer system 40 includes a memory 41, a processor 43, and a computer program 42 stored in the memory 41 and executable on the processor 43, wherein the computer program 42 is executed by the processor 43 to implement the SDK testing method for the high compatibility blockchain.
The computer system 40 may be a general purpose computer system 40 or a special purpose computer system 40. In particular implementations, computer system 40 may be a server cluster including a plurality of servers. Those skilled in the art will appreciate that fig. 6 is merely exemplary of computer system 40 and is not intended to limit computer system 40 and may include more or less components than those shown, or some of the components may be combined, or different components may be included, such as input output devices, network access devices, etc.
The Processor 43 may be a Central Processing Unit (CPU), and the Processor 43 may also be other general-purpose Processor 43, a Digital Signal Processor 43 (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor 43 may be a microprocessor 43 or may be any conventional processor 43.
The storage 41 may be, in some embodiments, an internal storage unit of the computer system 40, such as a hard disk or a memory of the computer system 40. The memory 41 may also be an external storage device of the computer system 40 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the computer system 40. Further, the memory 41 may also include both internal storage units and external storage devices of the computer system 40. The memory 41 is used to store an operating system, application programs, a Boot Loader (Boot Loader), data, and other programs. The memory 41 may also be used to temporarily store data that has been output or is to be output.
A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program 42, and the computer program 42, when executed by a processor 43, implements a high compatibility blockchain SDK testing method as described above.
The beneficial technical effects of the invention comprise: when a first test instruction is executed, an execution result is recorded, a result reference file is generated, basic function calls of different languages are provided by means of the adaptation layer 30, so that the execution of the function test program segments under multiple languages can be realized, and the execution result of the function test program segments can be obtained through the result reference file, so that after one test operation, subsequent SDK tests of other languages can be automatically performed, and the compatibility and the test efficiency of the SDK test are remarkably improved; the execution times, execution overtime time and the like of the test can be controlled through the parameter configuration table 11, rich test configuration means are provided, and the application range of the SDK test is widened; the key execution result of the functional test program segment can be accurately recorded through the execution result irrelevant to the data, and a reference result with reference value is provided for the test of other SDKs.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that the present invention may be practiced without limitation to such specific embodiments. Any modification which does not depart from the functional and structural principles of the present invention is intended to be included within the scope of the claims.

Claims (10)

1. A high-compatibility block chain SDK test method is used for being executed on a test system comprising a use case layer, an execution layer and an adaptation layer, and is characterized by comprising the following steps:
the case layer stores a plurality of test cases, the test cases comprise parameter configuration tables and test scripts, and the test scripts comprise a plurality of functional test program segments;
the adaptation layer provides a function calling interface for adapting to multiple kinds of SDKs;
the executive layer receives a first test instruction and tests the selected type of SDK, wherein the test comprises executing a test script according to a parameter configuration table;
recording the execution result of the functional test program segment by the execution layer in the first test process, and packaging the execution result into a result reference file;
the execution layer receives test instructions aiming at other types of SDKs, reads test cases, and executes test scripts on the SDKs through function calling interfaces corresponding to the types of the SDKs;
in the process of executing the test script by the execution layer, comparing the execution result of the functional test program segment with the result reference file, if the execution result is consistent with the result reference file, the functional test is passed, and if the execution result is inconsistent with the result reference file, the functional test is not passed;
and if all the functional tests are passed, the SDK test is passed, otherwise, if the functional tests are not passed, the SDK test is not passed.
2. The SDK testing method of claim 1, wherein the SDK testing method is further characterized in that,
the parameter configuration table of the test case records the execution times, thread number, data set path and execution overtime time of the test script, the adaptation layer provides a configuration interface for modifying the parameter configuration table, and the test instruction comprises an instruction for modifying the parameter configuration table.
3. The SDK testing method of claim 2, wherein the SDK testing method is applied to a high compatibility block chain,
the test instruction comprises a function list to be tested, and when the execution layer executes the test script, the following steps are executed:
the execution layer selects a corresponding test case according to the function list to be tested;
executing a function test program segment of the test script according to the execution times and the thread number of the parameter configuration table;
if the execution of the functional test program segment is finished and the functional test program segment is matched with the result reference file within the execution overtime, the corresponding functional test is judged to pass, otherwise, if the execution overtime or the execution result is not matched with the result reference file, the corresponding functional test is judged not to pass.
4. The SDK testing method of claim 3, wherein the SDK testing method is further characterized in that,
when the execution layer executes the test script, the following steps are also executed:
the execution layer randomly generates a concurrency number;
the execution layer concurrently executes a corresponding number of functional test program segments according to the generated concurrent number;
if the execution of the concurrent functional test program segments is completed within the execution overtime and the execution result is matched with the result reference file, the corresponding functional test is judged to pass, otherwise, if any functional test program segment is executed overtime or the execution result is not matched with the result reference file, the corresponding functional test is judged not to pass.
5. The SDK testing method of any one of claims 1 to 4,
the method for the execution layer to execute the functional test program segment of the test script comprises the following steps:
the execution layer randomly generates data required by the functional test program segment and stores the data into a data set path in a parameter configuration table;
the execution layer calls a function calling interface provided by the adaptation layer to execute a function in the function testing program segment, and the function calling interface uses data specified by the data set path;
the execution layer records the execution result of the execution function test program segment.
6. The SDK testing method of claim 5, wherein the SDK testing method comprises the following steps,
the method for recording the execution result of the execution function test program segment by the execution layer comprises the following steps:
the execution layer records the execution result of the functional test program segment, which is irrelevant to data.
7. The SDK testing method of claim 6, wherein the SDK testing method is applied to a high compatibility block chain,
the method for recording the execution result of the functional test program segment, which is irrelevant to data, of the execution layer comprises the following steps:
the execution layer executes the function test program segment for multiple times by using different data and records the execution result of each execution;
and comparing the multiple execution results, wherein the same part is used as the execution result of the finally recorded functional test program segment, which is not related to the data.
8. A block chain SDK test system for performing the high compatibility block chain SDK test method according to any one of claims 1 to 7,
comprises a use case layer, an execution layer and an adaptation layer,
the case layer stores a plurality of test cases, the test cases comprise a parameter configuration table and a test script, the test script comprises a plurality of functional test program segments,
the adaptation layer provides a function call interface that adapts multiple classes of SDKs,
the executive layer receives a first test instruction and tests the selected type of SDK, wherein the test comprises executing a test script according to a parameter configuration table,
the execution layer records the execution result of the functional test program segment in the first test process, packs the execution result into a result reference file,
the executive layer receives the test instruction aiming at other types of SDK, reads the test case, executes the test script on the SDK through the function calling interface corresponding to the type of the SDK,
in the process of executing the test script by the execution layer, comparing the execution result of the functional test program segment with the result reference file, if the execution result is consistent with the result reference file, the functional test is passed, and if the execution result is inconsistent with the result reference file, the functional test is not passed;
if all the functional tests are passed, the SDK test is passed, otherwise, if the functional tests are not passed, the SDK test is not passed.
9. A computer system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program when executed by the processor implementing the high compatibility blockchain SDK testing method of any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the high compatibility blockchain SDK testing method of any of claims 1 to 7.
CN202211526124.4A 2022-12-01 2022-12-01 High-compatibility block chain SDK test method, system and storage medium Pending CN115757173A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211526124.4A CN115757173A (en) 2022-12-01 2022-12-01 High-compatibility block chain SDK test method, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211526124.4A CN115757173A (en) 2022-12-01 2022-12-01 High-compatibility block chain SDK test method, system and storage medium

Publications (1)

Publication Number Publication Date
CN115757173A true CN115757173A (en) 2023-03-07

Family

ID=85341789

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211526124.4A Pending CN115757173A (en) 2022-12-01 2022-12-01 High-compatibility block chain SDK test method, system and storage medium

Country Status (1)

Country Link
CN (1) CN115757173A (en)

Similar Documents

Publication Publication Date Title
US8769485B2 (en) Data parallelism and parallel operations in stream processing
US9038041B2 (en) Stream processor with compiled programs
US9015702B2 (en) Determining compatibility of an application with different versions of an operating system
CN111143087B (en) Interface calling method, device, storage medium and server
US10725893B2 (en) System and method for determination of code coverage for software applications in a network environment
US8572579B2 (en) Break on next called function or method in java debugger agent
WO2016033966A1 (en) Protection method and device for application data
CA2226224A1 (en) Fast traps for computer software instrumentation
US20120246653A1 (en) Generic command parser
US7992156B1 (en) Determining the address of a system call table to perform antivirus tasks in a computer
CN111343181B (en) Message processing method and system, data pool and computer readable storage medium
US20230297348A1 (en) Method for operating second system application on first system, terminal device and storage medium
US20060161896A1 (en) Performing debug requests that are within the debug domain of a class loader
CN111538659B (en) Interface testing method, system, electronic equipment and storage medium of business scene
CN115686540A (en) RPA control method and system based on Hongmong system
WO2015057816A1 (en) Method and system for adaptive loading of application
CN114895935A (en) Method and device for flashing vehicle ECU, electronic equipment and storage medium
US20040172407A1 (en) Method and system of processing an encapsulated file at a management computer
CA2416304C (en) System and method of verifying the authenticity of dynamically connectable executable images
CN114356779A (en) Programming language debugging method and device and terminal equipment
US20020144018A1 (en) Method and system for interfacing to pre-existing software code
US7571231B2 (en) Method and protocol for mediating communication between software applications
WO2023208012A1 (en) Program processing method and apparatus, program running method and apparatus, terminal, smart card and storage medium
CN111259042B (en) Dynamic query method and system
CN117056904A (en) Application privacy compliance judging method, device, computer equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination