Application testing method and device based on block chain and computer equipment

By using the blockchain network to obtain the environment data of the application deployment environment, and constructing a matching test environment, the problem of inaccurate testing environment simulation in the existing technology is solved, and the accuracy of application testing is improved.

CN119690812APending Publication Date: 2025-03-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311220473.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-20
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

Existing application testing methods are difficult to ensure effective simulation of various application environments, resulting in low test accuracy.

Method used

The environment data of the application deployment environment is obtained through the synchronous nodes in the blockchain network, and a test environment that matches the application deployment environment is built based on the data, and the test is carried out in this environment.

Benefits of technology

Reduces environmental differences between the test environment and the actual deployment environment, and improves the authenticity and accuracy of the test.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690812A_ABST
    Figure CN119690812A_ABST
Patent Text Reader

Abstract

The invention relates to an application testing method and device based on a block chain, computer equipment, a storage medium and a computer program product. The embodiment of the invention can be applied to various scenes such as cloud technology, artificial intelligence, intelligent traffic, auxiliary driving and the like. The method comprises the following steps: determining an application deployment environment to be tested for an application; acquiring environment data of the application deployment environment through a synchronization node in a block chain network associated with the application deployment environment; the environment data is data which is stored by each block chain node in the block chain network and is used for describing the operation process of the application in the application deployment environment; and constructing an application test environment matched with the application deployment environment based on the environment data, and testing the application through the environment data in the application test environment. By adopting the method, the accuracy of application testing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a blockchain-based application testing method, apparatus, computer equipment, storage medium, and computer program product. Background Art

[0002] With the development of computer technology, various software applications have been widely used, such as online shopping applications, social applications, video applications, game applications, office applications, etc., which greatly facilitate people's work and life. In the process of software application development, application testing is a key link to ensure the quality of software application products. It can detect and fix potential problems by testing the functions, performance and stability of the application, thereby ensuring the normal operation of the software application.

[0003] However, the operation of software applications involves a variety of different environments, such as development environment, pre-production environment and production environment. The current application testing methods are difficult to ensure effective simulation of various application environments, resulting in low accuracy of application testing. Summary of the invention

[0004] Based on this, it is necessary to provide a blockchain-based application testing method, device, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of application testing in response to the above technical problems.

[0005] In a first aspect, the present application provides a blockchain-based application testing method, comprising:

[0006] Determine the application deployment environment for the application to be tested;

[0007] Obtain the environment data of the application deployment environment through the synchronization node in the blockchain network associated with the application deployment environment; the environment data is the data stored by each blockchain node in the blockchain network and is used to describe the running process of the application in the application deployment environment;

[0008] Build an application test environment that matches the application deployment environment based on the environment data, and test the application using the environment data in the application test environment.

[0009] In a second aspect, the present application also provides an application testing device based on blockchain, comprising:

[0010] A deployment environment determination module, used to determine an application deployment environment for an application to be tested;

[0011] The environment data acquisition module is used to obtain the environment data of the application deployment environment through the synchronization node in the blockchain network associated with the application deployment environment; the environment data is the data stored by each blockchain node in the blockchain network and is used to describe the running process of the application in the application deployment environment;

[0012] The test execution module is used to build an application test environment that matches the application deployment environment based on the environment data, and to test the application through the environment data in the application test environment.

[0013] In a third aspect, the present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above blockchain-based application testing method when executing the computer program.

[0014] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above blockchain-based application testing method.

[0015] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above blockchain-based application testing method.

[0016] The above-mentioned blockchain-based application testing method, device, computer equipment, storage medium and computer program product, for the application deployment environment to be tested for the application, obtains the environmental data of the application deployment environment through the synchronization node in the blockchain network associated with the application deployment environment, the environmental data is stored by each blockchain node in the blockchain network and is used to describe the running process of the application in the application deployment environment, builds an application test environment matching the application deployment environment based on the environmental data, and tests the application in the application test environment through the environmental data. Through the synchronization node in the blockchain network associated with the application deployment environment, obtain the environmental data stored by each blockchain node in the blockchain network that describes the running process of the application in the application deployment environment, and build a matching application test environment based on the environmental data to test the application, and use the environmental data stored by each blockchain node in the blockchain network based on the consensus mechanism to build the application test environment, which can reduce the environmental difference between the application test environment and the application deployment environment to be tested, improve the authenticity of the application test, and thus improve the accuracy of the application test. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A schematic diagram of the structure of a blockchain system in one embodiment;

[0018] Figure 2 is a schematic diagram of a block structure in one embodiment;

[0019] Figure 3 An application environment diagram of a blockchain-based application testing method in one embodiment;

[0020] Figure 4 A flowchart of a blockchain-based application testing method in one embodiment;

[0021] Figure 5 A schematic diagram of a server blockchain network communication connection in one embodiment;

[0022] Figure 6 A schematic diagram of another embodiment in which a server joins a blockchain network as a synchronization node;

[0023] Figure 7 It is a schematic diagram of testing a food delivery application in one embodiment;

[0024] Figure 8 A schematic diagram of a process for synchronously obtaining environmental data in one embodiment;

[0025] Fig. 9 A schematic diagram of an architecture for application testing in different deployment environments in an embodiment;

[0026] Fig.10 A timing diagram for synchronously obtaining environmental data in one embodiment;

[0027] Fig.11 A schematic diagram of performing rollback data processing in one embodiment;

[0028] Fig.12 It is a structural block diagram of an application testing device based on blockchain in one embodiment;

[0029] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

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

[0032] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and 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 valid requests to storage after consensus is reached. For a new business request, the basic service first adapts the interface for parsing and authentication (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration and issuance of contracts, contract triggering and contract execution. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the key or other events are called to trigger the execution and complete the contract logic. It also provides the function of contract upgrade and cancellation. The operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarm, monitoring network status, monitoring node equipment health status, etc. The platform product service layer provides the basic capabilities and implementation framework of typical applications. Developers can complete the blockchain implementation of business logic based on these basic capabilities and superimpose business characteristics. The application service layer provides application services based on blockchain solutions for business participants to use.

[0033] The system involved in the embodiments of the present application may be a distributed system formed by connecting a client and multiple nodes (any form of computing devices in an access network, such as a server and a user terminal) through network communication.

[0034] Take the distributed system as the blockchain system as an example, see Figure 1 , Figure 1This is an optional structural diagram of the distributed system 100 provided in the embodiment of the present application applied to the blockchain system, which is formed by multiple nodes (any form of computing devices in the access network, such as servers, user terminals) and clients, and a point-to-point network is formed between the nodes. The point-to-point network protocol is an application layer protocol running on the Transmission Control Protocol (TCP). 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.

[0035] See also Figure 1 The functions of each node in the blockchain system shown include:

[0036] 1) Routing: a basic function of a node, used to support communication between nodes.

[0037] In addition to the routing function, the node can also have the following functions:

[0038] 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.

[0039] For example, the services implemented by the application include:

[0040] 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;

[0041] 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.

[0042] 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.

[0043] 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.

[0044] See also Figure 2 , Figure 2 This is an optional schematic diagram of the block structure provided by the embodiment of the present application. 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.

[0045] The blockchain-based application testing method provided in the embodiment of the present application can be applied to Figure 3In the application environment shown. Among them, the terminal 302 communicates with the server 304 through the network. The data storage system can store the data that the server 304 needs to process. The data storage system can be integrated on the server 304, or it can be placed on the cloud or other servers. The application to be tested can be installed on the terminal 302, and the user can run the application through the terminal 302 to obtain the service provided by the application, such as the user can run the music application through the terminal 302 to play music. The server 304 can test the application running in the terminal 302. For the application deployment environment to be tested for the application, it can be specifically the environment in which the user runs the application based on the terminal 302. The server 304 obtains the environmental data of the application deployment environment through the synchronization node in the blockchain network associated with the application deployment environment. The environmental data is stored by each blockchain node in the blockchain network and is used to describe the running process of the application in the application deployment environment. The server 304 builds an application test environment that matches the application deployment environment based on the environmental data, and tests the application through the environmental data in the application test environment. In addition, the application testing method based on blockchain can also be implemented by the terminal 302 alone, such as the terminal 302 can perform test processing on the application that needs to be tested.

[0046] Among them, the terminal 302 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, aircraft, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 304 can be implemented with an independent server or a server cluster composed of multiple servers. The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.

[0047] In one embodiment, Figure 4 As shown, a blockchain-based application testing method is provided. The method is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 3 The server in the example is used to illustrate, including the following steps 402 to 406. Among them:

[0048] Step 402: Determine an application deployment environment for the application to be tested.

