Test method and device, equipment and storage medium

The automation of interface testing between blockchain networks through version-matched deployment and adjustment addresses the challenge of ensuring compatibility and accuracy in testing, improving efficiency and reliability.

CN119179633APending Publication Date: 2024-12-24TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310744868.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-21
Publication Date
2024-12-24

AI Technical Summary

Technical Problem

The challenge of efficiently testing the interface compatibility between blockchain main chain networks and side chain networks, particularly in ensuring accurate and reliable results across different versions, has not been adequately addressed in existing technologies.

Method used

A method and apparatus for automating interface testing between blockchain networks, involving deployment in a test environment, routing test cases, and performing version matching to ensure compatibility, including network and contract version adjustments as needed.

Benefits of technology

This approach enhances testing efficiency and accuracy by reducing manual parameter comparison time and minimizing the impact of version discrepancies, leading to more reliable test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119179633A_ABST
    Figure CN119179633A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a test method and device, equipment and a storage medium. The method comprises the steps that a block chain main chain network and a block chain side chain network are deployed in a test environment; the test case is routed to a block chain main chain network and a block chain side chain network, first response information of the block chain main chain network for the test case is acquired, and second response information of the block chain side chain network for the test case is acquired; if the first response information is not matched with the second response information, performing version matching processing on the block chain main chain network and the block chain side chain network; acquiring third response information of the block chain main chain network after version matching processing for the test case, and acquiring fourth response information of the block chain side chain network after version matching processing for the test case; and determining an interface test result according to the third response information and the fourth response information. By adopting the method and the device, the accuracy and the reliability of interface compatibility testing between block chain networks can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a testing method, a testing apparatus, a computer device, and a computer-readable storage medium. Background Art

[0002] With the development of blockchain technology, blockchain applications are becoming more and more widespread. With the help of a decentralized application platform based on blockchain (which can be called the blockchain main chain network), developers can develop various applications on this system to create more decentralized tools and technologies. Based on this, many self-developed blockchains (which can be called blockchain side chain networks) have the need to be compatible with the standard interface of the blockchain main chain network so that they can access the data of the blockchain main chain network. Before these self-developed blockchain side chain networks are officially released and launched, it is often necessary to test the interface between the blockchain main chain network and the blockchain side chain network to discover and locate problems in the blockchain side chain network. Therefore, how to test the interface between the blockchain main chain network and the blockchain side chain network is a technical issue worthy of study. Summary of the invention

[0003] The embodiments of the present application provide a testing method, apparatus, device and storage medium, which can realize the automation of interface testing between the blockchain main chain network and the blockchain side chain network, which is conducive to improving the testing efficiency. At the same time, during the testing process, the two blockchain networks can be automatically matched in version, covering different versions of the blockchain networks, which is conducive to improving the accuracy and reliability of the test results.

[0004] On the one hand, an embodiment of the present application provides a testing method, which includes: deploying a blockchain main chain network and a blockchain side chain network in a test environment, and routing test cases to the blockchain main chain network and the blockchain side chain network respectively; wherein the test case is used to test the interface between the blockchain main chain network and the blockchain side chain network; obtaining first response information of the blockchain main chain network for the test case, and obtaining second response information of the blockchain side chain network for the test case; if the first response information does not match the second response information, performing version matching processing on the blockchain main chain network and the blockchain side chain network; obtaining third response information of the blockchain main chain network after version matching processing for the test case, and obtaining fourth response information of the blockchain side chain network after version matching processing for the test case; determining an interface test result according to the third response information and the fourth response information; wherein the interface test result is used to indicate whether the interface between the blockchain main chain network after version matching processing and the blockchain side chain network after version matching processing is compatible.

[0005] On the one hand, an embodiment of the present application provides a testing device, which includes: a processing unit, which is used to deploy a blockchain main chain network and a blockchain side chain network in a test environment, and route test cases to the blockchain main chain network and the blockchain side chain network respectively; wherein the test case is used to test the interface between the blockchain main chain network and the blockchain side chain network; an acquisition unit, which is used to obtain first response information of the blockchain main chain network for the test case, and obtain second response information of the blockchain side chain network for the test case; the processing unit is also used to perform version matching processing on the blockchain main chain network and the blockchain side chain network if the first response information does not match the second response information; the acquisition unit is also used to obtain third response information of the blockchain main chain network for the test case after version matching processing, and obtain fourth response information of the blockchain side chain network for the test case after version matching processing; the processing unit is also used to determine the interface test result according to the third response information and the fourth response information; wherein the interface test result is used to indicate whether the interface between the blockchain main chain network after version matching processing and the blockchain side chain network after version matching processing is compatible.

[0006] In some embodiments, the processing unit is also used to perform network version upgrade processing on the blockchain sidechain network if the network version of the blockchain main chain network is higher than the network version of the blockchain sidechain network, and the network version of the blockchain sidechain network after the upgrade matches the network version of the blockchain main chain network; if the network version of the blockchain main chain network is lower than the network version of the blockchain sidechain network, the blockchain sidechain network performs network version rollback processing, and the network version of the blockchain sidechain network after the rollback processing matches the network version of the blockchain main chain network.

[0007] In some embodiments, the above-mentioned test case is a contract call case, and the processing unit is also used to, if the contract version of the smart contract called by the blockchain main chain network execution contract call case is higher than the contract version of the smart contract called by the blockchain side chain network execution contract call case, then perform contract version upgrade processing on the smart contract called by the blockchain side chain network execution contract call case, and the contract version of the smart contract called by the blockchain side chain network execution contract call case after the upgrade processing matches the contract version of the smart contract called by the blockchain main chain network execution contract call case; if the contract version of the smart contract called by the blockchain main chain network execution contract call case is lower than the contract version of the smart contract called by the blockchain side chain network execution contract call case, then perform contract version rollback processing on the smart contract called by the blockchain side chain network execution contract call case, and the contract version of the smart contract called by the blockchain side chain network execution contract call case after the rollback processing matches the contract version of the smart contract called by the blockchain main chain network execution contract call case.

[0008] In some embodiments, the above-mentioned test case is a contract call case, and the first response information includes: the first contract call data obtained from the blockchain main chain network by executing the contract call case, and the second response information includes: the second contract call data obtained from the blockchain side chain network by executing the contract call case; the processing unit is also used to determine that the first response information matches the second response information if the first contract call data is consistent with the second contract call data; if the first contract call data is inconsistent with the second contract call data, determine that the first response information does not match the second response information.

[0009] In some embodiments, the above-mentioned test case is a data query case, and the first response information includes: the first query data queried from the blockchain main chain network by executing the data query case, and the second response information includes: the second query data queried from the blockchain side chain network by executing the data query case; the processing unit is also used to compare the first query data with the second query data to obtain a comparison result; if the comparison result indicates that the first query data is consistent with the second query data, it is determined that the first response information matches the second response information; if the comparison result indicates that the first query data is inconsistent with the second query data, it is determined that the first response information does not match the second response information.

[0010] In some embodiments, the first query data includes: a first field and a field type of the first field, and the second query data includes: a second field and a field type of the second field; the processing unit is also used to compare the first field with the second field, and to compare the field type of the first field with the field type of the second field; if the first field is consistent with the second field, and the field type of the first field is consistent with the field type of the second field, then the comparison result is determined to be a first comparison result, and the first comparison result indicates that the first query data is consistent with the second query data; if the first field is inconsistent with the second field, or the field type of the first field is inconsistent with the field type of the second field, then the comparison result is determined to be a second comparison result, and the second comparison result indicates that the first query data is inconsistent with the second query data.

[0011] In some embodiments, the above-mentioned test case is a data call case, and the first response information includes: the call data obtained from the blockchain main chain network by executing the data call case, and the second response information includes: the data call request generated by executing the data call case; the processing unit is also used to determine whether the call data included in the first response information is the data requested to be called by the data call request; if the call data included in the first response information is the data requested to be called by the data call request, it is determined that the first response information matches the second response information; if the call data included in the first response information is not the data requested to be called by the data call request, it is determined that the first response information does not match the second response information.

