Method, device and system for automatically testing block chain engine
Through the automated visual testing system, the problems of low blockchain engine testing efficiency and difficulty in data reuse are solved, efficient and accurate test results are achieved, and test difficulty and dependency are reduced.
Patent Information
- Application Number
- CN202310161153.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2024-08-27
AI Technical Summary
The existing technology lacks automated performance testing and chaos testing technology, resulting in low efficiency and difficulty in blockchain engine testing. Test data cannot be reused and relies on manual operations and high professionalism.
Provides methods and systems for automatically testing blockchain engines, obtains topology parameters, contract parameters and test parameters through the visual test configuration page, automatically builds the target system, loads smart contracts and tests, displays visual results, and achieves automation and reuse.
It reduces the difficulty of testing, improves testing efficiency, ensures the standardization and correctness of test quality and results, and reduces dependence on testers.
Smart Images

Figure CN118550811A
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a method, device and system for automatically testing a blockchain engine. Background Art
[0002] With the development of Internet technology, blockchain technology has gradually emerged. Smart contracts are an important feature of blockchain. They are an important way for users to interact with blockchain and use blockchain to implement business logic. Users can use specific smart contracts based on the blockchain framework or blockchain engine according to their own usage scenarios. Smart contracts of different complexity greatly affect the performance of the blockchain engine. At the usage level, it is necessary to test the actual performance of the blockchain engine based on their own smart contracts. However, there is no mature automated testing system for testing blockchain engines. Currently, it mainly relies on manual testing by testers, which has low testing efficiency, and the test process and test data cannot be reused. Summary of the invention
[0003] The embodiments of the present application provide a method, device, and system for automatically testing a blockchain engine, which can provide a visual testing system for automatically testing a blockchain engine, improve testing efficiency and automation, reduce testing difficulty, and solve the technical problem that testing processes and test data cannot be reused in related technologies.
[0004] According to one aspect of an embodiment of the present application, a method for automatically testing a blockchain engine is provided, the method comprising:
[0005] Displaying a first page, wherein the first page includes a contract code of a target contract;
[0006] Display a test configuration page, the test configuration page including an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control;
[0007] In response to a trigger operation on the engine deployment configuration control, obtaining topology parameters corresponding to the blockchain engine;
[0008] In response to a triggering operation on the contract deployment configuration control, obtaining a contract parameter, wherein the contract parameter points to a contract running based on the blockchain engine;
[0009] In case of obtaining a trigger operation for the test parameter configuration control, obtaining the test parameters;
[0010] Performing target node extraction processing on the physical machine cluster, and creating a target system for running the blockchain engine based on the extraction result, wherein each target node in the target system forms a topology corresponding to the topology parameter;
[0011] Loading the target contract at each of the target nodes according to the contract parameters;
[0012] Testing each of the target nodes according to the test parameters to obtain a test result;
[0013] The test results are displayed on the result display page.
[0014] According to one aspect of an embodiment of the present application, a device for automatically testing a blockchain engine is provided, the device comprising:
[0015] A display module, used to display a test configuration page, wherein the test configuration page includes an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control;
[0016] A parameter acquisition module, used to obtain topology parameters corresponding to the blockchain engine in response to a trigger operation on the engine deployment configuration control;
[0017] A test module is used to obtain contract parameters in response to a trigger operation for the contract deployment configuration control, wherein the contract parameters point to a contract running based on the blockchain engine; in the case of obtaining a trigger operation for the test parameter configuration control, obtain test parameters; perform target node extraction processing on the physical machine cluster, and create a target system running the blockchain engine based on the extraction result, wherein each target node in the target system forms a topology corresponding to the topology parameter; load a target contract on each target node according to the contract parameter; and test each target node according to the test parameter to obtain a test result;
[0018] The display module is also used to display the test results on the result display page.
[0019] According to one aspect of an embodiment of the present application, a system for automatically testing a blockchain engine is provided, the system comprising: a display module, a target system construction module, a contract deployment module, a test module and a physical machine cluster, the target system construction module, the contract deployment module and the test module are respectively connected to the display module through a first interface layer, and the target system construction module, the contract deployment module and the test module are respectively connected to the physical machine cluster through a second interface layer,
[0020] The display module is used to display a test configuration page, which includes an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control; in response to a trigger operation on the engine deployment configuration control, obtain topology parameters corresponding to the blockchain engine; in response to a trigger operation on the contract deployment configuration control, obtain contract parameters, the contract parameters pointing to a contract running based on the blockchain engine; in the case of obtaining a trigger operation on the test parameter configuration control, obtain test parameters;
[0021] The target system construction module is used to perform target node extraction processing on the physical machine cluster, and create a target system running the blockchain engine based on the extraction result, wherein each target node in the target system forms a topology corresponding to the topology parameter;
[0022] The contract deployment module is used to load the target contract on each target node according to the contract parameters;
[0023] The test module is used to test each of the target nodes according to the test parameters to obtain a test result;
[0024] The display module is also used to display the test results on the result display page.
[0025] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the above-mentioned method of automatically testing a blockchain engine.
[0026] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, a code set, or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the above-mentioned method of automatically testing a blockchain engine.
[0027] According to one aspect of an embodiment of the present application, a computer program product is provided, the computer program product comprising computer instructions, the computer instructions being 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 to implement the above-mentioned method of automatically testing a blockchain engine.
[0028] The technical solution provided in the embodiments of the present application can bring the following beneficial effects:
[0029] By displaying the test configuration page, the tester is supported to visually configure the test parameters, the topological parameters corresponding to the blockchain engine, and the contract parameters according to the actual test requirements of the blockchain engine. On the basis of obtaining the test parameters, the topological parameters corresponding to the blockchain engine, and the contract parameters, the test process is fully automatically completed. Specifically, the target system can be automatically built on the basis of the physical machine cluster based on the topological parameters. This target system is the operating environment of the blockchain engine. In this operating environment, the smart contract is automatically loaded based on the contract parameters, and the blockchain engine running the smart contract is tested according to the test parameters and the visual results are automatically displayed. In other words, the embodiment of the present application provides an automated, visual test system for testing the blockchain engine. The test system can test the performance of the blockchain engine under various smart contract running conditions, thereby solving the technical problems that the related technical test process and test data cannot be reused, reducing the dependence on testers, reducing the difficulty of testing, improving test efficiency and ensuring test quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments 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 creative work.
[0031] Figure 1 This is an optional structural diagram of a distributed system provided by an embodiment of the present invention applied to a blockchain system;
[0032] Figure 2 is an optional schematic diagram of a block structure provided by an embodiment of the present invention;
[0033] Figure 3 It is a schematic diagram of the implementation framework of the method for automatically testing the blockchain engine provided in the embodiment of the present application;
[0034] Figure 4 This is a flowchart of a method for automatically testing a blockchain engine provided by an embodiment of the present application;
[0035] Figure 5 The schematic diagram of the visual interface of the test system is shown as an example;
[0036] Figure 6 This is a schematic diagram of a test configuration page provided by an embodiment of the present application;
[0037] Figure 7 This is a logical structure diagram of a system for automatically testing a blockchain engine provided by an embodiment of the present application;
[0038] Figure 8 The schematic diagram of the test process flow is shown as an example;
[0039] Fig. 9 A block diagram of an apparatus for automatically testing a blockchain engine is shown as an example;
[0040] Fig.10 A block diagram of a system for automatically testing a blockchain engine is shown as an example;
[0041] Fig.11 It is a schematic diagram of the hardware structure of a device for implementing the method provided in an embodiment of the present application, provided in an embodiment of the present application;
[0042] Fig.12 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0044] The system involved in the embodiment of the present invention may be a distributed system formed by connecting multiple nodes (computing devices of any form in the access network, such as servers and user terminals) through network communication.
[0045] A distributed system is a loosely coupled system consisting of multiple processors interconnected through communication lines. From the perspective of a processor in the system, the other processors and corresponding resources are remote, and only its own resources are local. It has the characteristics of distribution, autonomy, parallelism, and globality.
[0046] User terminals include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, game consoles, e-book readers, multimedia playback devices, wearable devices and other electronic devices. The client of the application can be installed in the user terminal.
[0047] In the embodiment of the present application, the above-mentioned applications include but are not limited to browser applications, financial applications, news applications, social applications, interactive entertainment applications, browser applications, shopping applications, content sharing applications, virtual reality (VR) applications, augmented reality (AR) applications, etc., and the embodiment of the present application does not limit this.
[0048] The server is used to provide background services for the client of the application in the user terminal. For example, the server can be the background server of the above application. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the server provides background services for applications in multiple user terminals at the same time.
[0049] Optionally, the user terminal and the server may be connected directly or indirectly via wired or wireless communication, which is not limited in the present application.
[0050] The embodiments of the present invention relate to blockchain technology, which is a new application mode 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 of which 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 blockchain underlying platform, platform product service layer and application service layer.
[0051] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation management. Among them, the user management module is responsible for the identity information management of all blockchain participants, including the maintenance of public and private key generation, key management, and the maintenance of the correspondence between the user'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 the valid requests to the 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). After encryption, it is completely and consistently transmitted to the shared ledger (network communication) and recorded and stored; 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 to complete the contract logic. It also provides the function of contract upgrade and cancellation; the operation management 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 alarms, displaying network conditions, displaying the health status of node devices, etc.
[0052] 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.
[0053] Take the distributed system as the blockchain system as an example, see Figure 1 , Figure 1 This is an optional structural diagram of the distributed system 100 provided by the embodiment of the present invention applied to the blockchain system, which consists of multiple nodes (any form of computing devices in the access network, such as servers and user terminals), and a peer-to-peer (P2P) network formed between the nodes. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.
[0054] See also Figure 1 The functions of each node in the blockchain system shown include:
[0055] 1) Routing: a basic function of a node, used to support communication between nodes.
[0056] In addition to the routing function, the node can also have the following functions:
[0057] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.
[0058] For example, the services implemented by the application include:
[0059] 2.1) Wallet, used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledge the validity of the transaction, the transaction record data is stored in the temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;
[0060] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.
[0061] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.
[0062] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.
[0063] See also Figure 2 , Figure 2This is an optional schematic diagram of the block structure (BlockStructure) provided by an embodiment of the present invention. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.
[0064] In addition, embodiments of the present application may also involve cloud technology, which is explained below.
[0065] Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, allowing various application systems to obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". From the user's perspective, the resources in the "cloud" are infinitely scalable and can be obtained at any time, used on demand, expanded at any time, and paid for by use.
[0066] As a provider of basic cloud computing capabilities, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0067] According to the logical function division, the PaaS (Platform as a Service) layer can be deployed on the IaaS layer, and the SaaS (Software as a Service) layer can be deployed on the PaaS layer, or SaaS can be directly deployed on IaaS. PaaS is a platform for software operation, such as databases, web containers, etc. SaaS is a variety of business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
[0068] The embodiments of the present application can embed the blockchain framework into the cloud computing platform, and use the deployment and management advantages of the cloud service infrastructure to provide users with cloud blockchain services (Blockchain as a Service, BaaS). Cloud blockchain services provide developers with a convenient and high-performance blockchain ecological environment and ecological supporting services, and are blockchain open platforms that support developers' business expansion and operational support. Using BaaS can greatly reduce the cost of implementing the underlying blockchain technology, simplify blockchain construction and operation and maintenance work, and at the same time face various industry scenarios, meet user personalized needs, and quickly deliver customized BaaS in one stop.
[0069] In order to explain the technical solutions in the embodiments of the present application in more detail, the embodiments of the present application briefly introduce the relevant technologies:
[0070] RPC: It is the abbreviation of Remote Procedure Call. gRPC is a high-performance, general-purpose open source RPC framework developed by Google, mainly for mobile application development, and supports most popular programming languages.
[0071] Smart Contract: A computer protocol designed to disseminate, verify or execute contracts in an information-based manner. Smart contracts allow for trusted transactions without a third party, which are traceable and irreversible. The purpose of smart contracts is to provide a security method superior to traditional contracts and reduce other transaction costs associated with contracts. Smart contracts are based on computer code, which can minimize the ambiguity of language and present it through a strict logical structure. The content and its execution process are transparent and visible to all nodes, which can observe, record and verify the contract status through the user interface. Once the conditions are met, the contract automatically executes the expected plan. Under the given factual input, the smart contract outputs the results and is visualized in the display horizon. Users can deploy smart contracts in the blockchain network. Smart contracts are contract programs that are automatically executed according to specific conditions. Smart contracts are an important feature of blockchains and an important way for users to interact with blockchains and use blockchains to implement business logic.
[0072] Hyperledger: Hyperledger is one of the largest projects in the blockchain industry. It consists of a set of open source tools and multiple sub-projects. The goal of the project is to build a powerful, business-driven blockchain framework. There are three main types of blockchain networks: public blockchains, consortium or federated blockchains, and private blockchains. Hyperledger is a blockchain framework designed to help build private or consortium permissioned blockchain networks in which multiple organizations can share the authority to control and operate nodes within the network.
[0073] Hyperledger Fabric: An enterprise-level blockchain framework implementation with a highly modular and configurable design, complete member management and governance measures, and support for pluggable consensus protocols. It is an excellent and widely recognized blockchain underlying engine. Because blockchain is a transparent, secure decentralized system based on an immutable model, it is considered a game-changing solution for the traditional supply chain industry. It can support effective supply chain systems in the following ways: detecting products throughout the blockchain; verifying and authenticating products in the blockchain; sharing information throughout the blockchain among supply chain participants; and providing auditability.
[0074] Chaos testing: is a testable, system-based method to deal with chaos problems in large-scale distributed systems. Through continuous experiments, we can understand the actual resilience boundary of the system, and observe the behavior and response of the distributed system through different test methods and purposes. It is a test method that uses experimental methods to reveal system weaknesses as early as possible. Chaos testing is an exploratory test that does not have clear inputs and expected results. It observes the response of the system by intervening in the system and services. Chaos testing is a set of methodologies that actively find the vulnerable links in the system by conducting experiments on distributed systems, which is conducive to building a more resilient system.
[0075] Endorsement policy: When verifying a transaction, the endorsement policy is used to verify whether a transaction is valid. The endorsement policy defines some requirements. Only transactions endorsed according to the endorsement policy are considered valid. The smart contract will specify the endorsement policy when it is deployed.
[0076] Endorsing node: A node that executes the endorsement policy.
[0077] Chaincode: Smart contracts in Fabric are called chaincodes, which use computer languages to describe contract terms, transaction conditions, business logic of transactions, etc. The automatic execution of transactions and operations on ledger data are realized by calling chaincodes. It is the medium for applications to interact with the underlying layer. Chaincodes are executed in a Docker container independent of the Peer node, connected to the endorsement node through gRPC, and the two parties communicate by sending ChaincodeMessages. The ledger of a Chaincode is isolated from other Chaincodes and cannot be accessed directly. Only after the Chaincode in the same network obtains the corresponding permission can other chaincodes be called to other ledgers. Chaincodes are separated from data. Fabric chaincodes are separate from the underlying ledgers. When upgrading chaincodes, it is not necessary to migrate the ledger data to the new chaincode, which truly realizes the separation of logic and data. Chaincodes can be written in multiple languages. Chaincode includes two types of chaincodes: system chaincodes and user chaincodes. System chaincodes are used to implement system-level functions, including system configuration, deployment and upgrade of user chaincodes, signature and verification strategies for user transactions, etc. System chaincode runs in the node process, not in a separate Docker. User chaincode is used to implement user application functions. Developers write chaincode applications and deploy them to the network, and end users call chaincodes through client applications that interact with network nodes. User chaincode implements the Chaincode interface.
[0078] Consensus: In Fabric, the consensus process means that multiple peer nodes reach a consensus on the order and legitimacy of a batch of transactions and their updates to the ledger status. The consensus process of Fabric includes endorsement, sorting and verification.
[0079] At present, there is no mature technical solution for automated performance testing and chaos testing of blockchain framework engines in the relevant technologies. Taking Fabric as an example, when using Fabric, users can write smart contracts according to their own usage scenarios. Smart contracts of different complexity greatly affect the performance of Fabric. At the user level, it is necessary to test the actual performance of Fabric according to their own smart contracts. At the level of optimizing Fabric performance, it is necessary to repeatedly perform performance tests to understand Fabric performance bottlenecks and optimize according to their own needs. At present, when testing Fabric performance, testers generally need to manually complete the following steps according to their own test needs: deploy the test network; write and deploy the corresponding test contracts; manually use the stress test software development tool to send stress for performance testing; collect and analyze test results.
[0080] When performing chaos testing on Fabric, after deploying the system to be tested (the distributed system running Fabric, or distributed network), the tester needs to log in to the physical machine corresponding to the Fabric node and manually inject various distributed faults to test the robustness of the Fabric network.
[0081] However, this solution obviously cannot achieve automated operation. Testers need to complete each process manually and can usually only test specific test scenarios that the testers themselves are familiar with. Steps such as deploying the test system, deploying the test contract, and sending pressure require testers to write a large number of scripts, which places too high demands on the professional qualities of testers. The test processes and codes before different test scenarios cannot be reused, which reduces test efficiency, increases test difficulty and test costs, and the standardization and correctness of the test results cannot be guaranteed.
[0082] In view of this, the embodiment of the present application provides a method for automatically testing the blockchain engine. By displaying the test configuration page, the tester is supported to visually configure the test parameters, the topological parameters corresponding to the blockchain engine, and the contract parameters according to the actual test requirements of the blockchain engine. On the basis of obtaining the test parameters, the topological parameters corresponding to the blockchain engine, and the contract parameters, the test process is fully automatically completed. Specifically, the target system can be automatically constructed on the basis of the physical machine cluster based on the topological parameters. This target system is the operating environment of the blockchain engine. In this operating environment, the smart contract is automatically loaded based on the contract parameters, and the blockchain engine running the smart contract is tested according to the test parameters and the visual results are automatically displayed. In other words, the embodiment of the present application provides an automated, visual test system for testing the blockchain engine. The test system can test the performance of the blockchain engine under various smart contract running conditions, thereby solving the technical problems that the related technical test process and test data cannot be reused, reducing the dependence on testers, reducing the difficulty of testing, improving test efficiency and ensuring test quality, and ensuring the standardization and correctness of the test results.
[0083] See also Figure 3 , Figure 3 : is a schematic diagram of an implementation framework of a method for automatically testing a blockchain engine provided in an embodiment of this specification, such as Figure 3 As shown, the implementation framework may include at least a client 10 and a server 20, and the client 10 and the server 20 communicate through a network 30. The implementation framework may also be considered as a system for automatically testing a blockchain engine, and the system for automatically testing a blockchain engine is used to provide a blockchain engine testing service. The server 20 may be located in a cloud environment, and the server 20 is a node in the system for automatically testing a blockchain engine in the cloud environment, and the node is any node in the cloud environment.
[0084] When a blockchain engine test request is obtained from the client 10, the server may display a test configuration page, which includes an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control; in response to a trigger operation on the engine deployment configuration control, the server may obtain topology parameters corresponding to the blockchain engine; in response to a trigger operation on the contract deployment configuration control, the server may obtain contract parameters, which point to a contract running based on the blockchain engine; in response to a trigger operation on the test parameter configuration control, the server may obtain test parameters; perform target node extraction processing on the physical machine cluster, and create a target system running the blockchain engine based on the extraction results, wherein each target node in the target system forms a topology corresponding to the topology parameters; load the target contract on each target node according to the contract parameters; test each target node according to the test parameters to obtain test results; and display the test results on the result display page.
[0085] The above framework of the embodiment of the present application can provide the blockchain engine testing capabilities required by applications in various scenarios, including but not limited to cloud technology, cloud games, cloud rendering, artificial intelligence, smart transportation, assisted driving, video media, smart communities, instant messaging, etc. Each component in the framework can be a terminal device or a server. Terminal devices include but are not limited to mobile phones, computers, intelligent voice exchange devices, smart home appliances, vehicle-mounted terminals, etc.
[0086] Please refer to Figure 4 , which shows a flow chart of a method for automatically testing a blockchain engine provided by an embodiment of the present application. The method can be applied to a computer device, which refers to an electronic device with data calculation and processing capabilities. The method can include the following steps.
[0087] Step 401, displaying a test configuration page, the test configuration page including an engine deployment configuration control, a contract deployment configuration control and a test parameter configuration control.
[0088] The embodiments of the present application provide a testing method that can perform automated visual testing on each blockchain engine. Fabric is used as an example for introduction below. The testing of other blockchain implementation frameworks or blockchain engines is also based on the same inventive concept, which will not be described in detail here.
[0089] The test configuration page can be displayed in response to the test request sent by the client 10. This page is a visual interface displayed when the system that automatically tests the blockchain engine performs test configuration. The user can configure the relevant parameters in this interface by triggering the engine deployment configuration control, the contract deployment configuration control, and the test parameter configuration control. The embodiment of the present application does not limit the specific presentation method of the control, for example, it can be a selection box, a button, a drop-down list, etc. Of course, the embodiment of the present application does not limit the triggering method of the control, for example, it can be a single click, a double click, a gesture, a voice trigger, etc.
[0090] The engine deployment configuration control is used to obtain the parameters selected or input by the user, which are used as the topology parameters of the blockchain engine. The topology parameters can enable the test system to fully automatically configure Fabric and build the operating environment of Fabric. The embodiment of the present application does not limit the topology parameters. For example, it can be used to indicate the number of endorsement nodes and sorting nodes, the distribution strategy of nodes on the physical machine cluster, the physical machine model and performance configuration of the node, etc. The node in the embodiment of the present application refers to the node in the Fabric operating environment.
[0091] The contract deployment configuration control is used to obtain the parameters selected or input by the user, which are used as contract parameters for loading smart contracts. The contract parameters can enable the test system to automatically load the smart contract indicated by the contract parameters on each node in the Fabric operating environment. The embodiment of the present application does not limit the contract parameters. For example, it can be the address of a smart contract among several preset smart contracts, or it can be the contract address of a user-defined smart contract.
[0092] The test parameter configuration control is used to obtain the parameters selected or input by the user, which are used as parameters for automated testing. The test parameters can instruct the test system what test tasks to perform and how to perform the test tasks.
[0093] Please refer to Figure 5 , which shows a schematic diagram of the test system visual interface, which can display a test configuration page 501, which includes an engine deployment configuration control 502, a contract deployment configuration control 503, and a test parameter configuration control 504, which are used to configure the topology parameters, contract parameters, and test parameters of the blockchain engine, respectively. In some embodiments, the test system (a system for automatically testing blockchain engines) presets some common test parameters used in performance testing and chaos testing scenarios, and also supports users to select test scenarios independently. Testers can build some common test tasks by checking the test configuration interface, or they can customize test tasks.
[0094] S402. In response to the trigger operation for the above-mentioned engine deployment configuration control, obtain the topology parameters corresponding to the blockchain engine; in response to the trigger operation for the above-mentioned contract deployment configuration control, obtain the contract parameters, and the above-mentioned contract parameters point to the contract running based on the above-mentioned blockchain engine; in the case of obtaining the trigger operation for the above-mentioned test parameter configuration control, obtain the test parameters.
[0095] By triggering each control in the test configuration page, the topology parameters, contract parameters and test parameters of the blockchain engine can be obtained. Of course, in some embodiments, if the user does not trigger a control, the default test parameters can also be used.
[0096] In one embodiment, the above-mentioned test parameter configuration control includes a test type configuration control, and the above-mentioned test parameters are obtained when a trigger operation for the above-mentioned test parameter configuration control is obtained, including: when the above-mentioned test type configuration control is configured as a chaos test, the first test element configuration area is displayed, and the above-mentioned first test element configuration area is used to select at least one of the following fault test elements: node failure, network failure, input and output failure, domain name resolution failure, communication failure; the above-mentioned test parameters are obtained based on the selection result of the above-mentioned at least one fault test element.
[0097] Please refer to Figure 6 , which shows a schematic diagram of a test configuration page. The parameter configuration control 504 can be used to select a test type. Figure 6 The left figure shows the first test element configuration area. If the parameter configuration control is configured as a chaos test, the following five fault test elements can be provided, namely, node fault, network fault, input / output fault, domain name resolution fault, and communication fault. Specifically, the fault test element corresponding to node fault can test faults such as node restart and node unavailability; the fault test element corresponding to network fault can test faults such as network delay, network packet loss, and network partition; the fault test element corresponding to input / output fault (I / O fault) can test faults such as IO delay, read / write failure, and full disk space; the fault test element corresponding to domain name resolution fault (DNS fault) can test faults such as DNS domain name resolution failure and DNS domain name resolution returning an incorrect IP. The fault test element corresponding to communication fault can be used to test HTTP link communication delay.
[0098] In another embodiment, when the above-mentioned test type configuration control is configured as a performance test, a second test element configuration area can be displayed, and the above-mentioned second test element configuration area is used to select at least one of the following performance test elements: system performance test, system endorsement performance test, system consensus performance test; and the above-mentioned test parameters are obtained based on the selection result of the above-mentioned at least one performance test element.
[0099] Please refer to Figure 6 The middle figure shows the second test element configuration area. If the parameter configuration control is configured as a performance test, the following three performance test elements can be provided, namely, system performance test, system endorsement performance test, and system consensus performance test. Specifically, the test element corresponding to the system performance test can trigger the test system to concurrently call each node and perform stress tests on each node, thereby testing the overall performance of the blockchain engine. The test element corresponding to the system endorsement performance test can trigger the test system to send requests only to the endorsement node to test the endorsement performance. The test element corresponding to the system consensus performance test can trigger the test system to send requests only to the consensus node to test the consensus performance.
[0100] In one embodiment, please refer to Figure 6 In the right figure, when the system performance test is selected, it displays the third test element configuration area, and the third test element configuration area is used to select at least one of the following stress test elements: stress test based on access to native applications, stress test based on remote procedure calls, and stress test based on non-native applications; the test parameters are obtained based on the selection result of the at least one stress test element. The embodiment of the present application does not limit the access method of native applications, and it can use the software development kit officially specified by Fabric. The method of stress testing based on remote procedure calls can be based on the Protobuf message template for communication between Fabric nodes, directly constructing the gRPC message required in the transaction process and sending it to the corresponding node to complete the transaction, which is lighter and more free than native applications. Protobuf refers to ProtocolBuffers, which is a language-independent, platform-independent, and extensible method of serializing structured data, which can be used for (data) communication protocols, data storage, etc. The information transmitted during communication is packaged through the data structure defined by Protobuf, and then compiled into a binary code stream for transmission or storage. The embodiments of the present application are not limited to non-native applications, and various third-party stress testing tools can be connected to complete end-to-end testing.
[0101] S403. Perform target node extraction processing on the physical machine cluster, and create a target system running the above-mentioned blockchain engine based on the extraction results, wherein each target node in the above-mentioned target system forms a topology corresponding to the above-mentioned topology parameters.
[0102] The target system is the operating environment of Fabric and the test object of the test system. That is to say, the test object is automatically constructed by the test system based on the physical machine cluster according to the topological parameters input by the user. The embodiment of the present application does not limit the specific method of construction. In fact, the topological parameters can be considered to include all the information used to build the target system. According to the topological parameters, each physical machine in the physical machine cluster can be selected to obtain the nodes used to build the target system, specify the endorsement nodes and consensus nodes in these nodes, and establish the topological relationship between these nodes to obtain the target system.
[0103] S404. Load the target contract at each of the above target nodes according to the above contract parameters.
[0104] In an embodiment of the present application, a target contract is obtained according to the above-mentioned contract parameters; code detection is performed on the above-mentioned target contract to obtain a code detection result, and the above-mentioned code detection includes at least one of the following: code standardization detection, code security detection, and code dependency detection; when the above-mentioned code detection result indicates that the above-mentioned target contract meets the loading requirements, the above-mentioned target contract is loaded at each of the above-mentioned target nodes.
[0105] This application does not limit the loading requirements, which can be set according to the actual situation. For example, the target contract can be loaded if the code is determined to be in compliance with the normativeness and security specified by the blockchain engine and the dependencies are fully determined. Code normativeness detection can avoid syntax errors in contract code, and code security detection can avoid security risks in the code. If some third-party public libraries are used in the contract, the code of these libraries needs to be obtained before deployment, that is, the code dependencies are determined.
[0106] S405. Test each of the target nodes according to the test parameters to obtain test results, and display the test results on a result display page.
[0107] In an embodiment of the present application, the test system can automatically communicate with each node according to the above-mentioned test parameters to perform stress testing, chaos testing, endorsement performance testing or consensus performance testing, and display the test results on the page to achieve the purpose of automation and visualization.
[0108] In one embodiment, each of the above-mentioned target nodes can be tested based on the above-mentioned test parameters, and the physical machine status information corresponding to each of the above-mentioned target nodes and the blockchain engine performance information corresponding to each of the above-mentioned target nodes can be detected during the test process; the above-mentioned test results are generated based on the above-mentioned physical machine status information and the above-mentioned blockchain engine performance information. The embodiment of the present application does not limit the physical machine status information, for example, it may include at least one of the following: CPU usage, memory usage, disk IO usage status, network IO status. The blockchain engine performance information is also not limited, which may include at least one of the following contents corresponding to the relevant nodes: block height, total number of transactions, endorsement time, consensus time. In the actual test process, the content of the blockchain engine performance information and / or the physical machine status information can be set as needed, and the relevant nodes can be detected according to these contents to obtain the test results.
[0109] The embodiment of the present application supports the tester to visually configure the test parameters, the topological parameters corresponding to the blockchain engine, and the contract parameters according to the actual test requirements of the blockchain engine by displaying the test configuration page, and the test process is fully automatically completed on the basis of obtaining the test parameters, the topological parameters corresponding to the blockchain engine, and the contract parameters. Specifically, the target system can be automatically constructed on the basis of the physical machine cluster based on the topological parameters, and this target system is the operating environment of the blockchain engine. In this operating environment, the smart contract is automatically loaded based on the contract parameters, and the blockchain engine running the smart contract is tested according to the test parameters and the visual results are automatically displayed. In other words, the embodiment of the present application provides an automated, visual test system for testing the blockchain engine, which can test the performance of the blockchain engine under various smart contract running conditions, thereby solving the technical problems that the related technical test process and test data cannot be reused, reducing the dependence on testers, reducing the difficulty of testing, improving test efficiency and ensuring test quality.
[0110] In one embodiment, the testing method is applied to a system for automatically testing a blockchain engine, the system comprising: a display module, a target system building module, a contract deployment module, a test module and a physical machine cluster, the target system building module, the contract deployment module and the test module are respectively connected to the display module through a first interface layer, and the target system building module, the contract deployment module and the test module are respectively connected to the physical machine cluster through a second interface layer.
[0111] The specific implementation of the first interface layer and the second interface layer is not described in detail in the embodiment of the present application. The role of these interface layers is only to complete the interaction between modules. These interface layers can be implemented by setting relevant application program interfaces. Taking the first interface layer as an example, it can receive test parameters, and then interact with subsequent modules step by step according to the content of the parameters to complete the entire test process. For some more complex test scenarios, a test configuration file can also be received, which is written by the tester according to the configuration file specification of the test system, so that the first interface layer can recognize the test configuration file, and trigger the subsequent module work based on the test configuration file to complete the entire test process.
[0112] For example, the topology parameters indicate that there are 4 endorsement nodes and 3 consensus nodes, and the contract parameters indicate the corresponding test contract, and the test parameters indicate the way to send pressure. After the parameter parsing function of the first interface layer parses these parameters, the parsing results are transmitted to the target system building module, contract deployment module and test module respectively. The target system building module, contract deployment module and test module deploy the corresponding Fabric network in the physical machine cluster through the second interface layer, then deploy the contract, and then the test module sends pressure. For some complex scenarios, the parameters provided by the display module may not meet the test requirements. For this, a configuration file specification can also be specified. Testers can write test process configuration files according to the specifications based on their own test requirements. The first interface layer can parse the configuration file content and trigger the test based on the parsing results. This configuration file method is more flexible than directly visually configuring parameters, but the learning cost is higher. In essence, the two are the same. The parameters configured visually will eventually be converted into a configuration file for parsing by the first interface layer.
[0113] Specifically, the target system construction module can also be responsible for the orchestration of containers. Based on the topology parameters, it selects physical machines that meet the requirements in the physical machine cluster to deploy Fabric nodes, and builds a Fabric test network that meets the test requirements, that is, the target system.
[0114] The contract deployment module can perform code checks on the contracts to be deployed, obtain code dependencies, and then package and send the contracts to the Fabric node for contract deployment. At the same time, the module provides a test contract template library, which pre-sets a variety of common smart contracts for testing in various test scenarios. You can directly select the contract in the template library for deployment.
[0115] Please refer to Figure 7, which shows a logical structure diagram of a system for automatically testing a blockchain engine. The test system includes: a display module 701, a target system construction module 702, a contract deployment module 703, a test module 704 and a physical machine cluster 705. Among them, the display module 701 can display the above-mentioned test configuration page; and, display the above-mentioned test results on the result display page. The above-mentioned target system construction module 702 can perform target node extraction processing on the physical machine cluster, and create and run the above-mentioned target system based on the extraction results. The above-mentioned contract deployment module 703 loads the target contract on each of the above-mentioned target nodes according to the above-mentioned contract parameters. The above-mentioned test module 704 tests each of the above-mentioned target nodes according to the above-mentioned test parameters.
[0116] In one embodiment, the system for automatically testing the blockchain engine also includes: a log processing module 706 and a detection module 707. The detection module 707 detects the physical machine status information corresponding to each of the above target nodes and the blockchain engine performance information corresponding to each of the above target nodes during the test, and sends the detected information to the display module; the log processing module 706 obtains and processes the logs in each of the above target nodes, and sends the processing results to the display module. The log processing module 706 can be mainly responsible for analyzing the logs generated by each node in the Fabric network (target system), and can analyze each link in the entire transaction process according to the logs output by the pre-embedded points to understand the performance and bottlenecks of each link.
[0117] In one embodiment, the test module 704 further includes: a chaos test submodule 7041 and a performance test submodule 7042. When the test type configuration control is configured as a chaos test, the chaos test submodule 7041 injects faults into each of the target nodes according to the test parameters; when the test type configuration control is configured as a performance test, the performance test submodule 7042 tests each of the target nodes according to the test parameters. The performance test submodule 7042 includes a native application call submodule, a remote procedure call submodule and a non-native application access module. The performance test submodule 7042 tests each of the target nodes according to the test parameters, including: when performing a stress test based on accessing a native application, the native application call submodule calls the native application to test each of the target nodes; when performing a stress test based on a remote procedure call, the remote procedure call submodule tests each of the target nodes by executing a preset remote call program; when performing a stress test based on a non-native application, the non-native application access submodule triggers the non-native application to test each of the target nodes. Among them, the chaos test submodule 7041 is mainly responsible for the chaos test of the Fabric network. This module generates various possible faults in the distributed system and injects them into the physical machine where the Fabric network node is located, so as to test the system robustness of the Fabric network under different faults.
[0118] In a specific implementation, please refer to Figure 8 , which shows a schematic diagram of the test process flow:
[0119] (1) Test parameter input
[0120] Select the parameters required for this test through the test configuration page. These parameters include but are not limited to the following information: the topology of the Fabric network, the consensus parameters of the Fabric network, the machine configuration of the endorsement node and the consensus node, the chain code to be installed, the way to send pressure for performance testing, and the type of faults that need to be injected for chaos testing, etc. You can also describe the test process by writing a test configuration file and import the test configuration file into the test system through the test configuration page. The test configuration file is written by the tester according to the specifications specified by the test system, which can be more flexible and customized.
[0121] (2)Environment deployment.
[0122] The first interface layer in the test system parses the received parameters, drives the target system construction module and the contract deployment module to select qualified machines in the physical machine cluster to build a new test network (target system) and deploy the corresponding contract.
[0123] (3) Start the test.
[0124] The test module obtains the test type based on the parameters parsed by the first interface layer. If the test type indicates system performance testing, the method of sending stress is selected according to the relevant test elements, thereby sending a request to the Fabric network. If the test type indicates chaos testing, the required fault type is generated and the fault is injected into the corresponding node.
[0125] (4) Test result output
[0126] The detection module reports the status of each node of the target system and the status of the corresponding physical machine to the display module for display in real time during the test. After the test is completed, the log processing module collects the logs output by each node during the test and calls the corresponding log analysis program for analysis, and reports the analysis results to the display module. The display module visually displays the analysis results and generates a download link for the test report.
[0127] (5) Iterative testing
[0128] The tester determines whether the current test has achieved its purpose based on the generated test report and various data observed in real time during the test process. If not, the test parameters are adjusted for the next round of testing.
[0129] The embodiment of the present application designs an automated and visual test method for testing the blockchain engine and a test system for running the test method, which can perform performance testing and chaos testing on the blockchain engine, and can also support access to third-party applications, thereby having scalable testing capabilities. For example, it can support the deployment of networks and contracts for blockchain engines, send pressure, inject distributed faults and other functions, and reduce the burden on testers. For different performance testing and chaos testing scenarios, the target system can be quickly and easily built for testing by entering parameters on the test configuration page or writing a configuration file to describe the test process. The status of each node during the test and the test results are visually displayed on the result display page. The embodiment of the present application can preset multiple sets of commonly used test contracts, provide a variety of pressure sending methods and distributed fault types for testers to use, and provide an interface layer for parsing parameters to drive the entire test process.
[0130] The above test method integrates the test process. For common performance testing and chaos testing scenarios, the target system can be quickly and automatically deployed for testing. For some more customized test requirements, the tester can support the automatic test process based on the file by writing relevant files under the preset specifications, which significantly improves the adaptability to different test scenarios. Compared with the manual testing solution that completely relies on the tester in the related technology, the embodiment of the present application has the following significant advantages:
[0131] First, reduce network deployment costs: The embodiment of the present application automatically deploys the target system to be tested based on network topology parameters and target system building modules, and can quickly select machines that meet the test requirements from machine clusters of different models and different performances for deployment and contract installation, thereby reducing deployment costs.
[0132] Second, the framework is more versatile: the test method proposed in the embodiment of the present application can change the test input parameters of the system or fine-tune the framework to complete different tests according to actual test needs.
[0133] Third, the framework is more extensible: the test method proposed in the embodiment of the present application is extensible, and new modules are added according to the protocol of the interface layer to complete the adaptive test scenario. The modules are decoupled and their functions do not affect each other.
[0134] Fourth, visualization: During the test process, the status of each node of the target system and the corresponding physical machine status can be reflected in real time, and the test results can be directly displayed after the test is completed.
[0135] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0136] Please refer to Fig. 9 , which shows a block diagram of a device for automatically testing a blockchain engine provided by an embodiment of the present application. The device has the function of implementing the above-mentioned method for automatically testing a blockchain engine, and the above-mentioned function can be implemented by hardware, or by hardware executing corresponding software. The device can be a computer device, or can be set in a computer device. The device may include:
[0137] Display module 901, used to display a test configuration page, which includes an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control;
[0138] The parameter acquisition module 902 is used to obtain the topology parameters corresponding to the blockchain engine in response to the trigger operation for the engine deployment configuration control; to obtain the contract parameters in response to the trigger operation for the contract deployment configuration control, the contract parameters pointing to the contract running based on the blockchain engine; and to obtain the test parameters in case of obtaining the trigger operation for the test parameter configuration control;
[0139] The test module 903 is used to extract the target nodes from the physical machine cluster, create a target system for running the blockchain engine based on the extraction results, and each target node in the target system forms a topology corresponding to the topology parameters; load the target contract on each target node according to the contract parameters; test each target node according to the test parameters to obtain the test results;
[0140] The display module 904 is also used to display the test results on the result display page.
[0141] In one embodiment, the test module 9034 is used to perform the following operations:
[0142] Get the target contract based on the above contract parameters;
[0143] Perform code detection on the target contract to obtain a code detection result, wherein the code detection includes at least one of the following: code standardization detection, code security detection, and code dependency detection;
[0144] When the code detection result indicates that the target contract meets the loading requirements, the target contract is loaded at each of the target nodes.
[0145] In one embodiment, the test parameter configuration control includes a test type configuration control, and the parameter acquisition module 902 is used to perform the following operations:
[0146] In the case where the test type configuration control is configured as a chaos test, a first test element configuration area is displayed, and the first test element configuration area is used to select at least one of the following fault test elements: node fault, network fault, input / output fault, domain name resolution fault, communication fault; and the test parameters are obtained based on the selection result of the at least one fault test element;
[0147] or,
[0148] When the above-mentioned test type configuration control is configured as a performance test, a second test element configuration area is displayed, and the above-mentioned second test element configuration area is used to select at least one of the following performance test elements: system performance test, system endorsement performance test, system consensus performance test; the above-mentioned test parameters are obtained based on the selection result of the above-mentioned at least one performance test element.
[0149] In one embodiment, the parameter acquisition module 902 is used to perform the following operations: when the system performance test is selected, a third test element configuration area is displayed, and the third test element configuration area is used to select at least one of the following stress test elements: stress testing based on accessing native applications, stress testing based on remote procedure calls, and stress testing based on non-native applications; the test parameters are obtained based on the selection result of the at least one stress test element.
[0150] In one embodiment, the test module 903 is used to perform the following operations:
[0151] Testing each of the above target nodes based on the above test parameters, and detecting physical machine status information corresponding to each of the above target nodes and blockchain engine performance information corresponding to each of the above target nodes during the test;
[0152] The above test results are generated based on the above physical machine status information and the above blockchain engine performance information.
[0153] In one embodiment, the test device includes a system for automatically testing a blockchain engine, the system including: a display module, a target system construction module, a contract deployment module, a test module and a physical machine cluster, the target system construction module, the contract deployment module and the test module are respectively connected to the display module through a first interface layer, and the target system construction module, the contract deployment module and the test module are respectively connected to the physical machine cluster through a second interface layer.
[0154] The display module is used to display the test configuration page; and display the test results on the result display page;
[0155] The target system building module is used to extract target nodes from the distributed system and create and run the target system based on the extraction results.
[0156] The contract deployment module is used to load the target contract on each of the target nodes according to the contract parameters;
[0157] The test module is used to test each of the target nodes according to the test parameters.
[0158] In one embodiment, the test system further includes: a log processing module and a detection module, wherein the detection module is used to detect the physical machine status information corresponding to each of the target nodes and the blockchain engine performance information corresponding to each of the target nodes during the test, and send the detected information to the display module;
[0159] The log processing module is used to obtain and process the logs in each of the target nodes, and send the processing results to the display module.
[0160] In one embodiment, the above-mentioned test module also includes: a chaos test sub-module and a performance test sub-module. When the above-mentioned test type configuration control is configured as a chaos test, the above-mentioned chaos test sub-module is used to inject faults into each of the above-mentioned target nodes according to the above-mentioned test parameters; when the above-mentioned test type configuration control is configured as a performance test, the above-mentioned performance test sub-module is used to test each of the above-mentioned target nodes according to the above-mentioned test parameters.
[0161] In one embodiment, the performance testing submodule includes a native application calling submodule, a remote procedure calling submodule and a non-native application access module. When performing stress testing based on accessing native applications, the native application calling submodule is used to call native applications to test each of the above-mentioned target nodes; when performing stress testing based on remote procedure calls, the remote procedure calling submodule is used to test each of the above-mentioned target nodes by executing a preset remote call program; when performing stress testing based on non-native applications, the non-native application access submodule is used to trigger the non-native application to test each of the above-mentioned target nodes.
[0162] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0163] Please refer to Fig.10 , which shows a block diagram of a system for automatically testing a blockchain engine provided by an embodiment of the present application. The system has the function of implementing the above-mentioned method for automatically testing a blockchain engine, and the above-mentioned function can be implemented by hardware, or by hardware executing corresponding software. The system can be a computer device, or can be set in a computer device. The system can include:
[0164] The system includes: a display module 1001, a target system construction module 1002, a contract deployment module 1003, a test module 1004 and a physical machine cluster 1005. The target system construction module 1002, the contract deployment module 1003 and the test module 1004 are respectively connected to the display module 1001 through a first interface layer 1006, and the target system construction module 1002, the contract deployment module 1003 and the test module 1004 are respectively connected to the physical machine cluster 1005 through a second interface layer 1007.
[0165] The display module 1001 is used to display a test configuration page, which includes an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control; in response to a trigger operation on the engine deployment configuration control, the topology parameters corresponding to the blockchain engine are obtained; in response to a trigger operation on the contract deployment configuration control, the contract parameters are obtained, and the contract parameters point to a contract running based on the blockchain engine; in the case of obtaining a trigger operation on the test parameter configuration control, the test parameters are obtained;
[0166] The target system construction module 1002 is used to perform target node extraction processing on the physical machine cluster 1005, and create a target system running the blockchain engine based on the extraction results, wherein each target node in the target system forms a topology corresponding to the topology parameters;
[0167] The contract deployment module 1003 is used to load the target contract on each of the target nodes according to the contract parameters;
[0168] The test module 1004 is used to test each of the target nodes according to the test parameters to obtain a test result;
[0169] The display module 1001 is also used to display the test results on the result display page.
[0170] It should be noted that the system provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0171] Further, Fig.11 A schematic diagram of the hardware structure of a device for implementing the method provided in the embodiment of the present application is shown. The above device may participate in constituting or include the apparatus or system provided in the embodiment of the present application. Fig.11As shown, the device 11 may include one or more processors 112 (shown as 112a, 112b, ..., 112n in the figure), the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 114 for storing data, and a transmission device 116 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Fig.11 The structure shown is for illustration only and does not limit the structure of the electronic device. Fig.11 More or fewer components as shown, or with Fig.11 Different configurations are shown.
[0172] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the device 11 (or mobile device). As involved in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0173] The memory 114 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the above-mentioned method in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 114, that is, realizing the above-mentioned method of automatically testing the blockchain engine. The memory 114 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 114 may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the device 11 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0174] The transmission device 116 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by the communication provider of the device 11. In one example, the transmission device 116 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 116 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.
[0175] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the device 11 (or mobile device).
[0176] Fig.12 is a block diagram of an electronic device according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Fig.12 As shown, the electronic device is used to implement or participate in the implementation of a method for automatically testing a blockchain engine. The electronic device includes a processor, a memory, and a network interface connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for automatically testing a blockchain engine is implemented.
[0177] Those skilled in the art will understand that Fig.12 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0178] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program. The above program may be stored in a computer-readable storage medium, and the above storage medium may be a read-only memory, a disk or an optical disk, etc.
[0179] The instructions in the storage medium may execute a method for automatically testing a blockchain engine, the method comprising:
[0180] Display the test configuration page, which includes engine deployment configuration controls, contract deployment configuration controls, and test parameter configuration controls;
[0181] In response to a trigger operation on the engine deployment configuration control, obtaining topology parameters corresponding to the blockchain engine;
[0182] In response to a triggering operation on the contract deployment configuration control, obtaining contract parameters, the contract parameters pointing to the contract running based on the blockchain engine;
[0183] When a trigger operation for the test parameter configuration control is obtained, the test parameters are obtained;
[0184] Perform target node extraction processing on the physical machine cluster, and create a target system running the above blockchain engine based on the extraction results, wherein each target node in the above target system forms a topology corresponding to the above topology parameters;
[0185] Load the target contract on each of the above target nodes according to the above contract parameters;
[0186] Testing each of the above target nodes according to the above test parameters to obtain test results;
[0187] The above test results are displayed on the result display page.
[0188] In one embodiment, the loading of the target contract at each of the target nodes according to the contract parameters includes:
[0189] Get the target contract based on the above contract parameters;
[0190] Perform code detection on the target contract to obtain a code detection result, wherein the code detection includes at least one of the following: code standardization detection, code security detection, and code dependency detection;
[0191] When the code detection result indicates that the target contract meets the loading requirements, the target contract is loaded at each of the target nodes.
[0192] In one embodiment, the test parameter configuration control includes a test type configuration control, and when a trigger operation for the test parameter configuration control is obtained, obtaining the test parameters includes:
[0193] In the case where the test type configuration control is configured as a chaos test, a first test element configuration area is displayed, and the first test element configuration area is used to select at least one of the following fault test elements: node fault, network fault, input / output fault, domain name resolution fault, communication fault; and the test parameters are obtained based on the selection result of the at least one fault test element;
[0194] or,
[0195] When the above-mentioned test type configuration control is configured as a performance test, a second test element configuration area is displayed, and the above-mentioned second test element configuration area is used to select at least one of the following performance test elements: system performance test, system endorsement performance test, system consensus performance test; the above-mentioned test parameters are obtained based on the selection result of the above-mentioned at least one performance test element.
[0196] In one embodiment, when the system performance test is selected, the test parameters are obtained based on the selection result of the at least one performance test element, including:
[0197] The third test element configuration area is displayed, and the third test element configuration area is used to select at least one of the following stress test elements: stress testing based on accessing native applications, stress testing based on remote procedure calls, and stress testing based on non-native applications; the above-mentioned test parameters are obtained based on the selection result of the above-mentioned at least one stress test element.
[0198] In one embodiment, the test results obtained by testing each of the target nodes according to the test parameters include:
[0199] Testing each of the above target nodes based on the above test parameters, and detecting physical machine status information corresponding to each of the above target nodes and blockchain engine performance information corresponding to each of the above target nodes during the test;
[0200] The above test results are generated based on the above physical machine status information and the above blockchain engine performance information.
[0201] In one embodiment, the method is applied to a system for automatically testing a blockchain engine, the system comprising: a display module, a target system building module, a contract deployment module, a test module and a physical machine cluster, the target system building module, the contract deployment module and the test module are respectively connected to the display module through a first interface layer, and the target system building module, the contract deployment module and the test module are respectively connected to the physical machine cluster through a second interface layer.
[0202] The display of the test configuration page includes: the display module displays the test configuration page; the display of the test result on the result display page includes: the display module displays the result display page including the test result;
[0203] The above-mentioned target node extraction processing is performed on the physical machine cluster, and the target system for running the above-mentioned blockchain engine is created based on the extraction results, including: the above-mentioned target system construction module performs target node extraction processing on the physical machine cluster, and creates and runs the above-mentioned target system based on the extraction results;
[0204] The above-mentioned loading the target contract at each of the above-mentioned target nodes according to the above-mentioned contract parameters includes: the above-mentioned contract deployment module loading the target contract at each of the above-mentioned target nodes according to the above-mentioned contract parameters;
[0205] The above-mentioned testing of each of the above-mentioned target nodes according to the above-mentioned test parameters includes: the above-mentioned test module tests each of the above-mentioned target nodes according to the above-mentioned test parameters.
[0206] In one embodiment, the test system further includes: a log processing module and a detection module, and the method further includes:
[0207] During the test, the detection module detects the physical machine status information corresponding to each of the target nodes and the blockchain engine performance information corresponding to each of the target nodes, and sends the detected information to the display module;
[0208] The log processing module obtains and processes the logs in each of the target nodes, and sends the processing results to the display module.
[0209] In one embodiment, the test module further includes: a chaos test submodule and a performance test submodule, and the test of each of the target nodes according to the test parameters includes:
[0210] In the case where the test type configuration control is configured as a chaos test, the chaos test submodule injects faults into each of the target nodes according to the test parameters;
[0211] In the case where the test type configuration control is configured as a performance test, the performance test submodule tests each of the target nodes according to the test parameters.
[0212] In one embodiment, the performance test submodule includes a native application call submodule, a remote procedure call submodule and a non-native application access module, and the performance test submodule tests each of the target nodes according to the test parameters, including:
[0213] In the case of performing stress testing based on accessing native applications, the native application calling submodule calls the native application to test each of the target nodes;
[0214] In the case of stress testing based on remote procedure calls, the remote procedure call submodule tests each of the target nodes by executing a preset remote call program;
[0215] In the case of performing stress testing based on a non-native application, the non-native application access submodule triggers the non-native application to test each of the target nodes.
[0216] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description and does not represent the advantages and disadvantages of the embodiments. And the above-mentioned specific embodiments of the embodiments of the present application are described. Other embodiments are within the scope of the attached claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0217] Each embodiment in the embodiments of the present application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and server embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0218] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0219] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for automatically testing a blockchain engine, characterized in that: The method comprises: Display a test configuration page, the test configuration page including an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control; In response to a trigger operation on the engine deployment configuration control, obtaining topology parameters corresponding to the blockchain engine; In response to a triggering operation on the contract deployment configuration control, obtaining a contract parameter, wherein the contract parameter points to a contract running based on the blockchain engine; In case of obtaining a trigger operation for the test parameter configuration control, obtaining the test parameters; Performing target node extraction processing on the physical machine cluster, and creating a target system for running the blockchain engine based on the extraction result, wherein each target node in the target system forms a topology corresponding to the topology parameter; Loading the target contract at each of the target nodes according to the contract parameters; Testing each of the target nodes according to the test parameters to obtain a test result; The test results are displayed on the result display page.
2. The method according to claim 1, characterized in that The loading of the target contract at each target node according to the contract parameters includes: Obtain the target contract according to the contract parameters; Performing code detection on the target contract to obtain a code detection result, wherein the code detection includes at least one of the following: code standardization detection, code security detection, and code dependency detection; When the code detection result indicates that the target contract meets the loading requirements, the target contract is loaded at each target node.
3. The method according to claim 1 or 2, characterized in that: The test parameter configuration control includes a test type configuration control, and when a trigger operation for the test parameter configuration control is obtained, obtaining the test parameter includes: In the case where the test type configuration control is configured as a chaos test, a first test element configuration area is displayed, and the first test element configuration area is used to select at least one of the following fault test elements: node failure, network failure, input and output failure, domain name resolution failure, communication failure; the test parameter is obtained based on the selection result of the at least one fault test element; or, When the test type configuration control is configured as a performance test, a second test element configuration area is displayed, and the second test element configuration area is used to select at least one of the following performance test elements: system performance test, system endorsement performance test, system consensus performance test; and the test parameters are obtained based on the selection result of the at least one performance test element.
4. The method according to claim 3, characterized in that In the case where the system performance test is selected, obtaining the test parameter based on the selection result of the at least one performance test element includes: A third test element configuration area is displayed, and the third test element configuration area is used to select at least one of the following stress test elements: stress testing based on accessing native applications, stress testing based on remote procedure calls, and stress testing based on non-native applications; and the test parameters are obtained based on the selection result of the at least one stress test element.
5. The method according to claim 1, characterized in that The step of testing each of the target nodes according to the test parameters to obtain a test result includes: Testing each of the target nodes based on the test parameters, and detecting physical machine status information corresponding to each of the target nodes and blockchain engine performance information corresponding to each of the target nodes during the test; The test result is generated according to the physical machine status information and the blockchain engine performance information.
6. The method according to claim 1, characterized in that The method is applied to a system for automatically testing a blockchain engine, the system comprising: a display module, a target system construction module, a contract deployment module, a test module and a physical machine cluster, the target system construction module, the contract deployment module and the test module are respectively connected to the display module through a first interface layer, and the target system construction module, the contract deployment module and the test module are respectively connected to the physical machine cluster through a second interface layer, The displaying of the test configuration page comprises: the display module displays the test configuration page; the displaying of the test result on the result display page comprises: the display module displays the result display page including the test result; The target node extraction process is performed on the physical machine cluster, and the target system for running the blockchain engine is created based on the extraction result, including: the target system construction module performs target node extraction process on the physical machine cluster, and creates and runs the target system based on the extraction result; The loading of the target contract at each target node according to the contract parameters comprises: the contract deployment module loading the target contract at each target node according to the contract parameters; The testing each of the target nodes according to the test parameters includes: the testing module testing each of the target nodes according to the test parameters.
7. The method according to claim 6, characterized in that The test system further includes: a log processing module and a detection module, and the method further includes: The detection module detects the physical machine status information corresponding to each of the target nodes and the blockchain engine performance information corresponding to each of the target nodes during the test, and sends the detected information to the display module; The log processing module obtains and processes the logs in each of the target nodes, and sends the processing results to the display module.
8. The method according to claim 6, characterized in that The test module further includes: a chaos test submodule and a performance test submodule, and the testing of each of the target nodes according to the test parameters includes: In the case where the test type configuration control is configured as a chaos test, the chaos test submodule performs fault injection into each of the target nodes according to the test parameters; In the case where the test type configuration control is configured as a performance test, the performance test submodule tests each of the target nodes according to the test parameters.
9. The method according to claim 8, characterized in that The performance test submodule includes a native application call submodule, a remote procedure call submodule and a non-native application access module. The performance test submodule tests each of the target nodes according to the test parameters, including: In the case of performing stress testing based on accessing a native application, the native application calling submodule calls the native application to test each of the target nodes; In the case of performing stress testing based on remote procedure calls, the remote procedure call submodule tests each of the target nodes by executing a preset remote call program; In the case of performing stress testing based on a non-native application, the non-native application access submodule triggers the non-native application to test each of the target nodes.
10. A device for automatically testing a blockchain engine, characterized in that: The device comprises: A display module, used to display a test configuration page, wherein the test configuration page includes an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control; A parameter acquisition module, for acquiring topology parameters corresponding to the blockchain engine in response to a trigger operation on the engine deployment configuration control; acquiring contract parameters in response to a trigger operation on the contract deployment configuration control, wherein the contract parameters point to a contract running based on the blockchain engine; and acquiring test parameters in the case of acquiring a trigger operation on the test parameter configuration control; A test module is used to perform target node extraction processing on a physical machine cluster, create a target system for running the blockchain engine based on the extraction result, and each target node in the target system forms a topology corresponding to the topology parameter; load the target contract on each target node according to the contract parameter; test each target node according to the test parameter to obtain a test result; The display module is also used to display the test results on the result display page.
11. A system for automatically testing a blockchain engine, characterized in that: The system includes: a display module, a target system construction module, a contract deployment module, a test module and a physical machine cluster, wherein the target system construction module, the contract deployment module and the test module are respectively connected to the display module through a first interface layer, and the target system construction module, the contract deployment module and the test module are respectively connected to the physical machine cluster through a second interface layer. The display module is used to display a test configuration page, which includes an engine deployment configuration control, a contract deployment configuration control, and a test parameter configuration control; in response to a trigger operation on the engine deployment configuration control, obtain topology parameters corresponding to the blockchain engine; in response to a trigger operation on the contract deployment configuration control, obtain contract parameters, the contract parameters pointing to a contract running based on the blockchain engine; in the case of obtaining a trigger operation on the test parameter configuration control, obtain test parameters; The target system construction module is used to perform target node extraction processing on the physical machine cluster, and create a target system running the blockchain engine based on the extraction result, wherein each target node in the target system forms a topology corresponding to the topology parameter; The contract deployment module is used to load the target contract on each target node according to the contract parameters; The test module is used to test each of the target nodes according to the test parameters to obtain a test result; The display module is also used to display the test results on the result display page.
12. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the method for automatically testing a blockchain engine as described in any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the method for automatically testing the blockchain engine as described in any one of claims 1 to 9.
14. A computer program product, characterized in that The computer program product 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 to implement the method of automatically testing a blockchain engine as described in any one of claims 1 to 9.