[0049] Among them, application is also called application program or software, which refers to a computer program for completing one or more specific tasks. The application deployment environment is the operating environment of the application to be tested, which may include but is not limited to at least one of the local environment, development environment, test environment, pre-production environment or production environment. Different operating environments have different uses. Among them, the local environment may refer to the environment where application developers create and modify application codes locally; the development environment may refer to the environment shared by the development team; the test environment may refer to the environment for performing various test processes on the developed application; the pre-production environment refers to the environment that simulates the production environment; and the production environment is the environment in which the application actually runs, which may be an environment that runs on the terminal to provide users with corresponding functional services. When the application runs in different application deployment environments, different execution results may be generated. Therefore, it is necessary to determine the environment in which the application is located for testing, so as to accurately test the different execution results caused by differences in the operating environment.

[0050] Specifically, the server can determine the application that needs to be tested. The operation of the application involves different environments, and different execution results may be generated when the application is run in different environments. For example, music application A can run normally in the development environment, but after the product is launched, in the production environment, when each user officially uses music application A, operation errors may occur, such as the inability to play music normally when a certain terminal device runs music application A. When testing errors in music application A, it is necessary to simulate the corresponding production environment in order to obtain more realistic and accurate test results. The server determines the application deployment environment for the application to be tested. The application deployment environment can include one or more operating environments, so that the application can be accurately tested according to the operating environment.

[0051] In a specific application, a user can specify an application deployment environment through a test request. Specifically, a user can send a test request for an application to a server. The test request can carry an environment identifier. The server can determine the application deployment environment to be tested for the application based on the environment identifier in the test request. Exemplarily, when the application deployment environment includes multiple operating environments, the server can perform test logic analysis based on the multiple operating environments to determine the test sequence and corresponding test items of various operating environments. The test sequence indicates the order of the tests, and the test items indicate the test content that needs to be tested when the application is running in the corresponding operating environment. Specifically, it can include but is not limited to at least one of functional testing, performance testing, security testing, or user interface testing.

[0052] Step 404, obtain the environment data of the application deployment environment through the synchronization node in the blockchain network associated with the application deployment environment; the environment data is the data stored by each blockchain node in the blockchain network and is used to describe the running process of the application in the application deployment environment.

[0053] Among them, various operating environments of applications can be associated with blockchain networks, so that the running process of applications in corresponding operating environments can be recorded through various blockchain nodes in the blockchain network, such as the execution data and configuration information of applications in corresponding operating environments. A synchronization node is a node that keeps synchronization with other nodes in the blockchain network. The synchronization node will download and verify the transaction history and block data of the entire blockchain to ensure the consistency and security of the network. Environmental data is data that describes the running process of an application in the application deployment environment, which can specifically include the configuration information of the application during the running process and the corresponding business data. The business data can include the code, input and corresponding execution results of the application; the application can be configured through the configuration information to restore the application running environment, and the business data can be compared with the test data of the application to obtain the test results of the application. The environmental data is stored by each blockchain node in the blockchain network, and can be stored by each blockchain node based on the consensus mechanism.

[0054] Specifically, the server can determine the blockchain network associated with the application deployment environment, and can specifically determine the associated blockchain network based on the environment identifier of the application deployment environment. In specific applications, each operating environment can be set to be associated with the corresponding blockchain network, and each blockchain node in the associated blockchain network stores data describing the application's running process under the operating environment. The server can establish a mapping relationship with the blockchain network based on the environment identifier of the operating environment, so that the corresponding associated blockchain network can be queried using the environment identifier based on the mapping relationship. The blockchain network includes multiple blockchain nodes, which can be divided into synchronization nodes and consensus nodes. Synchronization nodes keep in sync with other blockchain nodes, but do not participate in consensus processing; while consensus nodes are blockchain nodes in the blockchain network that participate in the consensus processing process.

[0055] The server determines the synchronization node from the blockchain network associated with the application deployment environment, and obtains the environment data of the application deployment environment through the synchronization node. In a specific application, the synchronization node determined by the server may be an existing synchronization node in the blockchain network, and the server may directly obtain the environment data of the application deployment environment from the existing synchronization node. For example, the server may directly obtain the environment data of the application deployment environment from the local blockchain data of the synchronization node. Figure 5As shown, the blockchain network 500 associated with the application deployment environment includes a consensus node 501 and a synchronization node 502. The server 503 communicates with the blockchain network 500 through the network. When the server 503 tests the application, it can obtain the environmental data of the application deployment environment from the synchronization node 502 that already exists in the blockchain network 500 for testing. The synchronization node determined by the server can also be a synchronization node newly added to the blockchain network. The server can first perform synchronization processing based on the newly added synchronization node to keep the data of the newly added synchronization node consistent with other blockchain nodes in the blockchain network, and then obtain the environmental data of the application deployment environment from the local blockchain data of the newly added synchronization node. Figure 6 As shown, the blockchain network 600 associated with the application deployment environment includes a consensus node 601 and a synchronization node 602. The server 603 can be added to the blockchain network 600, and specifically can serve as a synchronization node in the blockchain network 600. The server 603 can obtain environmental data of the application deployment environment from each blockchain node of the blockchain network 600 for testing.

[0056] In specific applications, the environmental data stored in each blockchain node in the blockchain network can describe the different running processes of the application in the application deployment environment. Different running processes can generate corresponding environmental data. The environmental data can be continuously stored in the blockchain network in the form of blocks, that is, the blockchain network can store environmental data corresponding to the historical running process of the application. The server can obtain the environmental data corresponding to the specific running process according to actual needs to test the application. Exemplarily, the server can filter from the blockchain data of the synchronization node locally, such as according to the test range in the test request, which can specifically include the running time range, and filter from the blockchain data of the synchronization node locally to obtain the environmental data that needs to be tested. For example, the environmental data of application A running in the production environment is stored in the blockchain network B. In a certain time period C, application A has a large number of faults, such as application A cannot be opened, cannot be connected to the Internet, cannot provide functions, etc. When the server needs to test application A in the production environment in the time period C, it can obtain the environmental data D stored in the time period C from the blockchain network B, so as to perform a restoration test on the application based on the environmental data D, which is conducive to improving the accuracy of the test.

[0057] Step 406: construct an application test environment that matches the application deployment environment based on the environment data, and test the application in the application test environment using the environment data.

[0058] The application test environment is the operating environment built for testing the application. The application test environment matches the application deployment environment, and can specifically be an environment that simulates the application deployment environment, thereby restoring the corresponding operating environment. The test items for testing the application can be flexibly set according to actual needs, and can specifically include regression testing and forward compatibility and backward compatibility testing. Regression testing can include but is not limited to at least one of functional testing, performance testing, security testing, or user interface testing.

[0059] Specifically, the server can use the environmental data to build an application test environment, and the application test environment matches the application deployment environment. The application test environment can specifically be an environment that simulates the application deployment environment. In specific implementation, the server can configure the application based on the configuration information in the environmental data, thereby building an application test environment that matches the application deployment environment. The server tests the application under the application test environment, and can specifically test the application through the environmental data, such as comparing the business data in the environmental data with the test data obtained by testing the application under the application test environment, so as to obtain the test results of the application based on the comparison results. In addition, the application test environment can also be other scenarios based on the expansion of the application deployment environment. The specific server can perform data enhancement on the environmental data, such as adjusting the configuration information in the environmental data to obtain enhanced environmental data. The server can build different application test environments based on the enhanced environmental data, and use the enhanced environmental data to test the application under the different constructed application test environments, and can expand different operating environments for testing.

[0060] In a specific application, such as Figure 7 As shown, the user can browse and order food through the takeaway application running on the terminal 704. The environmental data of the takeaway application in the operating environment is stored by each blockchain node in the blockchain network 700, that is, the operating environment of the takeaway application is associated with the blockchain network 700, and the data of the takeaway application in the running process under the operating environment will be stored by the blockchain network 700. When it is determined that the application deployment environment to be tested for the takeaway application is the operating environment, the blockchain network 700 associated with the application deployment environment includes a consensus node 701 and a synchronization node 702, and the consensus node 701 and the synchronization node 702 can store the environmental data of the takeaway application in the running process under the application deployment environment. The server 703 can establish a network connection with the blockchain network 700 to obtain environmental data from the synchronization node 702, and build an application test environment based on the obtained environmental data to test the takeaway application.

[0061] In the above-mentioned blockchain-based application testing method, for the application deployment environment to be tested for the application, the environment data of the application deployment environment is obtained through the synchronization node in the blockchain network associated with the application deployment environment. The environment data is stored by each blockchain node in the blockchain network and is used to describe the running process of the application in the application deployment environment. An application test environment matching the application deployment environment is constructed based on the environment data, and the application is tested under the application test environment through the environment data. Through the synchronization node in the blockchain network associated with the application deployment environment, the environment data stored by each blockchain node in the blockchain network that describes the running process of the application in the application deployment environment is obtained, and a matching application test environment is constructed based on the environment data to test the application. The application test environment is constructed using the environment data stored by each blockchain node in the blockchain network based on the consensus mechanism, which can reduce the environmental difference between the application test environment and the application deployment environment to be tested, improve the authenticity of the application test, and thus improve the accuracy of the application test.