[0012] In some embodiments, the processing unit is also used to determine that the interface test result is a target interface test result if the first response information matches the second response information, and the target interface test result indicates that the interface between the blockchain main chain network and the blockchain side chain network is compatible.

[0013] Correspondingly, an embodiment of the present application also provides a computer device, including: a processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are interconnected, wherein the memory stores executable program code, and the processor is used to call the executable program code to implement the test method provided in the embodiment of the present application.

[0014] Accordingly, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the test method provided in the embodiment of the present application is implemented.

[0015] Accordingly, an embodiment of the present application further provides a computer program product, which includes a computer program or computer instructions, and when the computer program or computer instructions are executed by a processor, the test method provided in the embodiment of the present application is implemented.

[0016] Accordingly, an embodiment of the present application provides a computer program, which includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the test method provided in the embodiment of the present application.

[0017] By implementing the embodiment of the present application, on the one hand, the test cases for testing the interface between the blockchain main chain network and the blockchain side chain network can be routed to the blockchain main chain network and the blockchain side chain network respectively, so as to realize the automation of interface testing. On the one hand, when the first response information and the second response of the two blockchain networks do not match, the two blockchain networks can be processed for version matching to reduce the impact of network version problems on the interface test results. Then, the third response information and the fourth response information of the two blockchain networks after the version matching processing are obtained, and the interface test results are determined according to the third response information and the fourth response information to realize the real-time comparison of the response information between the blockchain main chain network and the blockchain side chain network. In this way, the time cost of manually comparing parameters during the test process can be reduced, and the test efficiency can be improved. At the same time, the impact of network version problems on the interface test results can also be reduced during the test process, and the response information of the two blockchain networks can be compared in real time, which is conducive to improving the accuracy and reliability of the test results. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 It is a structural diagram of a blockchain system provided by an embodiment of the present application;

[0020] Figure 2 This is a schematic diagram of the structure of a blockchain provided by an embodiment of the present application;

[0021] Figure 3 This is a schematic diagram of a block generation process provided by an embodiment of the present application;

[0022] Figure 4 It is a schematic diagram of the architecture of a test system provided in an embodiment of the present application;

[0023] Figure 5 It is a flow chart of a testing method provided in an embodiment of the present application;

[0024] Figure 6 It is a flow chart of routing a test case to a blockchain network provided by an embodiment of the present application;

[0025] Figure 7 It is a schematic diagram of a data query execution use case provided in an embodiment of the present application;

[0026] Figure 8 It is a flow chart of another testing method provided in an embodiment of the present application;

[0027] Fig. 9 It is a structural schematic diagram of a test device provided in an embodiment of the present application;

[0028] Fig.10 is a structural schematic diagram of a testing device provided in an embodiment of the present application;

[0029] Fig.11 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0031] In order to better understand the solutions of the embodiments of the present application, the relevant terms and concepts that may be involved in the embodiments of the present application are first introduced below.

[0032] Smart contract: A computer protocol designed to disseminate, verify or execute contracts in an information-based manner, allowing trusted transactions without a third party, and these transactions are locatable and cannot be tampered with.

[0033] Solidity: It is a high-level language for smart contracts. After writing smart contracts, it can generate bytecodes that can be executed on EVM (virtual machine). EVM is the environment for executing smart contracts.

[0034] Geth: It is client software written in Go language and implements the Ethereum protocol.

[0035] Web3.js: is a javascript (a programming language) library that communicates with nodes in the local blockchain main chain network through RPC (Remote Procedure Call). web3.js can connect and communicate with nodes in any blockchain main chain network that exposes the RPC interface.

[0036] Web3.py: is a Python (another programming language) library that communicates with nodes in the blockchain main chain network through RPC calls.

[0037] REQ: Software development and testing process management platform, manages the entire life cycle of software version development, testing, defect submission, regression testing, and release.

[0038] Layer2: The second-layer network of the blockchain main chain network. In order to solve the problems of high transaction fees and low performance of the blockchain main chain network, the second-layer chain needs to be compatible with the standard interface of the blockchain main chain network.

[0039] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0040] The underlying blockchain platform can include object management, basic services, smart contracts, and operation monitoring processing modules. Among them, the object management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the correspondence between the object's real identity and the blockchain address (authority management), etc., and, under authorization, supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records valid requests to storage after consensus is reached. For a new business request, the basic service first performs interface adaptation analysis and authentication processing (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the key or other events are called to trigger the execution and complete the contract logic. It also provides the function of contract upgrade and cancellation. The operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarm, network status monitoring, node equipment health status monitoring, etc.

[0041] The platform product service layer provides the basic capabilities and implementation framework of typical applications. Developers can superimpose business features based on these basic capabilities to complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.

[0042] See also Figure 1 , Figure 1It is a structural diagram of a blockchain system provided by an embodiment of the present application. Blockchain system 100 refers to a system for sharing data between nodes, and the blockchain system may include multiple nodes 101, and multiple nodes 101 may refer to various clients in the blockchain system. Each node 101 can receive input information when performing normal work, and maintain the shared data in the blockchain system based on the received input information. In order to ensure the intercommunication of information in the blockchain system, there may be an information connection between each node in the blockchain system, and information can be transmitted between nodes through the above information connection. For example, when any node in the blockchain system receives input information, other nodes in the blockchain system obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all nodes in the blockchain system are consistent.

[0043] Each node in the blockchain system has a corresponding node identifier, and each node in the blockchain system can store the node identifiers of other nodes in the blockchain system, so that the generated blocks can be broadcast to other nodes in the blockchain system according to the node identifiers of other nodes. Each node can maintain a node identifier list as shown in the following table, and store the node name and node identifier in the node identifier list accordingly. Among them, the node identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address and any other information that can be used to identify the node. Table 1 only uses the IP address as an example for illustration.

[0044] Table 1

[0045] Node Name Node ID Node 1 117.114.151.174 Node 2 117.116.189.145 … … Node N 119.123.789.258

[0046] Each node in the blockchain system stores the same blockchain. The blockchain consists of multiple blocks, see Figure 2 , Figure 2 It is a structural schematic diagram of a blockchain provided by an embodiment of the present application. The blockchain is composed of multiple blocks. The genesis block includes a block header and a block body. The block header stores input information feature values, version numbers, timestamps and difficulty values, and the block body stores input information. The next block of the genesis block uses the genesis block as a parent block. The next block also includes a block header and a block body. The block header stores input information feature values ​​of the current block, block header feature values, version numbers, timestamps and difficulty values ​​of the parent block, and so on, so that the block data stored in each block in the blockchain are associated with the block data stored in the parent block, thereby ensuring the security of the input information in the block.

[0047] When generating each block in the blockchain, see Figure 3 , Figure 3This is a flow chart of a block generation process provided by an embodiment of the present application. When the node where the blockchain is located receives the input information, it verifies the input information. After the verification is completed, the input information is stored in the memory pool, and the hash tree used to record the input information is updated; then, the update timestamp is updated to the time when the input information is received, and different random numbers are tried, and the characteristic value calculation is performed multiple times, so that the calculated characteristic value can satisfy the following formula:

[0048] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) <TARGET

[0049] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, which can be determined based on nbits.

[0050] In this way, when the random number that satisfies the above formula is calculated, the information can be stored accordingly, the block header and block body can be generated, and the current block can be obtained. Subsequently, the node where the blockchain is located sends the newly generated block to other nodes in the data sharing system according to the node identification of other nodes in the data sharing system. Other nodes verify the newly generated block and add the newly generated block to the blockchain stored in them after the verification is completed.