[0062] In one embodiment, environmental data of the application deployment environment is obtained through a synchronization node in the blockchain network associated with the application deployment environment, including: determining the blockchain network associated with the application deployment environment; adding an independently running blockchain node to the blockchain network as a synchronization node; and synchronizing the environmental data of the application deployment environment from each blockchain node in the blockchain network through the synchronization node.

[0063] The application deployment environment is associated with the corresponding blockchain network to store the environment data of the application in the application deployment environment through the blockchain network. The independently running blockchain node can be specifically a Solo Node, which is also known as an independent node or a standalone node. The independently running blockchain node does not rely on other nodes for consensus and is usually used in private blockchain networks or test networks so that developers can conduct experiments and development without affecting the main network.

[0064] Specifically, the server can determine the blockchain network associated with the application deployment environment, and the specific server can determine the environment identifier of the application deployment environment, and determine the associated blockchain network based on the environment identifier query. For example, the server can query the pre-built mapping relationship, and query the blockchain network corresponding to the environment identifier of the application deployment environment based on the mapping relationship. Exemplarily, the server can also pre-set the blockchain node for storing the corresponding environment data for each application deployment environment. When the server needs to obtain the environment data, the server can determine the blockchain node, and determine the blockchain network associated with the application deployment environment based on the network where the blockchain node is located. The server can determine an independently running blockchain node, and the independently running blockchain node can specifically be a blockchain Solo node. The server adds the independently running blockchain node to the blockchain network as a synchronization node. In the specific implementation, the server itself can be an independently running blockchain node, that is, the application testing method based on the blockchain can be implemented by an independently running blockchain node, then the server can add itself as a synchronization node to the blockchain network associated with the application deployment environment.

[0065] After joining the blockchain network, the server can establish a communication connection with each blockchain node in the blockchain network, so that the environment data of the application deployment environment can be synchronized from each blockchain node in the blockchain network through the synchronization node. For example, as a newly joined node, the synchronization node can send block synchronization requests to each blockchain node in the blockchain network to obtain block data from each blockchain node, and the block data includes the environment data of the application deployment environment.

[0066] In this embodiment, the service area adds an independently running blockchain node as a synchronization node to the blockchain network associated with the application deployment environment, so as to synchronize the environmental data of the application deployment environment from the blockchain network through the synchronization node. The environmental data stored in each blockchain node of the blockchain network is recorded based on a consensus mechanism, which can ensure the accuracy of the obtained environmental data. By using the environmental data to build an application test environment, the environmental difference between the application test environment and the application deployment environment to be tested can be reduced, the authenticity of the application test can be improved, and thus the accuracy of the application test can be improved.

[0067] In one embodiment, Figure 8 As shown, the process of synchronously obtaining environmental data, that is, synchronously obtaining environmental data of the application deployment environment from each blockchain node of the blockchain network through a synchronization node, includes:

[0068] Step 802, a block synchronization request is sent to each blockchain node of the blockchain network through the synchronization node; the block synchronization request is used to instruct the corresponding receiving blockchain node to send the stored block data to the synchronization node.

[0069] Among them, the block synchronization request is sent by the synchronization node to each blockchain node of the blockchain network to instruct the receiving blockchain node to share its stored block data with the synchronization node. The block data is the data of each block stored by the blockchain node.

[0070] Specifically, after an independently running blockchain node is added to the blockchain network as a synchronization node, the synchronization node can establish a network connection with each blockchain node in the blockchain network to obtain the data of the blockchain network for real-time update. The synchronization node can generate a block synchronization request and send the block synchronization request to each blockchain node in the blockchain network through the synchronization node to instruct the corresponding blockchain node that receives the block synchronization request to share the stored block data with the synchronization node. In a specific application, the synchronization node, as a newly added node, sends a block synchronization request that can instruct the blockchain node to share all block data, thereby obtaining all environmental data recorded by the blockchain network.

[0071] In addition, the synchronization node can also send a block synchronization request according to actual test needs, which can instruct the blockchain node to share part of the block data. Specifically, it can perform selective synchronization according to the block data involved in the application test, thereby avoiding synchronization of all block data, which is conducive to improving the processing efficiency of the application test. For example, when testing an application, it is necessary to test the environmental data in time period A under the application deployment environment. If the current block number is up to 1000, and the block data corresponding to the environmental data in time period A belongs to blocks 500-600, then the block synchronization request sent by the synchronization node can instruct the blockchain node to share the block data corresponding to blocks 1-600, so that the server can obtain the test processing for the environmental data in time period A based on the block data corresponding to blocks 500-600.

[0072] Step 804, receiving block data sent by each blockchain node.

[0073] Specifically, after sending block synchronization requests to each blockchain node through the synchronization node, the server can wait for each blockchain node to share block data and receive the block data shared by each blockchain node.

[0074] Step 806: When the received block data passes verification, the environment data of the application deployment environment is obtained according to the received block data.

[0075] Among them, verification can be a check process for the received block data to ensure the validity of the received block data. Verification can specifically include verification of various elements in the block, such as hash value, timestamp, block height, etc., and can also include verification of transaction signatures.

[0076] Specifically, the server can verify the received block data, including verification of the hash value, timestamp, and block height within the block, and verification of the transaction signature of the block to obtain a verification result. If the verification result indicates that the verification is passed, the server can obtain the environmental data of the application deployment environment based on the received block data. For example, the server can extract environmental data used to describe the running process of the application in the application deployment environment from the received block data. The extracted environmental data may specifically include configuration information and business data. In a specific application, if the verification result for the received block data indicates that the verification fails, it indicates that the validity of the received block data cannot be guaranteed. The server can return to the process of sending block synchronization requests to each blockchain node of the blockchain network through the synchronization node, thereby re-obtaining valid block data.

[0077] In this embodiment, the server sends a block synchronization request to each blockchain node of the blockchain network through the synchronization node to instruct the blockchain node to send the stored block data to the synchronization node. When the received block data passes the verification, the server obtains the environmental data of the application deployment environment based on the received block data. The environmental data is shared by each blockchain node of the blockchain network and is verified, which can ensure the accuracy of the obtained environmental data. By using the environmental data to build an application test environment, the environmental difference between the application test environment and the application deployment environment to be tested can be reduced, the authenticity of the application test can be improved, and thus the accuracy of the application test can be improved.

[0078] In one embodiment, the blockchain-based application testing method also includes: when a block update event is triggered in the blockchain network, the block data to be updated associated with the block update event is synchronously obtained from each blockchain node in the blockchain network through the synchronization node; when the block data to be updated meets the synchronization judgment condition, the block data to be updated is stored in the local end of the synchronization node.

[0079] Among them, the block update event refers to the event in which a block in the blockchain network is updated, and specifically, it can be an event in which a new block is added to the blockchain network. The block data to be updated is associated with the block update event, and specifically, it can be the block data that needs to be updated based on the block update event. For example, when the block update event is a block addition event, the block data to be updated can be the block data corresponding to the block that needs to be added to the blockchain network. The synchronization judgment condition is used to determine whether the block data to be updated needs to be stored in the local end of the synchronization node. Specifically, it can be determined based on the verification result of the block data to be updated. If the block data to be updated passes the verification, it can be considered that the synchronization judgment condition is met.

[0080] Specifically, the server can detect events in the blockchain network. When it is detected that the blockchain network triggers a block update event, it indicates that the block data needs to be updated in the blockchain network. Then, the server can obtain the block data to be updated associated with the block update event through the synchronization node. Exemplarily, the server can generate a block synchronization request and send the block synchronization request to each blockchain node of the blockchain network to instruct the blockchain node that receives the block synchronization request to share the block data to be updated with the synchronization node. After the server receives the block data to be updated through the synchronization node, it can determine whether the synchronization determination condition is met for the block data to be updated. When it is determined that the synchronization determination condition is met, the server can store the received block data to be updated, specifically in the blockchain database of the local end of the synchronization node. The synchronization determination condition can be flexibly set according to actual needs. In specific implementation, the synchronization determination condition can include passing verification, that is, when the block data to be updated passes verification, it can be considered that the synchronization determination condition is met; the synchronization determination condition can also include meeting a preset rule, such as when the generation time of the block data to be updated meets the preset time rule, it can be considered that the synchronization determination condition is met.

[0081] In this embodiment, when a block update event is triggered in the blockchain network, the server synchronizes the block data to be updated from each blockchain node of the blockchain network through the synchronization node, and when the block data to be updated meets the synchronization judgment condition, the block data to be updated is stored in the local end of the synchronization node, so that the synchronization node and each blockchain node of the blockchain network can maintain data consistency, ensuring the accuracy of the data stored locally in the synchronization node, and performing application testing based on the data stored locally in the synchronization node to ensure the accuracy of the test.

[0082] In one embodiment, environmental data of the application deployment environment is obtained through a synchronization node in the blockchain network associated with the application deployment environment, including: determining the blockchain network associated with the application deployment environment, and an application test version to be tested for the application; determining test block data corresponding to the application test version from block data stored by the synchronization node in the blockchain network; and obtaining environmental data of the application deployment environment based on the test block data.

[0083] Among them, the application test version refers to the version that needs to be tested for the application, which can be set according to the test needs. In the process of continuous updating, multiple application versions can be formed, and the application test version is the version that needs to be tested. For example, application B includes version 1, version 2, version 3 and version 4, version 1 is the first released version, and version 4 is the latest version. When testing application B, the application test version may include at least one version from version 1 to version 4. The test block data is the block data corresponding to the application test version. The test block data may include the environment data corresponding to the application test version, and may specifically include the configuration information and business data of the application test version. The business data may include the application code, input and execution results corresponding to the application test version.

[0084] Specifically, the server can determine the blockchain network associated with the application deployment environment, and can specifically determine the associated blockchain network according to the environment identifier of the application deployment environment. The server can determine the application test version to be tested for the application, and can specifically determine it according to the test request for the application, such as extracting the application test version to be tested from the test request. The server determines the block data stored by the synchronization node in the blockchain network, and obtains the test block data corresponding to the application test version from the block data stored by the synchronization node. For example, the server can determine the application version corresponding to each block data stored by the synchronization node, and determine that the application version is the test block data corresponding to the application test version. The synchronization node can be a node newly added to the blockchain network and synchronized to the block data from other blockchain nodes; the synchronization node can also be a node that already exists in the blockchain network. The server obtains the environment data of the application deployment environment based on the determined test block data, and can specifically parse the test block data to obtain the environment data of the application deployment environment. The environment data can specifically include configuration information and business data of the application test version.

[0085] In this embodiment, the server obtains the test block data corresponding to the application test version from the block data stored by the synchronization node in the blockchain network, and obtains the environmental data of the application deployment environment based on the test block data, so that accurate test block data can be obtained based on the block data stored by the synchronization node. Based on the test block data, environmental data can be obtained to test the application test version of the application, which is conducive to reducing the environmental difference between the application test environment and the application deployment environment to be tested, improving the authenticity of the application test, and thus improving the accuracy of the application test.

[0086] In one embodiment, test block data corresponding to the application test version is determined from block data stored in a synchronization node in a blockchain network, including: determining a test block from a block tree of a synchronization node according to the application test version; when the test block belongs to a historical block, performing a block rollback and reconstruction based on the block tree to obtain a reconstructed block tree; obtaining block data of the test block according to the reconstructed block tree, and obtaining test block data corresponding to the application test version according to the block data of the test block.

[0087] Among them, the block tree is the data structure when the synchronization node stores block data, which can specifically include the storage structure of the MPT (Merkle Patricia Tree) tree. The MPT tree is a tree structure that combines the Merkle Tree and the Patricia Tree (compressed prefix tree). The Merkle tree algorithm calculates a Hash value for each transaction, and then connects two by two to calculate the Hash again, all the way to the top-level Merkle root. The MPT tree storage structure can save data at a historical height, and can roll back the data to a specified historical version when necessary. The nodes of the MPT tree are immutable, which means that when the status is updated, a new node will be created and the old node will remain in the database, so the status of the historical version of the node in the blockchain platform still exists in the tree and will not be overwritten. In the MPT tree, each block contains an associated state root, namely the MPT tree root hash, which represents the global state of the corresponding block. The MPT tree records the state root of each block, thereby constructing the historical version point of the blockchain, and these state roots are traceable on the blockchain. In addition, since updating an MPT node creates a new node instead of directly modifying an existing node, the database saves the previous nodes and their status, so historical versions of MPT can be rebuilt and accessed through the state root on the blockchain.

[0088] The test block is a block in the block tree that stores the environment data corresponding to the application test version. The test block belongs to the historical block, and the application test version is a historical version. The block tree needs to be rebuilt by block rollback, that is, the blocks in the block tree need to be returned to the test block, so as to achieve the reconstruction of the block tree. According to the reconstructed block tree, the block data of the test block can be obtained, and further the test block data corresponding to the application test version can be obtained.

[0089] Specifically, the server can determine the block tree of the synchronization node, and determine the test block corresponding to the application test version in the block tree, such as the server can determine the application version corresponding to each block in the block tree, and determine the test block corresponding to the application test version based on the application version corresponding to the block. The server determines whether the test block belongs to a historical block. If the test block belongs to a historical block, it indicates that the application test version belongs to a historical version. The server can perform a block rollback reconstruction on the block tree to roll back and rebuild the block tree to the test block to obtain a reconstructed block tree. In a specific implementation, the server can perform a rollback reconstruction based on the state root that represents the block state in the block tree to obtain a reconstructed block tree. The server obtains the block data of the test block based on the reconstructed block tree. The reconstructed block tree is restored to the historical state corresponding to the test block. The server can obtain the block data of the test block based on the reconstructed block tree. Specifically, the block data of the test block can be extracted from the reconstructed block tree. The server obtains the test block data corresponding to the application test version according to the block data of the test block. Specifically, the server can directly use the block data of the test block as the test block data corresponding to the application test version.

[0090] In this embodiment, when the server determines that the test block is a historical block, it performs block rollback reconstruction based on the block tree to obtain a reconstructed block tree, and obtains block data of the test block based on the reconstructed block tree, and further obtains test block data corresponding to the application test version, so that the test block data can be accurately obtained by utilizing the traceability of the block tree, and testing the application based on the test block data is conducive to improving the accuracy of application testing.

[0091] In one embodiment, when the test block belongs to a historical block, the block is rolled back and rebuilt based on the block tree to obtain a reconstructed block tree, including: determining a test state root of the test block according to the block tree; rolling back and reconstructing each state root in the block tree until the rollback and reconstruction are to the test state root to obtain a reconstructed block tree; the state root represents the state of the block in the block tree.

[0092] Among them, the test state root refers to the state root of the test block in the block tree. The state root can be the MPT tree root hash, which represents the state of the block in the block tree. In the MPT tree, each block contains an associated state root, namely the MPT tree root hash, which represents the global state of the corresponding block. The MPT tree records the state root of each block, thereby constructing the historical version point of the blockchain. These state roots are traceable on the blockchain.

[0093] Specifically, the server determines the test state root of the test block based on the block tree. Specifically, the server can query the block tree to determine the test state root of the test block. The server rolls back and rebuilds each state root in the block tree based on the test state root. Specifically, because the historical nodes are stored in the database, the server can start from the test state root, recursively access and build the MPT containing the historical state data, until the rollback and reconstruction to the test state root are completed, and the reconstructed block tree is obtained. The server obtains the block data of the test block based on the reconstructed block tree. The reconstructed block tree is restored to the historical state corresponding to the test block. The server can obtain the block data of the test block according to the reconstructed block tree. Specifically, the block data of the test block can be extracted from the reconstructed block tree.

[0094] In this embodiment, the server rolls back and rebuilds each state root in the block tree until it rolls back and rebuilds to the test state root of the test block, obtains a reconstructed block tree, and obtains block data of the test block based on the reconstructed block tree, and further obtains test block data corresponding to the application test version, so that the traceability of the state root in the block tree can be used to accurately obtain the test block data, and testing the application based on the test block data is conducive to improving the accuracy of application testing.

[0095] In one embodiment, the blockchain-based application testing method further includes: when the test block does not belong to the historical block, obtaining block data of the test block; and obtaining test block data corresponding to the application test version based on the block data of the test block.

[0096] Among them, the test block does not belong to the historical block, indicating that the test processing for the test block does not require block rollback and reconstruction, then the server can directly obtain the test block data corresponding to the application test version based on the block data of the test block. Specifically, when the server determines that the test block does not belong to the historical block, it indicates that the application test version belongs to the latest version of the application, then the server directly obtains the block data of the test block, specifically, the block data of the test block can be obtained from the block tree of the synchronization node. The server obtains the test block data corresponding to the application test version based on the block data of the test block, specifically, the server can directly use the block data of the test block as the test block data corresponding to the application test version.