[0051] For a credible blockchain, its storage space is limited and its processing power is also limited. When the number of blocks continues to increase, it is usually possible to expand the blockchain to improve the throughput and other performance of the blockchain. In the embodiment of the present application, the first-layer blockchain network is called the main chain blockchain network, and the second-layer blockchain network that expands the first-layer blockchain network is called the blockchain side chain network.

[0052] With the rapid development of blockchain applications such as DeFi (Decentralized Finance), NFT (Non-Fungible Token), and games, the transaction demand for the blockchain main chain network is also growing. Due to the limited number of transactions that the blockchain main chain network can process per second, network congestion and high transaction fees occur. In order to solve this problem, some developers have begun to build blockchain side chain networks that are compatible with the blockchain main chain network. These blockchain side chain networks have lower transaction costs and faster settlement speeds. After the developer builds the blockchain side chain network, the test method provided in the embodiment of the present application can be used to test the interface between the blockchain main chain network and the blockchain side chain network to determine whether the interface between the blockchain main chain network and the blockchain side chain network is compatible.

[0053] See also Figure 4 , Figure 4 Schematic diagram of the architecture of a test system provided in an embodiment of the present application. Figure 4 As shown, the test system includes a test device 401, a blockchain main chain network 402 and a blockchain side chain network 403. It can be understood that Figure 4 Taking the example of the test device being a computer device independent of the blockchain main chain network and the blockchain side chain network, in other feasible embodiments, the test device may also be a node device in the blockchain main chain network or the blockchain side chain network, and the embodiments of the present application are not limited to this.

[0054] Specifically, the test equipment can route the test case to the blockchain main chain network and the blockchain side chain network respectively, and then obtain the first response information of the blockchain main chain network for the test case, and obtain the second response information of the blockchain side chain network for the test case. In the case where the first response information does not match the second response information, the blockchain main chain network and the blockchain side chain network can also be processed for version matching, and then the third response information of the blockchain main chain network after the version matching processing for the test case is obtained, and the fourth response information of the blockchain side chain network after the version matching processing for the test case is obtained. Finally, the interface test result between the blockchain main chain network and the blockchain side chain network is determined according to the third response information and the fourth response information to determine whether the blockchain main chain network and the blockchain side chain network are compatible. In this way, the automation of the interface compatibility test between the blockchain main chain network and the blockchain side chain network can be realized, which is conducive to improving the accuracy and efficiency of the test.

[0055] See also Figure 5 , Figure 5 is a flow chart of a test method provided in an embodiment of the present application, and the test method can be executed by a test device. Figure 5As shown, the test method may include but is not limited to the following steps:

[0056] S501, deploy the blockchain main chain network and blockchain side chain network in the test environment.

[0057] The test environment can be understood as a running environment used for testing. By using the test environment, the formal environment can be simulated. In other words, a new environment with the same functions as the formal environment can be deployed in the test environment to achieve the purpose of testing new functions.

[0058] In some embodiments, the test environment may include different sub-environments, and the way to deploy the blockchain main chain network and the blockchain side chain network in the test environment may be to deploy the blockchain main chain network in the first sub-environment and the blockchain side chain network in the second sub-environment. The test environment constructed in this way can be used to test whether the blockchain main chain network and the blockchain side chain network are compatible. Here, the blockchain side chain network compatible with the blockchain main chain network can enjoy the ecology of the blockchain main chain network, for example, projects (such as NFT projects) that can use the blockchain main chain network, the protocols of the blockchain main chain network, etc. The relationship between the blockchain main chain network and the blockchain side chain network compatible with the blockchain main chain network can be understood as a parallel relationship, that is, requests that can be sent to the blockchain main chain network can also be sent to the blockchain side chain network compatible with the blockchain main chain network.

[0059] S502, routing the test cases to the blockchain main chain network and the blockchain side chain network respectively.

[0060] Among them, the test case can be used to test the interface between the blockchain main chain network and the blockchain side chain network. The native ecology of the blockchain main chain network can usually include multiple application programming interfaces (Application Programming Interface, API), for example, it can include contract interfaces, transaction interfaces, block interfaces, etc. The blockchain side chain network needs to be compatible with the various interfaces of the blockchain main chain network. The test case can be an interface test case written based on each interface, for example, it can include request information constructed for testing each interface. Optionally, the test device can route the test case to two blockchain networks at the same time, or it can route the test case to two blockchain networks one after another. For example, the test case is first routed to the blockchain main chain network, and then the test case is routed to the blockchain side chain network, or, the test case is first routed to the blockchain side chain network, and then the test case is routed to the blockchain main chain network.

[0061] In some embodiments, after the test case is routed to the blockchain main chain network and the blockchain side chain network respectively, it can be triggered to send request information to the blockchain main chain network and the blockchain side chain network respectively, for example, the Web3.py software development kit (Software Development Kit, SDK) of python (a programming language) can be used as a package sending tool for sending request information to the blockchain main chain network and the blockchain side chain network. Of course, the SDK of other programming languages ​​can also be used as a package sending tool for sending request information to the blockchain main chain network and the blockchain side chain network, and the embodiment of the present application is not limited to this. It is understandable that before the test case is routed to the blockchain main chain network and the blockchain side chain network respectively, it is necessary to establish a connection with the blockchain main chain network and the blockchain side chain network respectively. For example, the process of connecting to the blockchain main chain network can be: w3 = Web3 (Web3.HTTPProvider ('http: / / xx.xx.xx.xx:7545', request_kwargs = {'timeout':60})); the process of connecting to the blockchain side chain network can be: w3 = Web3 (Web3.HTTPProvider ('http: / / 9.134.xx.xx:5566', request_kwargs = {'timeout':60})). Among them, HTTPProvider can provide the address to be connected.

[0062] In some embodiments, by designing different test cases, different request information can be triggered to be sent to the blockchain main chain network and the blockchain side chain network, thereby testing different interfaces. Exemplarily, by routing test case A to the blockchain main chain network and the blockchain side chain network, for example, a transaction request can be triggered to be sent to the blockchain main chain network and the blockchain side chain network, respectively, to test the interface (such as Eth_send_transaction) for sending transactions between the blockchain main chain network and the blockchain side chain network; by routing test case B to the blockchain main chain network and the blockchain side chain network, for example, a balance query request can be triggered to be sent to the blockchain main chain network and the blockchain side chain network, respectively, to test the interface (such as Eth_get_bala nce) for querying the balance between the blockchain main chain network and the blockchain side chain network.

[0063] In some embodiments, the version of the blockchain main chain network can be periodically detected to determine whether there is an upgraded version of the blockchain main chain network. If there is an upgraded version of the blockchain main chain network, the blockchain main chain network can be automatically upgraded, and the interface between the upgraded blockchain main chain network and the blockchain side chain network can be tested by routing the test cases to the upgraded blockchain main chain network and the blockchain side chain network respectively, to verify the interface compatibility between the blockchain side chain network and different versions of the blockchain main chain network. With the development of blockchain technology, the version of the blockchain main chain network has been continuously upgraded. By automatically upgrading the version of the blockchain main chain network, the interface compatibility between each version of the blockchain main chain network and the blockchain side chain network can be tested in time. Compared with the traditional test of the interface between the blockchain main chain network and the blockchain side chain network, it is necessary to compare with the standard blockchain main chain network interface document. This method is more adaptable to the timeliness of the upgraded version of the blockchain main chain network, covers different versions of the blockchain main chain network, and is conducive to improving the accuracy and efficiency of the test.

[0064] The following is a specific example to illustrate the process of routing the test case to the blockchain main chain network and the blockchain side chain network. Figure 6 , Figure 6 This is a flow chart of routing a test case to a blockchain network provided by an embodiment of the present application. Figure 6 As shown, the entire test process can be divided into three stages: test startup, test execution, and test assertion. In the test execution stage, the test cases can be routed to the blockchain main chain network and the blockchain side chain network respectively. Among them, different test cases can be used to test different interfaces (such as contract interfaces, transaction interfaces, and block interfaces, etc.). After routing the test cases to the blockchain main chain network and the blockchain side chain network respectively, the contract data, transactions, blocks, etc. generated by executing the test cases can be stored in the blockchain main chain network and the blockchain side chain network. In the case that there is an upgraded version of the blockchain main chain network, the blockchain main chain network can be upgraded, and the test cases can be routed to the upgraded blockchain main chain network, and then the contract data, transactions, blocks, etc. generated by executing the test cases can be stored in the upgraded blockchain main chain network.

[0065] S503, obtaining the first response information of the blockchain main chain network for the test case, and obtaining the second response information of the blockchain side chain network for the test case.

[0066] In the embodiment of the present application, after routing the test case to the blockchain main chain network, the first response information of the blockchain main chain network for the test case can be obtained. Similarly, after routing the test case to the blockchain side chain network, the second response information of the blockchain side chain network for the test case can be obtained. It is understandable that for different test cases, the blockchain main chain network and the blockchain side chain network can return different response information.

[0067] In some embodiments, the test case may be a contract call case, and the first response information for the contract call case may include: the first contract call data obtained from the blockchain main chain network by executing the contract call case; the second response information for the contract call case may include: the second contract call data obtained from the blockchain side chain network by executing the contract call case. Among them, the contract call case can be used to request to call a smart contract in the blockchain network. Smart contracts may include code and data, for example, variables and corresponding contract methods, and corresponding functions may be implemented by executing the contract method. The first contract call data can be understood as the first contract execution result obtained by the blockchain main chain network by calling the smart contract and executing the contract method, and the second contract call data can be understood as the second contract execution result obtained by the blockchain side chain network by calling the smart contract and executing the contract method.

[0068] In some embodiments, the test case may be a data query case, and the first response information for the data query case may include: the first query data queried from the blockchain main chain network by executing the data query case; the second response information for the data query case may include: the second query data queried from the blockchain side chain network by executing the data query case. For example, the data query case may be a test case for the balance query interface (get_balance), and by executing the test case for the balance query interface, the blockchain main chain network and the blockchain side chain network may be requested to perform balance queries respectively, that is, the query requests are forwarded to the blockchain main chain network and the blockchain side chain network respectively. Correspondingly, the first query data can be obtained from the blockchain main chain network, and the second query data can be obtained from the blockchain side chain network. Figure 7 In the example shown, the first query data obtained from the blockchain main chain network includes the account balance: 6999999999801877777, and the first query data obtained from the blockchain side chain network ( Figure 7 The second query data obtained by TrustSQL includes the account balance: 6999999999801877777. It can be seen that the first query data obtained from the blockchain main chain network is consistent with the second query data obtained from the blockchain side chain network.

[0069] In some embodiments, the test case may also be a data call case, and the first response information for the data call case may include: the call data obtained from the blockchain main chain network by executing the data call case; the second response information for the data call case may include: the data call request generated by the blockchain side chain network by executing the data call case. By executing the data call case, it can be tested whether the blockchain side chain network can successfully obtain the call data from the blockchain main chain network. In some other embodiments, the data call case can also be used to test whether the blockchain main chain network can successfully obtain the call data from the blockchain side chain network. In this case, the first response information for the data call case may include: the data call request generated by the blockchain main chain network by executing the data call case; the second response information for the data call case may include: the call data obtained from the blockchain side chain network by executing the data call case. In other words, the data call case can be used to test whether the blockchain main chain network and the blockchain side chain network can successfully perform data calls, that is, it can be used to test whether the blockchain main chain network and the blockchain side chain network have interoperability.

[0070] In some embodiments, the test case may also be a test case for testing other interfaces between the blockchain main chain network and the blockchain side chain network. Exemplarily, as shown in Table 2, the interface between the blockchain main chain network and the blockchain side chain network may include:

[0071] Table 2

[0072]

[0073]

[0074] Among them, eth_getBlockByHash queries the block based on the hash. The test cases used to test the eth_getBlockByHash interface are routed to the blockchain main chain network and the blockchain side chain network respectively, and the data of the block with the specified hash returned by the blockchain main chain network and the blockchain side chain network can be obtained respectively. eth_getBlockByNumber queries the block based on the block height. The test cases used to test the eth_getBlockByNumber interface are routed to the blockchain main chain network and the blockchain side chain network respectively, and the data of the block with the specified block height returned by the blockchain main chain network and the blockchain side chain network can be obtained respectively.

[0075] S504: If the first response information does not match the second response information, version matching is performed on the blockchain main chain network and the blockchain side chain network.

[0076] The reason why the first response information does not match the second response information may be that the network version of the blockchain main chain network does not match the network version of the blockchain side chain network, or the interface of the blockchain main chain network does not match the interface of the blockchain side chain network (i.e., the interface is incompatible). In order to avoid the impact of the network versions of the two blockchain networks on the interface test results, version matching can be performed on the blockchain main chain network and the blockchain side chain network.

[0077] In some embodiments, the version matching process for the blockchain main chain network and the blockchain side chain network may be performed by comparing the network version of the blockchain main chain network with the network version of the blockchain side chain network to obtain a network version comparison result. If the network version comparison result indicates that the network version of the blockchain main chain network is higher than the network version of the blockchain side chain network, then the blockchain side chain network may be subjected to a network version upgrade process, and the network version of the blockchain side chain network after the upgrade process matches the network version of the blockchain main chain network. If the network version comparison result indicates that the network version of the blockchain main chain network is lower than the network version of the blockchain side chain network, then the blockchain side chain network may be subjected to a network version rollback process, and the network version of the blockchain side chain network after the rollback process matches the network version of the blockchain main chain network. For example, assuming that the first response information does not match the second response information, the network version of the blockchain main chain network is version v2, and the network version of the blockchain side chain network is version v1. Then the blockchain side chain network may be subjected to a network version upgrade process, that is, the network version of the blockchain side chain network is upgraded from version v1 to version v2. For example, if the network version of the blockchain main chain network is v1, and the network version of the blockchain side chain network is v2, then the network version of the blockchain side chain network can be rolled back, that is, the network version of the blockchain side chain network can be rolled back from v2 to v1. In this way, the network version upgrade and rollback of the blockchain network can be automated, covering different network versions, which is conducive to improving the comprehensiveness of the test.

[0078] In some embodiments, for the case where the test case is a contract call case, the reason why the first response information and the second response information do not match may also be that the contract version of the smart contract called by the blockchain main chain network to execute the contract call case does not match the contract version of the smart contract called by the blockchain side chain network to execute the contract call case. In this case, the way to perform version matching processing on the blockchain main chain network and the blockchain side chain network can also be to obtain a contract version comparison result by comparing the contract version of the smart contract called by the blockchain main chain network to execute the contract call case and the contract version of the smart contract called by the blockchain side chain network to execute the contract call case. If the contract version comparison result indicates that the contract version of the blockchain main chain network is higher than the contract version of the blockchain side chain network, the smart contract called by the blockchain side chain network to execute the contract call case is upgraded, and the contract version of the blockchain side chain network after the upgrade is matched with the contract version of the blockchain main chain network. Accordingly, if the contract version comparison result indicates that the contract version of the blockchain main chain network is lower than the contract version of the blockchain side chain network, the smart contract called by the blockchain side chain network execution contract call use case is rolled back, and the contract version of the blockchain side chain network after the rollback process matches the contract version of the blockchain main chain network. In this way, the different contract versions of the smart contracts of the two blockchain networks can be avoided, which will affect the interface test results and help improve the reliability of the interface test results.

[0079] In some embodiments, for different test cases, the way of judging whether the first response information and the second response information match is different. When the test case is a contract call case, the first response information may include the first contract call data obtained from the blockchain main chain network by executing the contract call case, and the second response information may include the second contract call data obtained from the blockchain side chain network by executing the contract call case. If the first contract call data is consistent with the second contract call data, it can be determined that the first response information matches the second response information; if the first contract call data is inconsistent with the second contract call data, it can be determined that the first response information does not match the second response information. It can be understood that if the first execution result obtained by calling the smart contract of the blockchain main chain network by executing the contract call case is the same as the second execution result obtained by calling the smart contract of the blockchain side chain network, it can be indicated that the smart contract of the blockchain main chain network matches the smart contract of the blockchain side chain network.

[0080] When the test case is a data query case, the first response information may include the first query data queried from the blockchain main chain network by executing the data query case, and the second response information may include the second query data queried from the blockchain side chain network by executing the data query case. A method for determining whether the first response information and the second response information match may be to compare the first query data with the second query data to obtain a comparison result; if the comparison result indicates that the first query data is consistent with the second query data, it can be determined that the first response information matches the second response information; if the comparison result indicates that the first query data is inconsistent with the second query data, it can be determined that the first response information does not match the second response information. For example, Figure 7 As shown, the comparison result of the first query data (account balance: 6999999999801877777) obtained from the blockchain main chain network and the second query data (account balance: 6999999999801877777) obtained from the blockchain side chain network is consistent, so it can be determined that the first response information matches the second response information.

[0081] In some embodiments, the first query data may include a first field and a field type of the first field, and the second query data may include a second field and a field type of the second field. Comparing the first query data with the second query data to obtain a comparison result may include: comparing the first field with the second field, and comparing the field type of the first field with the field type of the second field; if the first field is consistent with the second field, the field type of the first field is consistent with the field type of the second field, the comparison result may be determined to be the first comparison result; if the first field is inconsistent with the second field, or the field type of the first field is inconsistent with the field type of the second field, the comparison result may be determined to be the second comparison result. Among them, the first comparison result may indicate that the first query data is consistent with the second query data, and the second comparison result may indicate that the first query data is inconsistent with the second query data. That is, the blockchain main chain network and the blockchain side chain network return the same field content for an interface, and the field type is also the same (such as both are int types). It can be considered that the interface between the blockchain main chain network and the blockchain side chain network matches, that is, it has compatibility.

[0082] When the test case is a data call case, the first response information may include the call data obtained from the blockchain main chain network by executing the data call case, and the second response information may include the data call request generated by the blockchain side chain network by executing the data call case. The way to determine whether the first response information and the second response information match can be to determine whether the call data is the data requested to be called by the data call request; if the call data is the data requested to be called by the data call request, it can be determined that the first response information matches the second response information; if the call data is not the data requested to be called by the call request, it can be determined that the first response information does not match the second response information. Exemplarily, assuming that the data call case is used to test whether the blockchain side chain network can successfully obtain call data from the blockchain main chain network, if the first response information includes call data A, and the second response information includes a data call request requesting to call data A, then it can be determined that the call data is the data requested to be called by the data call request, that is, the first response information and the second response information match.

[0083] In some embodiments, if the first response information matches the second response information, it can be determined that the interface test result between the blockchain main chain network and the blockchain side chain network is the target interface test result, and the target interface test result can indicate that the interface between the blockchain main chain network and the blockchain side chain network is compatible. If the first response information does not match the second response information, it is necessary to further determine whether the interface between the blockchain main chain network and the blockchain side chain network after the version matching process is compatible.

[0084] S505, obtain the third response information of the blockchain main chain network for the test case after version matching processing, and obtain the fourth response information of the blockchain side chain network for the test case after version matching processing.

[0085] Here, the specific implementation process of step S505 is similar to that of step S503. Please refer to the relevant instructions in step S503, which will not be repeated here.

[0086] It should be noted that the test case in step S505 and the test case in step S503 may be the same test case or different test cases. After the blockchain main chain network and the blockchain side chain network are processed for version matching, the test parameters used in the test case may change. In this case, the test case after the blockchain main chain network and the blockchain side chain network are processed for version matching may be different from the test case before the blockchain main chain network and the blockchain side chain network are processed for version matching.

[0087] S506: Determine an interface test result according to the third response information and the fourth response information.

[0088] In the embodiment of the present application, after obtaining the third response information of the blockchain main chain network after version matching processing for the test case and the fourth response information of the blockchain side chain network after version matching processing for the test case, the interface test result can be determined according to the third response information and the fourth response information. Among them, the interface test result is used to indicate whether the interface between the blockchain main chain network after version matching processing and the blockchain side chain network after version matching processing is compatible.

[0089] Specifically, if the third response information matches the fourth response information, then it can be determined that the interface test result between the blockchain main chain network after version matching and the blockchain side chain network after version matching is the first interface test result; if the third response information does not match the fourth response information, then it can be determined that the interface test result between the blockchain main chain network after version matching and the blockchain side chain network after version matching is the second interface test result. Among them, the first interface test result can be used to indicate that the interface between the blockchain main chain network after version matching and the blockchain side chain network after version matching is compatible; the second interface test result can be used to indicate that the interface between the blockchain main chain network after version matching and the blockchain side chain network after version matching is not compatible.

[0090] In some embodiments, when the interface test result is the second interface test result, it means that there is an interface incompatibility between the blockchain main chain network after version matching and the blockchain side chain network after version matching. At this time, the corresponding interface in the blockchain side chain network can be located according to the test case, and then the interface adjustment processing is performed on the corresponding interface in the blockchain side chain network. For example, if the interface test result of the test case for testing interface A is the second interface test result, then the anomaly can be located to interface A in the blockchain side chain network, and interface adjustment processing is performed on interface A in the blockchain side chain network, so that interface A between the blockchain side chain network and the blockchain main chain network can be compatible.

[0091] In some embodiments, the test case may be a scenario test case, and the scenario test case may be composed of multiple interface test cases combined in sequence. For example, scenario test case A may be interface test case a->interface test case b->interface test case c. For the scenario test case, the test result of the scenario test case may be determined based on the interface test results of each interface test case. If the interface test results of each interface test case included in the scenario test case are all first interface test results, it can be determined that the interface between the blockchain main chain network and the blockchain side chain network in this scenario is compatible; if there is a second interface test result in the interface test results of each interface test case included in the scenario test case, it can be determined that the interface between the blockchain main chain network and the blockchain side chain network in this scenario is not compatible.

[0092] By implementing the embodiment of the present application, on the one hand, the test cases for testing the interface between the blockchain main chain network and the blockchain side chain network can be routed to the blockchain main chain network and the blockchain side chain network respectively, so as to realize the automation of interface testing. On the one hand, when the first response information and the second response of the two blockchain networks do not match, the two blockchain networks can be processed for version matching to reduce the impact of network version problems on the interface test results. Then, the third response information and the fourth response information of the two blockchain networks after the version matching processing are obtained, and the interface test results are determined according to the third response information and the fourth response information to realize the real-time comparison of the response information between the blockchain main chain network and the blockchain side chain network. In this way, the time cost of manually comparing parameters during the test process can be reduced, and the test efficiency can be improved. At the same time, different versions of the blockchain network can be covered during the test process, and the response information of the two blockchain networks can be compared in real time, which is conducive to improving the accuracy and reliability of the test results.

[0093] The following describes the test method provided in the embodiment of the present application in combination with a specific application scenario. Figure 8 , Figure 8 FIG. 1 is a flow chart of another test method provided in an embodiment of the present application, and the test method can be executed by a test device. Figure 8 As shown, the entire testing process can include three stages: development, testing, and release.

[0094] During the development phase, developers can develop blockchain sidechain networks, and then submit the blockchain sidechain networks for testing to the REQ (software development testing process management platform) platform, which will distribute the testing tasks. In addition, during the development phase, after the REQ platform distributes the testing tasks, it can also conduct an audit. If the audit is passed, the testing process can be directly entered. Optionally, if the audit fails, a prompt message indicating that the audit has failed can be output, and the testing process can be exited.

[0095] During the testing phase, the test equipment can first deploy the blockchain main chain network and the blockchain side chain network in the test environment. Here, the blockchain main chain network can be deployed in the first sub-environment, and the blockchain side chain network can be deployed in the second sub-environment. The first sub-environment and the second sub-environment can be two different environments. Then the test cases are routed to the blockchain main chain network and the blockchain side chain network respectively. The test cases can include data query cases, data call cases, or other interface test cases, so as to verify the compatibility between the two networks from the perspective of the return value of the two blockchain networks for the same interface and the perspective of mutual calls between the two blockchain networks. Then obtain the first response information of the blockchain main chain network for the test case, and obtain the second response information of the blockchain side chain network for the test case. In the case where the first response information does not match the second response information, the blockchain main chain network and the blockchain side chain network can be processed for version matching. Then obtain the third response information of the blockchain main chain network for the test case after the version matching process, and obtain the fourth response information of the blockchain side chain network for the test case. Finally, the interface test result is determined according to the third response information and the fourth response information. The interface test result can be used to indicate whether the interface between the blockchain main chain network after version matching processing and the blockchain side chain network after version matching processing is compatible.

[0096] In some embodiments, for the case where the blockchain main chain network has a network version upgrade or network version rollback, the network version of the blockchain main chain network can be automatically upgraded or rolled back according to the first response information and the second response information. For example, assuming that the network version of the blockchain main chain network is upgraded from version v1 to version v2, and the first response information does not match the second response information, then the network version of the blockchain main chain network can be obtained to determine whether the network version of the blockchain main chain network has a version upgrade. In the case where it is determined that the network version of the blockchain main chain network has a version upgrade, the network version of the blockchain side chain network can be upgraded, that is, the network version of the blockchain side chain network is upgraded from version v1 to version v2. Optionally, if the third response information of the blockchain main chain network of version v2 for the test case and the fourth response information of the blockchain side chain network of version v2 for the test case do not match, the network version of the blockchain main chain network can also be rolled back to version v1, and the network version of the blockchain side chain network can be rolled back to version v1, and then the above steps are repeated to test the interface between the blockchain main chain network and the blockchain side chain network.

[0097] In the release phase, the execution log and the consensus result determined based on the consensus algorithm can be analyzed and processed to obtain the analysis result. Among them, the consensus algorithm can be, for example, the BFT (Byzantine Fault Tolerance) algorithm, the PBFT (Practical Byzantine Fault Tolerance) algorithm, etc. Finally, a test report can be generated based on the test results and analysis results. When it is determined that the interface between the blockchain main chain network and the blockchain side chain network is compatible, the blockchain side chain network can be released online.

[0098] Further, in this application scenario, the test device executes the test method provided in the embodiment of the present application involving multiple modules, see Fig. 9 , Fig. 9 Schematic diagram of a test device provided in an embodiment of the present application. Fig. 9 As shown, the test device may include a test data management module, a test case management module, a test scenario management module, a test executor, a routing management module, and a test report management module. Each module is introduced below.

[0099] 1) Test data management module: The test data management module can be used to manage the data required to execute test cases, or the data generated by executing test cases. Test data includes but is not limited to contract data, transaction data, etc.