[0097] In this embodiment, when the server determines that the test block does not belong to a historical block, the server directly obtains the block data of the test block, and further obtains the test block data corresponding to the application test version. Accurate test block data can be obtained from the block data stored in the synchronization node. Testing the application based on the test block data is beneficial to improving the accuracy of application testing.

[0098] In one embodiment, environmental data of the application deployment environment is obtained through a synchronization node in the blockchain network associated with the application deployment environment, including: determining the blockchain network associated with the application deployment environment; obtaining environmental data of the application deployment environment by calling a smart contract created for the application by the synchronization node in the blockchain network; the smart contract is created by the synchronization node based on the environmental data synchronized from the blockchain network.

[0099] Among them, smart contracts are created by synchronizing nodes based on environmental data synchronized from the blockchain network. Smart contracts are a piece of code stored in blockchain nodes. The logic of the code defines the rules of the contract. Smart contracts contain all information about transactions and will only execute the result operation after the requirements are met. Smart contracts run on shared and replicated ledgers and can process information, receive, store and send value. Blockchain stores states, and smart contracts are the way blockchain is used for state transition. Smart contracts are not just a computer program that can be executed automatically, but also a system participant that can respond to received information, receive and store value, and send information and value to the outside. Based on the environmental data synchronized from the blockchain network, smart contracts are created for applications, and smart contracts can be called when testing applications to obtain environmental data of the application deployment environment.

[0100] Specifically, the server can determine the blockchain network associated with the application deployment environment, and determine the smart contract created by the synchronization node for the application. The smart contract is pre-created by the synchronization node based on the environment data synchronized from the blockchain network. The server can obtain the environment data of the application deployment environment by calling the smart contract. In a specific application, the smart contract can be deployed in the synchronization node of the blockchain network. The server can call the smart contract through the synchronization node to access the corresponding database, and obtain the environment data of the application deployment environment from the accessed database. For example, the server can start the application to call the smart contract to access the database, and obtain the environment data of the application deployment environment from the accessed database.

[0101] In this embodiment, the server obtains the environmental data of the application deployment environment by calling the smart contract created by the synchronization node in the blockchain network. The environmental data can be obtained based on the smart contract, which is conducive to ensuring the security of the environmental data and improving the efficiency of obtaining and processing environmental data, which is conducive to improving the processing efficiency of application testing.

[0102] In one embodiment, environmental data of the application deployment environment is obtained by calling a smart contract created by a synchronization node in a blockchain network for an application, including: obtaining configuration information for the application by calling a configuration information smart contract created by a synchronization node in a blockchain network for an application; obtaining business data of the application by calling a database smart contract created by a synchronization node for an application; and obtaining environmental data of the application deployment environment based on the configuration information and business data.

[0103] Among them, the smart contracts created by the synchronization nodes in the blockchain network for the application include configuration information smart contracts and database smart contracts. The configuration information smart contract stores the configuration information for the application, and the database smart contract stores the business data of the application. The business data may specifically include the application code, input, and corresponding execution results, etc.

[0104] Specifically, the server can call the configuration information smart contract created by the synchronization node in the blockchain network for the application to obtain the configuration information for the application. For example, the server can start the application to call the configuration information smart contract to access the configuration information database and obtain the configuration information for the application from the configuration information database. The server calls the database smart contract created by the synchronization node for the application to obtain the business data of the application. For example, the server can call the database smart contract to access the business database when the application starts, and obtain the business data of the application from the business database. The server obtains the environmental data of the application deployment environment based on the configuration information and business data, and can specifically obtain the environmental data based on the combination of configuration information and business data.

[0105] In this embodiment, the server obtains configuration information and business data by calling the configuration information smart contract and database smart contract created by the synchronization node in the blockchain network, and further obtains the environmental data of the application deployment environment. The environmental data can be obtained based on the two smart contracts, which is conducive to ensuring the security of the environmental data and improving the efficiency of obtaining and processing environmental data, which is conducive to improving the processing efficiency of application testing.

[0106] In one embodiment, the environment data includes configuration information for the application and business data of the application; an application test environment matching the application deployment environment is constructed based on the environment data, and the application is tested using the environment data under the application test environment, including: constructing an application test environment matching the application deployment environment based on the configuration information; testing the application under the application test environment to obtain test data; and obtaining test results for the application based on the test data and business data.

[0107] The environment data includes configuration information for the application and business data of the application. The business data may include application code, input, and corresponding execution results. The configuration information is used to build an application test environment. Specifically, the application can be configured through the configuration information so that the application is in the application test environment. The test data is the execution result obtained by testing the application in the application test environment. The test result of the application can be obtained based on the test data and business data.

[0108] Specifically, the server can build an application test environment that matches the application deployment environment based on the configuration information in the environment data, and test the application in the application test environment, such as running the application in the application test environment to test various test items and obtain test data. The server obtains test results for the application based on the test data and business data, such as comparing the test data and the business data, and obtaining test results for the application based on the comparison results. For example, if the test data and the business data are consistent, it indicates that the business data has been reproduced, and if there is an operational failure in the business data, the failure of the application has been reproduced; if the test data and the business data are inconsistent, it indicates that the business data has not been reproduced, and if there is an operational failure in the business data, the failure of the application has not been reproduced.

[0109] In this embodiment, the server builds an application test environment through the configuration information in the environment data, and tests the application under the application test environment, and obtains the test results for the application based on the obtained test data and business data, thereby using the environment data stored by each blockchain node in the blockchain network based on the consensus mechanism to build an application test environment, which can reduce the environmental difference between the application test environment and the application deployment environment to be tested, improve the authenticity of the application test, and thus improve the accuracy of the application test.

[0110] In one embodiment, building an application test environment that matches the application deployment environment based on configuration information includes: configuring the application through the configuration information when the application is started to obtain the application test environment that matches the application deployment environment.

[0111] Specifically, the server can start the application. When the application starts, the server can configure the application through configuration information so that the application runs in an application test environment that matches the application deployment environment, thereby creating an application test environment that matches the application deployment environment.

[0112] Further, testing the application in the application test environment to obtain test data includes: in the application test environment, running the configured application according to the test item to obtain test data corresponding to the test item.

[0113] The test items are test contents for testing the application, and may specifically include but are not limited to at least one of various test contents including functional regression testing, performance regression testing, security regression testing, user interface regression testing, compatibility regression testing, forward compatibility testing and backward compatibility testing. Specifically, the server runs the application in the application test environment, and runs the configured application according to the predetermined test items, and the application generates test data corresponding to the test items.

[0114] In this embodiment, the server configures the application through configuration information, enables the application to run in the application test environment, and runs the configured application according to the test project to obtain test data corresponding to the test project, thereby achieving true and accurate testing of the application.

[0115] The present application also provides an application scenario, which applies the above-mentioned blockchain-based application testing method. Specifically, the application of the blockchain-based application testing method in this application scenario is as follows:

[0116] In the process of software application development, software testing is a key link to ensure product quality. It can detect and fix potential problems by testing the program's functions, performance, and stability. Traditional software testing methods can be divided into two categories: manual testing and automated testing. Although they have achieved certain success in some aspects, existing software testing methods still face some shortcomings and challenges, such as the difference between the test environment and the production environment, and the complexity of data and configuration management. Specifically, there is a large difference between the test environment and the production environment in traditional software testing technology, that is, it is difficult to ensure that the test environment can fully simulate the production environment, which may cause some problems to not be discovered during the testing phase; and the data and configuration management in traditional software testing technology is complex. Specifically, in terms of version control and configuration management, traditional software testing technology may not always provide good stability and traceability.

[0117] Blockchain technology is a rapidly developing field in recent years. As a decentralized, shared, and traceable distributed ledger technology, it has been widely used in many industries, such as finance, the Internet of Things, and supply chains. Its many characteristics, such as traceability, reversibility, and data persistence, make it a potential technology that can be used to improve software testing methods. By introducing blockchain technology into the field of software testing, some problems and challenges can be effectively solved. For example, using blockchain synchronization nodes to copy application data and configurations of the referenced environment can improve test authenticity; using the traceability and reversibility of blockchain to achieve more stable and reliable data and configuration management; and using blockchain technology to quickly copy data in the production environment to achieve more efficient problem location and resolution. This embodiment aims to use blockchain technology to provide a more efficient and accurate method for software testing of non-blockchain applications to improve product quality and testing efficiency in the software development process.