[0100] 2) Test case management module: The test case management module can be used to manage different interface test cases, such as data query interface, data call interface, contract interface, event interface, attribute interface, etc.

[0101] 3) Test scene management module: The test scene management module can be used to combine different interface test cases to generate test scenes. Test scenes may include contract deployment, contract call, asset transfer, block transaction query, resource consumption (gas) estimation, etc.

[0102] 4) Test executor: The test executor can be used to initiate the test process, such as initiating a blockchain transaction request.

[0103] 5) Routing (Testrouter) management module: The routing management module can be used to manage different blockchain networks, such as the blockchain main chain network and the blockchain side chain network.

[0104] 6) Test report (Testreporter) management module: The test report management module can be used to generate test reports.

[0105] Exemplarily, the following takes the balance query interface between the test blockchain main chain network and the blockchain side chain network as an example to illustrate the calling process of each of the above modules. Assuming that the balance of address A is queried, the test data management module can be called to obtain the test data (address A); then the test case management module can be called to obtain the test case for querying the balance of address A; then the test executor can be called to forward the test case to the routing management module, and the routing management module routes the test case to the blockchain main chain network and the blockchain side chain network respectively; then obtain the first response information of the blockchain main chain network for the test case, and obtain the second response information of the blockchain side chain network for the test case; if the first response information and the second response information match, it can be determined that the interface between the blockchain main chain network and the blockchain side chain network is compatible; if the first response information and the second response information do not match, the blockchain main chain network and the blockchain side chain network can be version matched; then obtain the third response information of the blockchain main chain network for the test case after the version matching process, and obtain the fourth response information of the blockchain side chain network for the test case; finally, determine the interface test result according to the third response information and the fourth response information, and call the test report management module to generate a test report.

[0106] The embodiment of the present application realizes the automation of blockchain compatibility testing by routing the test cases to the blockchain main chain network and the blockchain side chain network respectively, and performing real-time comparison of the response information of the test cases based on the two blockchain networks. In addition, in the case where the response information of the two blockchain networks does not match, the two blockchain networks can also be processed for version matching to reduce the impact of version issues on the interface test results. Compared with traditional tests for blockchain compatibility, this method can reduce the time cost of manual comparison of parameters, improve test efficiency, and cover different versions of the blockchain main chain network at the same time, which is conducive to improving the accuracy and reliability of test results.

[0107] It should be noted that the execution carrier for executing each step in the above method embodiment may be composed of hardware, software, or a combination of hardware and software. In the specific implementation of the present application, the data used are all authorized by the object. When the above embodiments of the present application are applied to specific products or technologies, the data used is required to obtain the permission or consent of the object, and the collection, use and processing of the relevant data need to comply with the relevant laws and regulations and standards of the relevant countries and regions.

[0108] For further information, see Fig.10 , is a schematic diagram of the structure of a test device provided in an embodiment of the present application. The test device 1000 may include:

[0109] Processing unit 1001 is used to deploy the blockchain main chain network and the blockchain side chain network in the test environment, and route the test cases to the blockchain main chain network and the blockchain side chain network respectively; wherein the test cases are used to test the interface between the blockchain main chain network and the blockchain side chain network;

[0110] An acquisition unit 1002 is used to acquire first response information of the blockchain main chain network for the test case, and to acquire second response information of the blockchain side chain network for the test case;

[0111] The processing unit 1001 is also used to perform version matching processing on the blockchain main chain network and the blockchain side chain network if the first response information does not match the second response information; the acquisition unit is also used to obtain the third response information of the blockchain main chain network for the test case after the version matching processing, and obtain the fourth response information of the blockchain side chain network for the test case after the version matching processing; the processing unit is also used to determine the interface test result according to the third response information and the fourth response information; wherein the interface test result is used to indicate whether the interface between the blockchain main chain network after the version matching processing and the blockchain side chain network after the version matching processing is compatible.

[0112] In some embodiments, the processing unit 1001 is also used to perform network version upgrade processing on the blockchain sidechain network if the network version of the blockchain main chain network is higher than the network version of the blockchain sidechain network, and the network version of the blockchain sidechain network after the upgrade matches the network version of the blockchain main chain network; if the network version of the blockchain main chain network is lower than the network version of the blockchain sidechain network, the blockchain sidechain network performs network version rollback processing, and the network version of the blockchain sidechain network after the rollback processing matches the network version of the blockchain main chain network.

[0113] In some embodiments, the above-mentioned test case is a contract call case, and the processing unit 1001 is also used to, if the contract version of the smart contract called by the blockchain main chain network execution contract call case is higher than the contract version of the smart contract called by the blockchain side chain network execution contract call case, then perform contract version upgrade processing on the smart contract called by the blockchain side chain network execution contract call case, and the contract version of the smart contract called by the blockchain side chain network execution contract call case after the upgrade processing matches the contract version of the smart contract called by the blockchain main chain network execution contract call case; if the contract version of the smart contract called by the blockchain main chain network execution contract call case is lower than the contract version of the smart contract called by the blockchain side chain network execution contract call case, then perform contract version rollback processing on the smart contract called by the blockchain side chain network execution contract call case, and the contract version of the smart contract called by the blockchain side chain network execution contract call case after the rollback processing matches the contract version of the smart contract called by the blockchain main chain network execution contract call case.