[0118] The present embodiment provides a non-blockchain application software testing tool combined with blockchain technology, which aims to improve the efficiency and accuracy of software testing and reduce the testing cost. It uses blockchain technology as the underlying database and configuration management center to realize multi-version storage, tracking and rollback functions of data and configuration. The blockchain-based application testing method provided by the present embodiment combines modern testing methods with blockchain technology, and provides a series of innovative functions for the software development team: by using blockchain synchronization nodes to copy application data and configurations of other environments, a highly realistic test environment that is the same as the copied environment can be provided, thereby building a highly realistic test environment; the present embodiment can copy the abnormal moment data of the production environment to the test environment, so as to locate and handle problems in the production environment more quickly, thereby solving the problem of rapid location; the present embodiment can more easily reproduce and locate problems by synchronizing the data and configuration information of the time when the problem that is difficult to reproduce occurs to the development environment, thereby solving the problem of convenient reproduction and location; the present embodiment uses the historical data recorded by the blockchain to test the compatibility of the new version system under the same data, ensure the stability and compatibility of the system during upgrade, and realize the verification of system compatibility.

[0119] This embodiment applies blockchain technology to software testing, which can improve testing efficiency and product quality. Specifically, the synchronization function of blockchain nodes is used to achieve consistency in data and configuration between the test environment and the production environment, and obtain test results that are closer to the production environment; blockchain technology is used to achieve stable traceability of data and configuration, and quickly locate and solve problems caused by data and application configuration; blockchain data version rollback technology is used to assist in reproducing difficult-to-reproduce problems; blockchain state switching is used to obtain specified version data to verify system compatibility. Based on the blockchain-based application testing method provided by this embodiment, the development team can more effectively create, manage and execute software testing, improve product quality, and have advantages in stability, reliability and compatibility. It can be applied to projects with smaller business data volumes.

[0120] Specifically, the development process of a general software system involves multiple software deployment environments, such as local environment, development environment, test environment, pre-production environment, production environment, etc., which have their own uses. Software deployment environment refers to the infrastructure and configuration used to build, test, run and maintain software applications. Different deployment environments usually have different purposes and characteristics. Among them, the local environment (Local Environment) refers to the environment in which developers create and modify code on their own computers. The local environment is usually used to develop and debug applications; the development environment (Development Environment) refers to the environment shared by the development team, which is used to integrate and test the code of each developer. The development environment is usually used in conjunction with a version control system, such as the version control system Git, in order to determine code changes and coordinate teamwork. The version control system Git is an open source distributed version control system used to handle any small or large project in an agile and efficient manner; the testing environment (Testing Environment) refers to the environment used to perform various tests on the software, including unit testing, integration testing, system testing and performance testing, etc. The testing environment is usually used in conjunction with continuous integration (Continuous Integration) and continuous delivery (Continuous Delivery) tools to automate the testing and deployment process; the pre-production environment (Staging Environment) The pre-production environment is an environment that simulates the production environment and is used for final verification and testing before releasing the software. The pre-production environment can help the development team discover and fix problems that are not found in the development and test environments, ensuring the stability and performance of the software in the production environment. The production environment is an environment used to run actual applications and provide services to end users. The production environment usually has the characteristics of high availability, high performance, and high security to ensure the normal operation of applications and the security of data.

[0121] In addition, a disaster recovery environment can be included. A disaster recovery environment is an environment used to recover applications and data when a production environment fails. A disaster recovery environment is often used in conjunction with a backup and recovery strategy to reduce the impact of failures on the business. In actual projects, the number and type of deployment environments may vary depending on project requirements and team size. In order to ensure the quality and stability of the software, the development team usually conducts multiple rounds of testing and verification in different deployment environments.

[0122] A complete system includes the following components: application, which can specifically include the front-end application and back-end service of the application, mainly used to meet business needs; database, in this embodiment, a blockchain independent node is used as the database, and a blockchain Solo node can be used as the database. Two smart contracts are deployed in the Solo node, among which the configuration management contract is mainly used to store the configuration information of the application. When the application is started, the configuration information of the application can be obtained by querying the configuration management contract and the configuration of the application can be completed. Users can also change the configuration of the application and save the new configuration by updating the configuration method. The database contract mainly provides data update and query methods for managing the business data of the application. Data updates can specifically include update types such as addition, deletion and change. Solo nodes in different environments can set the target node to be synchronized, and synchronize from the target node to the historical block and contract data. The contract data can include the business data of the application, and the business data can specifically include various types of data such as application code, input data, execution results, configuration information, etc.

[0123] like Fig. 9 As shown, in the production environment, pre-production environment, test environment and development environment, applications and databases can be included. The database is specifically implemented using an independent blockchain node, that is, a blockchain Solo node. Two types of smart contracts can be included in the blockchain Solo node, which can specifically include a configuration management contract for updating configuration processing for the application and a database contract. The database contract is used to update data and query data for the application. When building different environments, data can be synchronized based on the smart contracts in the blockchain Solo node, such as synchronizing the data in the blockchain Solo node in the production environment to the blockchain Solo node in the pre-production environment, synchronizing the data in the blockchain Solo node in the pre-production environment to the blockchain Solo node in the test environment, and synchronizing the data in the blockchain Solo node in the test environment to the blockchain Solo node in the development environment, thereby achieving data synchronization in different environments.

[0124] Among them, the blockchain Solo Node is an independently running blockchain node that does not rely on other nodes for consensus. Solo nodes are usually used in private blockchain networks or test networks so that developers can conduct experiments and development without affecting the main network. The other names of Solo nodes are Independent Node or Standalone Node. Independent consensus, that is, Solo nodes independently reach consensus in the blockchain network without the need to negotiate or reach consensus with other nodes. For the self-validation of Solo nodes, that is, Solo nodes verify transactions and blocks by themselves, without the need for verification by other nodes. For the isolated testing of Solo nodes, that is, Solo nodes can be used for isolated testing to conduct experiments and development without affecting the main network. For the private network of Solo nodes, that is, Solo nodes are usually used to build private blockchain networks, which are only accessible to specific users or organizations. Solo nodes are less used in public blockchain networks because they cannot achieve decentralization and security. In these networks, other consensus algorithms such as Proof of Work or Proof of Stake are often used to ensure the security and decentralization of the network.

[0125] Furthermore, when it is necessary to synchronize the configuration information and data of other environments to test, development or other environments for testing, the data of the target environment must be synchronized first. Specifically, the blockchain Solo node can be set as a synchronization node, which will synchronize data from the specified blockchain node and ultimately keep the data consistent with other blockchain nodes.

[0126] Among them, a blockchain synchronization node (Synchronized Node) is a node that keeps in sync with other nodes in the blockchain network. It downloads and verifies the transaction history and block data of the entire blockchain to ensure the consistency and security of the network. Synchronized nodes are also known as full nodes (Full Node) or complete nodes (Complete Node). For the data consistency of the synchronized node (Data Consistency), the synchronized node ensures the data consistency of the entire network by sharing and verifying the blockchain data with other nodes. For the complete transaction history (Complete Transaction History) of the synchronized node, the synchronized node stores the transaction history of the entire blockchain, starting from the Genesis Block until the latest block. For the transaction validation of the synchronized node (Transaction Validation), the synchronized node verifies all transactions to ensure that they comply with the consensus rules of the network to maintain the security of the network. For the decentralization of the synchronized node (Decentralization), the synchronized nodes help to achieve the decentralization of the blockchain network because they independently verify and store blockchain data and do not rely on centralized authorities. For the Broadcast New Transactions of the Sync Node, the Sync Node is also responsible for broadcasting new transactions to the entire network so that other nodes can verify and add them to the block. In public blockchain networks, Sync Nodes play a key role because they ensure the consistency, security, and decentralization of the network. However, running Sync Nodes requires a large storage space and computing power because they need to download and process data from the entire blockchain.

[0127] In addition, the blockchain network also includes blockchain consensus nodes. Blockchain consensus nodes (Consensus Node) are nodes that participate in the consensus process of the blockchain network. Consensus nodes are responsible for verifying transactions, creating new blocks, and reaching consensus with other nodes to ensure the consistency and security of the network. Consensus nodes can include nodes for the Proof of Work (PoW) consensus algorithm, validator nodes (Validator Node, for the Proof of Stake (PoS) consensus algorithm), etc. The specific name depends on the consensus algorithm used. For the consensus algorithm (Consensus Algorithm) of the consensus node, that is, the consensus node verifies transactions, creates new blocks, and reaches consensus with other nodes according to a specific consensus algorithm (such as Proof of Work (PoW), Proof of Stake (PoS), Byzantine Fault Tolerance (BFT), etc.). For the block creation (Block Creation) of the consensus node, that is, the consensus node is responsible for packaging the verified transactions into new blocks and adding them to the blockchain. For the network security (Network Security) of the consensus node, that is, the consensus node maintains the security of the blockchain network by verifying transactions and reaching consensus, and prevents malicious behaviors such as double payment and tampering with historical data. Regarding the incentive mechanism of consensus nodes, that is, in order to encourage consensus nodes to participate in the consensus process, blockchain networks usually provide incentive mechanisms such as block rewards and transaction fees. Regarding the decentralization of consensus nodes, consensus nodes help to achieve the decentralization of blockchain networks because they independently verify transactions, create new blocks, and reach consensus with other nodes without relying on centralized authorities. In public blockchain networks, consensus nodes play a key role because they ensure the consistency, security, and decentralization of the network. Different consensus algorithms may have different effects on the hardware requirements, energy consumption, and incentive mechanisms of consensus nodes.

[0128] The specific implementation steps of the blockchain-based application testing method in this embodiment are as follows: first, establish a network connection. The synchronization node needs to join the network where the target blockchain node is located. It will establish a network connection with other known nodes to obtain blockchain data and real-time updates; synchronize block data. When the node joins the blockchain network, it requests all block data from other known nodes. The node that receives the request will share the locally stored blockchain data with the new node. The new node will read and verify these block data one by one, including checking the block hash value, transactions, etc.; verify block data. When the synchronization node receives new block data, it needs to verify various elements in the block. , such as hash value, timestamp, block height, etc. In addition, it will verify transaction signatures. Only when the new block and the transactions it contains are verified, will the synchronization node add them to the local blockchain data; to maintain data consistency, the synchronization node needs to be consistent with other nodes in the network. When a new block is added to the network, the synchronization node will add it to the local blockchain data and update their status. Under the consensus mechanism, the synchronization node will decide whether to accept the new block according to the preset rules. In some cases, such as when a fork occurs, the synchronization nodes may need to reorganize their blockchain data to ensure consensus with other nodes in the network.

[0129] like Fig.10 As shown, after the blockchain Solo node is added to the blockchain network as a synchronization node, the synchronization can send a request to the blockchain node in the blockchain network to request to establish a network connection; after the synchronization node and the blockchain node establish a network connection, the synchronization node can request all block data from the blockchain node; the blockchain node can share all block data with the synchronization node; the synchronization node reads and verifies the block data shared by the blockchain node, including verification of block data such as hash value, timestamp, block height, etc.; the synchronization node can also verify transaction signatures; the synchronization node can add verified block data to the local blockchain; after adding verified block data to the local blockchain, the synchronization node can update the blockchain status to achieve synchronization of block data.

[0130] Furthermore, when forward or backward compatibility testing, regression testing, or when it is necessary to locate a specific problem that occurs when an application uses a certain configuration and data, it is necessary to roll back the application data to a specified version and then perform targeted testing.

[0131] Among them, in software development, regression testing usually refers to running the previous test cases again after modifying the software or adding new functions to ensure that the modifications do not produce unexpected side effects or affect the original normal functions. Depending on the different types of regression testing, the aspects that need to be paid attention to during the testing process are also different. For functional regression testing, functional regression testing refers to repeating the original test cases after the modification to ensure that the implemented functions can still work properly. This is the most common type of regression testing. For performance regression testing, performance regression testing refers to testing whether the performance of existing functions has decreased after modification, including indicators such as response time, throughput, concurrency and resource utilization. This test is particularly important for large applications because the performance problems of these applications may affect the user experience or whether the tasks can be completed on time. For security regression testing, test whether the security of the software is affected by the new changes to ensure that the software has no new vulnerabilities or security issues. For user interface regression testing, test whether the user interface of the software works properly to ensure that the new changes do not destroy the appearance and function of the user interface. For compatibility regression testing, compatibility regression testing refers to repeating the old test cases after the modification to ensure that there are no problems with the compatibility of the application with the existing software and hardware systems and external programs. This includes testing the application for compatibility issues with various operating systems (such as Windows, Mac, Linux, etc.) and different browsers (such as Firefox, Chrome, Safari, etc.).

[0132] In addition, in the software development industry, backward compatibility, also known as downward compatibility, means that after an application is updated to a new version, it can still exchange data with an old version of the application or system, and the old version data can still be used normally. For example, when developing Office 2007, you need to consider how to open Office 2003's doc / xls / ppt files, not just docx / xlsx / pptx files. Forward compatibility, also known as upward compatibility, means that after an application is updated to a new version, it can still exchange data with future versions of the application or system, and the new version data can still be used normally. For example, several fields can be reserved for filling in new data in the future.

[0133] Specifically, for the application data version switching process, the MPT (Merkle Patricia Tree) storage structure used by the blockchain used by the tested application can save the data at the historical height, and can realize data rollback to the specified historical version when necessary. The MPT tree has immutability, and the nodes of the MPT tree are immutable, which means that when the status is updated, a new node will be created and the old node will remain in the database. Therefore, the status of the historical version of the node in the blockchain platform still exists in the tree and will not be overwritten. The MPT tree implements the link of the root hash. Specifically, each block contains an associated state root, namely the MPT tree root hash, which represents the global state of the corresponding block. The MPT tree records the state root of each block, thereby constructing the historical version point of the blockchain, and these state roots are traceable on the blockchain. In addition, since a new node is created when the MPT node is updated instead of directly modifying the existing node, the database will save the previous node and its status. Therefore, through the state root on the blockchain, the historical version of the MPT tree can be rebuilt and accessed.

[0134] Based on the above characteristics of the MPT tree, the blockchain is able to roll back data to a specified historical version. Specifically, determine the target block to be rolled back, that is, the specified historical version to be rolled back to; find the state root of this target block, that is, the MPT tree root hash; use the state root to rebuild the MPT, because historical nodes are stored in the database, starting from the state root, recursively access and build the MPT containing historical state data; switch to the state after rollback, and read and modify operations will be targeted at the newly constructed MPT to reflect the state of the target block. The ability of the MPT tree to roll back data is very valuable in the blockchain, especially when it is necessary to fix software errors, handle irregular transactions, and test the system, which allows the blockchain to safely restore to a historical state, fix problems, and continue to maintain functional integrity. Fig.11 As shown, for two consecutive blocks on the blockchain, namely block 175233 and block 175224, the previous block hash (prevhash), state root (state root), transaction root (tx root) and receipt root (receipt root) are stored in the block header. The state root of block 175224 belongs to the current world state root, and the state root of block 175223 belongs to the historical world state root. It can be rolled back from the current world state root to the inner world state root, and then rolled back to the historical data, such as rolling back to the historical world state root of block 175223; among them, block 175224 shows that when the data of account 175 is changed, specifically from 45 to 27, only part of the data related to this account 175 needs to be stored, and the data in block 175233 can be accessed normally.

[0135] The blockchain-based application testing method provided in this embodiment can improve the authenticity and consistency of testing, improve the stability and traceability of data and configuration management, quickly locate and solve problems, assist in reproducing problems that are difficult to reproduce, and complete version compatibility verification of applications. Specifically, by applying blockchain technology to software testing of non-blockchain applications, in terms of the difference between the test environment and the production environment, the blockchain synchronization node is used to copy the application data and configuration of the reference environment, which effectively narrows the difference between the test environment and the production environment and improves the authenticity of the test; in terms of data and configuration management, the blockchain is used as the underlying database and configuration management center of the software to achieve the tracking of multiple versions of data and configurations. The traceability and rollback of the blockchain make data and configuration management more stable and reliable; in terms of rapid problem location, by copying the data of a certain abnormal moment in the production environment to the test environment, the problems of the production environment can be located more quickly in the test environment, thereby bringing higher solution efficiency; in terms of reproducing difficult-to-reproduce problems, the difficult-to-reproduce problems found in the test environment and key data and configurations are synchronized to the development environment, helping developers to reproduce and locate problems more easily, reducing the difficulty of problem handling; in terms of verifying system compatibility, historical data is used to verify the compatibility of the system, so as to ensure that the new version of the code can produce the expected results when processing the same data, and ensure that the system will not introduce errors during the upgrade process, thereby improving the efficiency and accuracy of software testing, reducing testing costs, and improving the stability and compatibility of the system.

[0136] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0137] Based on the same inventive concept, the embodiment of the present application also provides a blockchain-based application testing device for implementing the blockchain-based application testing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more blockchain-based application testing device embodiments provided below can refer to the above limitations on the blockchain-based application testing method, which will not be repeated here.

[0138] In one embodiment, Fig.12 As shown, a blockchain-based application testing device 1200 is provided, including: a deployment environment determination module 1202, an environment data acquisition module 1204 and a test execution module 1206, wherein:

[0139] A deployment environment determination module 1202 is used to determine an application deployment environment for an application to be tested;

[0140] The environment data acquisition module 1204 is used to acquire the environment data of the application deployment environment through the synchronization node in the blockchain network associated with the application deployment environment; the environment data is the data stored by each blockchain node in the blockchain network and used to describe the running process of the application in the application deployment environment;