[0114] In some embodiments, the above-mentioned test case is a contract call case, and the first response information includes: the first contract call data obtained from the blockchain main chain network by executing the contract call case, and the second response information includes: the second contract call data obtained from the blockchain side chain network by executing the contract call case; the processing unit 1001 is also used to determine that the first response information matches the second response information if the first contract call data is consistent with the second contract call data; if the first contract call data is inconsistent with the second contract call data, it is determined that the first response information does not match the second response information.

[0115] In some embodiments, the above-mentioned test case is a data query case, and the first response information includes: the first query data queried from the blockchain main chain network by executing the data query case, and the second response information includes: the second query data queried from the blockchain side chain network by executing the data query case; the processing unit 1001 is also used to compare the first query data with the second query data to obtain a comparison result; if the comparison result indicates that the first query data is consistent with the second query data, it is determined that the first response information matches the second response information; if the comparison result indicates that the first query data is inconsistent with the second query data, it is determined that the first response information does not match the second response information.

[0116] In some embodiments, the first query data includes: a first field and a field type of the first field, and the second query data includes: a second field and a field type of the second field; the processing unit 1001 is also used to compare the first field with the second field, and to compare the field type of the first field with the field type of the second field; if the first field is consistent with the second field, and the field type of the first field is consistent with the field type of the second field, then the comparison result is determined to be a first comparison result, and the first comparison result indicates that the first query data is consistent with the second query data; if the first field is inconsistent with the second field, or the field type of the first field is inconsistent with the field type of the second field, then the comparison result is determined to be a second comparison result, and the second comparison result indicates that the first query data is inconsistent with the second query data.

[0117] In some embodiments, the above-mentioned test case is a data call case, and the first response information includes: the call data obtained from the blockchain main chain network by executing the data call case, and the second response information includes: the data call request generated by executing the data call case; the processing unit 1001 is also used to determine whether the call data included in the first response information is the data requested to be called by the data call request; if the call data included in the first response information is the data requested to be called by the data call request, it is determined that the first response information matches the second response information; if the call data included in the first response information is not the data requested to be called by the data call request, it is determined that the first response information does not match the second response information.

[0118] In some embodiments, the processing unit 1001 is also used to determine that the interface test result is a target interface test result if the first response information matches the second response information, and the target interface test result indicates that the interface between the blockchain main chain network and the blockchain side chain network is compatible.

[0119] In a feasible embodiment, the test device provided in the embodiment of the present application can be implemented in software, and the test device can be stored in a memory. It can be software in the form of programs and plug-ins, and includes a series of units, including an acquisition unit and a processing unit; wherein the processing unit and the acquisition unit are used to implement the test method provided in the embodiment of the present application.

[0120] In other feasible embodiments, the test device provided in the embodiment of the present application can also be implemented in a combination of software and hardware. As an example, the test device provided in the embodiment of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the test method provided in the embodiment of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0121] See also Fig.11 , Fig.11 It is a structural diagram of a computer device 1100 provided in an embodiment of the present application. The computer device may include: a communication interface 1101, a memory 1102 and a processor 1103, wherein the communication interface 1101, the memory 1102 and the processor 1103 are connected via one or more communication buses, and the communication bus is used to realize the connection and communication between these components. The communication interface 1101 may include a standard wired interface and a wireless interface (such as a WIFI interface). The memory 1102 may include a volatile memory (volatile memory), such as a random-access memory (random-access memory, RAM); the memory 1102 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a solid-state drive (solid-state drive, SSD), etc.; the memory 1102 may also include a combination of the above-mentioned types of memory. The processor 1103 may be a central processing unit (CPU). The processor 1103 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), etc. The PLD may be a field-programmable gate array (FPGA), a generic array logic (GAL), etc.

[0122] Optionally, the memory 1102 is also used to store program instructions, and the processor 1103 can also call the program instructions to implement the test method in the present application. In some embodiments, the processor 1103 calls the program instructions stored in the memory 1102 to implement: deploying the blockchain main chain network and the blockchain side chain network in the test environment, and routing the test case to the blockchain main chain network and the blockchain side chain network respectively; wherein the test case is used to test the interface between the blockchain main chain network and the blockchain side chain network; obtaining the first response information of the blockchain main chain network for the test case, and obtaining the second response information of the blockchain side chain network for the test case; if the first response information does not match the second response information, the blockchain main chain network and the blockchain side chain network are version matched; obtaining the third response information of the blockchain main chain network after the version matching process for the test case, and obtaining the fourth response information of the blockchain side chain network after the version matching process for the test case; determining the interface test result according to the third response information and the fourth response information; wherein the interface test result is used to indicate whether the interface between the blockchain main chain network after the version matching process and the blockchain side chain network after the version matching process is compatible.

[0123] In some embodiments, the processor 1103 may also call the program instructions to achieve: if the network version of the blockchain main chain network is higher than the network version of the blockchain side chain network, the blockchain side chain network is upgraded, and the network version of the blockchain side chain network after the upgrade matches the network version of the blockchain main chain network; if the network version of the blockchain main chain network is lower than the network version of the blockchain side chain network, the blockchain side chain network is rolled back, and the network version of the blockchain side chain network after the rollback matches the network version of the blockchain main chain network.

[0124] In some embodiments, the above-mentioned test case is a contract call case, and the processor 1103 can also call the program instruction to achieve: if the contract version of the smart contract called by the blockchain main chain network execution contract call case is higher than the contract version of the smart contract called by the blockchain side chain network execution contract call case, then the smart contract called by the blockchain side chain network execution contract call case is upgraded, and the contract version of the smart contract called by the blockchain side chain network execution contract call case after the upgrade is matched with the contract version of the smart contract called by the blockchain main chain network execution contract call case; if the contract version of the smart contract called by the blockchain main chain network execution contract call case is lower than the contract version of the smart contract called by the blockchain side chain network execution contract call case, then the smart contract called by the blockchain side chain network execution contract call case is rolled back, and the contract version of the smart contract called by the blockchain side chain network execution contract call case after the rollback is matched with the contract version of the smart contract called by the blockchain main chain network execution contract call case.

[0125] In some embodiments, the above-mentioned test case is a contract call case, and the first response information includes: the first contract call data obtained from the blockchain main chain network by executing the contract call case, and the second response information includes: the second contract call data obtained from the blockchain side chain network by executing the contract call case; the processor 1103 can also call the program instruction to achieve: if the first contract call data is consistent with the second contract call data, it is determined that the first response information matches the second response information; if the first contract call data is inconsistent with the second contract call data, it is determined that the first response information does not match the second response information.

[0126] In some embodiments, the above-mentioned test case is a data query case, and the first response information includes: the first query data queried from the blockchain main chain network by executing the data query case, and the second response information includes: the second query data queried from the blockchain side chain network by executing the data query case; the processor 1103 can also call the program instruction to implement: comparing the first query data with the second query data to obtain a comparison result; if the comparison result indicates that the first query data is consistent with the second query data, it is determined that the first response information matches the second response information; if the comparison result indicates that the first query data is inconsistent with the second query data, it is determined that the first response information does not match the second response information.

[0127] In some embodiments, the first query data includes: a first field and a field type of the first field, and the second query data includes: a second field and a field type of the second field; the processor 1103 may also call the program instructions to implement: comparing the first field with the second field, and comparing the field type of the first field with the field type of the second field; if the first field is consistent with the second field, and the field type of the first field is consistent with the field type of the second field, then the comparison result is determined to be a first comparison result, and the first comparison result indicates that the first query data is consistent with the second query data; if the first field is inconsistent with the second field, or the field type of the first field is inconsistent with the field type of the second field, then the comparison result is determined to be a second comparison result, and the second comparison result indicates that the first query data is inconsistent with the second query data.

[0128] In some embodiments, the above-mentioned test case is a data call case, and the first response information includes: the call data obtained from the blockchain main chain network by executing the data call case, and the second response information includes: the data call request generated by executing the data call case; the processor 1103 can also call the program instructions to achieve: determine whether the call data included in the first response information is the data requested to be called by the data call request; if the call data included in the first response information is the data requested to be called by the data call request, then determine that the first response information matches the second response information; if the call data included in the first response information is not the data requested to be called by the data call request, then determine that the first response information does not match the second response information.

[0129] In some embodiments, the processor 1103 may also call the program instructions to achieve: if the first response information matches the second response information, the interface test result is determined to be the target interface test result, and the target interface test result indicates that the interface between the blockchain main chain network and the blockchain side chain network is compatible.

[0130] It should be understood that the principles and beneficial effects of the computer device 1100 described in the embodiments of the present application for solving the problem are similar to those of the present application. Figure 5-Figure 9 The principles and beneficial effects of the illustrated embodiment and the aforementioned contents in solving the problems are similar, and for the sake of brevity, they will not be repeated here.

[0131] Accordingly, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the test method provided in the embodiment of the present application is implemented.

[0132] Accordingly, an embodiment of the present application further provides a computer program product, which includes a computer program or computer instructions, and when the computer program or computer instructions are executed by a processor, the test method provided in the embodiment of the present application is implemented.

[0133] Accordingly, an embodiment of the present application provides a computer program, which includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the test method provided in the embodiment of the present application.

[0134] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but the technical objects in this field should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, the technical objects in this field should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0135] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0136] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A testing method, characterized in that: The method comprises: Deploy a blockchain main chain network and a blockchain side chain network in a test environment, and route test cases to the blockchain main chain network and the blockchain side chain network respectively; wherein the test cases are used to test the interface between the blockchain main chain network and the blockchain side chain network; Obtaining first response information of the blockchain main chain network for the test case, and obtaining second response information of the blockchain side chain network for the test case; If the first response information does not match the second response information, performing version matching processing on the blockchain main chain network and the blockchain side chain network; Obtain third response information of the blockchain main chain network after version matching processing for the test case, and obtain fourth response information of the blockchain side chain network after version matching processing for the test case; The interface test result is determined according to the third response information and the fourth response information; wherein, the interface test result is used to indicate whether the interface between the blockchain main chain network after version matching processing and the blockchain side chain network after version matching processing is compatible.

2. The method according to claim 1, characterized in that The performing version matching processing on the blockchain main chain network and the blockchain side chain network includes: If the network version of the blockchain main chain network is higher than the network version of the blockchain side chain network, the network version of the blockchain side chain network is upgraded, and the network version of the upgraded blockchain side chain network matches the network version of the blockchain main chain network; If the network version of the blockchain main chain network is lower than the network version of the blockchain side chain network, the blockchain side chain network will perform a network version rollback process, and the network version of the blockchain side chain network after the rollback process will match the network version of the blockchain main chain network.

3. The method according to claim 1, characterized in that The test case is a contract call case, and the version matching process of the blockchain main chain network and the blockchain side chain network includes: If the contract version of the smart contract called by the blockchain main chain network to execute the contract call use case is higher than the contract version of the smart contract called by the blockchain side chain network to execute the contract call use case, the contract version of the smart contract called by the blockchain side chain network to execute the contract call use case is upgraded, and the contract version of the smart contract called by the blockchain side chain network to execute the contract call use case after the upgrade is matched with the contract version of the smart contract called by the blockchain main chain network to execute the contract call use case; If the contract version of the smart contract called by the blockchain main chain network to execute the contract call use case is lower than the contract version of the smart contract called by the blockchain side chain network to execute the contract call use case, the contract version rollback processing will be performed on the smart contract called by the blockchain side chain network to execute the contract call use case. After the rollback processing, the contract version of the smart contract called by the blockchain side chain network to execute the contract call use case will match the contract version of the smart contract called by the blockchain main chain network to execute the contract call use case.

4. The method according to claim 1, characterized in that The test case is a contract call case, the first response information includes: first contract call data obtained from the blockchain main chain network by executing the contract call case, and the second response information includes: second contract call data obtained from the blockchain side chain network by executing the contract call case; the method also includes: If the first contract call data is consistent with the second contract call data, determining that the first response information matches the second response information; If the first contract call data is inconsistent with the second contract call data, it is determined that the first response information does not match the second response information.

5. The method according to claim 1, characterized in that The test case is a data query case, the first response information includes: first query data queried from the blockchain main chain network by executing the data query case, and the second response information includes: second query data queried from the blockchain side chain network by executing the data query case; the method also includes: Comparing the first query data with the second query data to obtain a comparison result; If the comparison result indicates that the first query data is consistent with the second query data, determining that the first response information matches the second response information; If the comparison result indicates that the first query data is inconsistent with the second query data, it is determined that the first response information is inconsistent with the second response information.

6. The method according to claim 5, characterized in that The first query data includes: a first field and a field type of the first field, and the second query data includes: a second field and a field type of the second field; and the first query data is compared with the second query data to obtain a comparison result, including: Comparing the first field with the second field, and comparing the field type of the first field with the field type of the second field; If the first field is consistent with the second field, and the field type of the first field is consistent with the field type of the second field, determining that the comparison result is a first comparison result, the first comparison result indicates that the first query data is consistent with the second query data; If the first field is inconsistent with the second field, or the field type of the first field is inconsistent with the field type of the second field, the comparison result is determined to be a second comparison result, and the second comparison result indicates that the first query data is inconsistent with the second query data.

7. The method according to claim 1, characterized in that The test case is a data call case, the first response information includes: call data obtained from the blockchain main chain network by executing the data call case, and the second response information includes: a data call request generated by executing the data call case; the method also includes: Determining whether the calling data included in the first response information is the data requested to be called by the data calling request; If the calling data included in the first response information is the data requested to be called by the data calling request, determining that the first response information matches the second response information; If the calling data included in the first response information is not the data requested to be called by the data calling request, it is determined that the first response information does not match the second response information.

8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: If the first response information matches the second response information, the interface test result is determined to be a target interface test result, and the target interface test result indicates that the interface between the blockchain main chain network and the blockchain side chain network is compatible.

9. A testing device, characterized in that: The device comprises: A processing unit, configured to deploy a blockchain main chain network and a blockchain side chain network in a test environment; and route test cases to the blockchain main chain network and the blockchain side chain network respectively; wherein the test cases are used to test the interface between the blockchain main chain network and the blockchain side chain network; An acquisition unit, used to acquire first response information of the blockchain main chain network to the test case, and acquire second response information of the blockchain side chain network to the test case; The processing unit is further configured to perform version matching processing on the blockchain main chain network and the blockchain side chain network if the first response information does not match the second response information; The acquisition unit is further used to acquire third response information of the blockchain main chain network after version matching processing for the test case, and acquire fourth response information of the blockchain side chain network after version matching processing for the test case; The processing unit is also used to determine the interface test result based on the third response information and the fourth response information; wherein, the interface test result is used to indicate whether the interface between the blockchain main chain network after version matching processing and the blockchain side chain network after version matching processing is compatible.

10. A computer device, characterized in that: include: A processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are connected to each other, wherein the memory stores an executable program code, and the processor is used to call the executable program code to implement the test method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the test method according to any one of claims 1 to 8 is implemented.

12. A computer program product, characterized in that The computer program product comprises a computer program or a computer instruction, and when the computer program or the computer instruction is executed by a processor, the testing method according to any one of claims 1 to 8 is implemented.