[0141] The test execution module 1206 is used to build an application test environment that matches the application deployment environment based on the environment data, and to test the application in the application test environment using the environment data.

[0142] In one embodiment, the environment data acquisition module 1204 is also used to determine the blockchain network associated with the application deployment environment; add the independently running blockchain node as a synchronization node to the blockchain network; and synchronize the environment data of the application deployment environment from each blockchain node of the blockchain network through the synchronization node.

[0143] In one embodiment, the environmental data acquisition module 1204 is also used to send block synchronization requests to each blockchain node of the blockchain network through the synchronization node; the block synchronization request is used to instruct the corresponding receiving blockchain node to send the stored block data to the synchronization node; receive the block data sent by each blockchain node; when the received block data passes the verification, the environmental data of the application deployment environment is obtained according to the received block data.

[0144] In one embodiment, it also includes a block update module, which is used to synchronously obtain the block data to be updated associated with the block update event from each blockchain node in the blockchain network through the synchronization node when a block update event is triggered in the blockchain network; when the block data to be updated meets the synchronization judgment condition, the block data to be updated is stored in the local end of the synchronization node.

[0145] In one embodiment, the environment data acquisition module 1204 is also used to determine the blockchain network associated with the application deployment environment and the application test version to be tested for the application; determine the test block data corresponding to the application test version from the block data stored in the synchronization node in the blockchain network; and obtain the environment data of the application deployment environment based on the test block data.

[0146] In one embodiment, the environment data acquisition module 1204 is also used to determine a test block from the block tree of the synchronization node according to the application test version; when the test block belongs to a historical block, the block is rolled back and rebuilt based on the block tree to obtain a reconstructed block tree; the block data of the test block is obtained according to the reconstructed block tree, and the test block data corresponding to the application test version is obtained according to the block data of the test block.

[0147] In one embodiment, the environment data acquisition module 1204 is also used to determine the test state root of the test block according to the block tree; roll back and rebuild each state root in the block tree until it is rolled back and rebuilt to the test state root to obtain a reconstructed block tree; the state root represents the state of the block in the block tree.

[0148] In one embodiment, the environment data acquisition module 1204 is further used to acquire block data of the test block when the test block does not belong to the historical block; and obtain the test block data corresponding to the application test version according to the block data of the test block.

[0149] In one embodiment, the environment data acquisition module 1204 is also used to determine the blockchain network associated with the application deployment environment; obtain the environment data of the application deployment environment by calling the smart contract created for the application by the synchronization node in the blockchain network; the smart contract is created by the synchronization node based on the environment data synchronized from the blockchain network.

[0150] In one embodiment, the environmental data acquisition module 1204 is also used to obtain configuration information for the application by calling the configuration information smart contract created by the synchronization node in the blockchain network for the application; obtain business data of the application by calling the database smart contract created by the synchronization node for the application; and obtain environmental data of the application deployment environment based on the configuration information and business data.

[0151] In one embodiment, the environment data includes configuration information for the application and business data of the application; the test execution module 1206 is also used to build an application test environment that matches the application deployment environment based on the configuration information; test the application in the application test environment to obtain test data; and obtain test results for the application based on the test data and business data.

[0152] In one embodiment, the test execution module 1206 is also used to configure the application through configuration information when the application is started, so as to obtain an application test environment that matches the application deployment environment; in the application test environment, the configured application is run according to the test project to obtain test data corresponding to the test project.

[0153] Each module in the above-mentioned blockchain-based application testing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.

[0154] In one embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store application test data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a blockchain-based application testing method is implemented.

[0155] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0156] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0157] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0158] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0159] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0160] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0161] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0162] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A blockchain-based application testing method, characterized in that: The method comprises: Determine the application deployment environment for the application to be tested; Obtaining environment data of the application deployment environment through a synchronization node in the blockchain network associated with the application deployment environment; the environment data is data stored by each blockchain node in the blockchain network and used to describe the running process of the application in the application deployment environment; An application test environment matching the application deployment environment is constructed based on the environment data, and the application is tested in the application test environment using the environment data.

2. The method according to claim 1, characterized in that: The obtaining, through a synchronization node in a blockchain network associated with the application deployment environment, environment data of the application deployment environment includes: Determining the blockchain network associated with the application deployment environment; Adding independently running blockchain nodes as synchronization nodes to the blockchain network; The environment data of the application deployment environment is obtained by synchronizing from each blockchain node of the blockchain network through the synchronization node.

3. The method according to claim 2, characterized in that The step of synchronously obtaining the environment data of the application deployment environment from each blockchain node of the blockchain network through the synchronization node includes: Sending a block synchronization request to each blockchain node of the blockchain network through the synchronization node; the block synchronization request is used to instruct the corresponding receiving blockchain node to send the stored block data to the synchronization node; Receiving block data respectively sent by each of the blockchain nodes; When the received block data passes the verification, the environment data of the application deployment environment is obtained according to the received block data.

4. The method according to claim 3, characterized in that The method further comprises: When a block update event is triggered in the blockchain network, the synchronization node synchronously obtains the block data to be updated associated with the block update event from each blockchain node of the blockchain network; When the block data to be updated meets the synchronization determination condition, the block data to be updated is stored in the local end of the synchronization node.

5. The method according to claim 1, characterized in that The obtaining, through a synchronization node in a blockchain network associated with the application deployment environment, environment data of the application deployment environment includes: Determining a blockchain network associated with the application deployment environment and an application test version to be tested for the application; Determining test block data corresponding to the application test version from block data stored by synchronization nodes in the blockchain network; Based on the test block data, environmental data of the application deployment environment is obtained.

6. The method according to claim 5, characterized in that The step of determining the test block data corresponding to the application test version from the block data stored by the synchronization node in the blockchain network includes: Determine a test block from the block tree of the synchronization node according to the application test version; When the test block belongs to a historical block, a block rollback and reconstruction is performed based on the block tree to obtain a reconstructed block tree; The block data of the test block is obtained according to the reconstructed block tree, and the test block data corresponding to the application test version is obtained according to the block data of the test block.

7. The method according to claim 6, characterized in that When the test block belongs to a historical block, performing block rollback and reconstruction based on the block tree to obtain a reconstructed block tree includes: Determine a test status root of the test block according to the block tree; Roll back and rebuild each state root in the block tree until rolling back and rebuilding to the test state root, to obtain a reconstructed block tree; the state root represents the state of the block in the block tree.

8. The method according to claim 6, characterized in that The method further comprises: When the test block does not belong to a historical block, obtaining block data of the test block; According to the block data of the test block, test block data corresponding to the application test version is obtained.

9. The method according to claim 1, characterized in that: The obtaining, through a synchronization node in a blockchain network associated with the application deployment environment, environment data of the application deployment environment includes: Determining the blockchain network associated with the application deployment environment; Obtaining environmental data of the application deployment environment by calling a smart contract created by a synchronization node in the blockchain network for the application; The smart contract is created by the synchronization node based on the environmental data synchronized from the blockchain network.

10. The method according to claim 9, characterized in that The obtaining of the environment data of the application deployment environment by calling the smart contract created by the synchronization node in the blockchain network for the application includes: Obtaining configuration information for the application by calling a configuration information smart contract created by a synchronization node in the blockchain network for the application; Obtain the business data of the application by calling the database smart contract created by the synchronization node for the application; The environment data of the application deployment environment is obtained according to the configuration information and the business data.

11. The method according to any one of claims 1 to 10, characterized in that: The environment data includes configuration information for the application and business data of the application; The step of constructing an application test environment matching the application deployment environment based on the environment data, and testing the application in the application test environment using the environment data includes: Building an application test environment matching the application deployment environment based on the configuration information; Performing a test on the application in the application test environment to obtain test data; A test result for the application is obtained according to the test data and the service data.

12. The method according to claim 11, characterized in that The step of constructing an application test environment matching the application deployment environment based on the configuration information includes: When the application is started, the application is configured according to the configuration information to obtain an application test environment that matches the application deployment environment; The testing the application in the application test environment to obtain test data includes: In the application test environment, the configured application is run according to the test items to obtain test data corresponding to the test items.

13. An application testing device based on blockchain, characterized in that: The device comprises: A deployment environment determination module, used to determine an application deployment environment for an application to be tested; An environment data acquisition module, used to acquire environment data of the application deployment environment through a synchronization node in the blockchain network associated with the application deployment environment; the environment data is data stored by each blockchain node in the blockchain network and used to describe the running process of the application in the application deployment environment; The test execution module is used to build an application test environment matching the application deployment environment based on the environment data, and to test the application in the application test environment using the environment data.

14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.

16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.

Citation Information

Cited By

  • Energy storage EMS system version release verification method and system

    CN119988238A