Service test method, device and equipment based on distributed network and storage medium

By adopting a distributed network-based approach in business testing, using smart contracts to generate and execute test cases, the reliability problems caused by the single business test environment in the existing technology are solved, and more accurate and diversified test results are achieved.

CN119597640APending Publication Date: 2025-03-11PING AN BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411527347.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the prior art, the business test environment is single, and the accuracy and reliability of the test results cannot be guaranteed, resulting in insufficient reliability of the business test.

Method used

The service testing method based on distributed network is adopted, and by receiving the service test request of the API, calling the smart contract of the distributed network node, generating and executing test cases, and obtaining business test results.

Benefits of technology

Through the diversified testing environment of distributed network systems, the reliability of business tests is improved and the accuracy and diversity of test results are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597640A_ABST
    Figure CN119597640A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of testing, and provides a service testing method and device based on a distributed network, equipment and a storage medium, and the method comprises the steps: receiving a service testing request based on an API (Application Programming Interface); according to the service test request, calling a smart contract corresponding to a distributed network node, the smart contract comprising various test case templates; according to the smart contract, generating a test case corresponding to a service test; and executing the test case to obtain a corresponding service test result, thereby improving the reliability of the service test. The invention further relates to a block chain technology, and the smart contract can be stored in a block chain node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing technology, and in particular to a distributed network-based service testing method, device, equipment and storage medium. Background Art

[0002] For business development, business data sharing has become an important trend. For example, in the financial field, open banking allows third-party developers to access bank data and services through API (Application Programming Interface). The relevant technology provides a test environment to enable banks, developers, third-party service providers, etc. to test APIs and simulate transactions. However, the test environment is single and cannot guarantee the accuracy and reliability of the test results.

[0003] Therefore, how to improve the reliability of business testing has become an urgent problem to be solved. Summary of the invention

[0004] The present application provides a distributed network-based service testing method, apparatus, device and storage medium, aiming to improve the reliability of service testing.

[0005] To achieve the above object, the present application provides a distributed network-based service testing method, the distributed network-based service testing method comprising:

[0006] Receive business test requests based on the application programming interface API;

[0007] According to the business test request, calling the smart contract corresponding to the distributed network node, the smart contract includes various test case templates;

[0008] Generate test cases corresponding to business tests according to the smart contract;

[0009] Execute the test case to obtain the corresponding business test result.

[0010] In addition, to achieve the above-mentioned purpose, the present application also provides a service testing device, the service testing device comprising:

[0011] An acquisition module, used for receiving a business test request based on an application programming interface API;

[0012] A processing module, configured to call a smart contract corresponding to a distributed network node according to the service test request, wherein the smart contract includes various test case templates;

[0013] A generation module, used to generate test cases corresponding to business tests according to the smart contract;

[0014] The execution module is used to execute the test case and obtain the corresponding business test result.

[0015] In addition, to achieve the above-mentioned purpose, the present application also provides a computer device, the computer device comprising a memory and a processor;

[0016] The memory is used to store computer programs;

[0017] The processor is used to execute the computer program and implement the above-mentioned distributed network-based service testing method when executing the computer program.

[0018] In addition, to achieve the above objectives, the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, it implements the steps of the above-mentioned distributed network-based service testing method.

[0019] The present application discloses a distributed network-based business testing method, apparatus, equipment and storage medium. By receiving an API-based business testing request, the smart contract corresponding to the distributed network node is called according to the business testing request. The smart contract includes various test case templates. According to the smart contract, a test case corresponding to the business test is generated, the test case is executed, and the corresponding business test result is obtained. The test environment is more diversified, thereby improving the reliability of the test. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0021] Figure 1 It is a schematic flow chart of the steps of a distributed network-based service testing method provided in an embodiment of the present application;

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

[0023] Figure 3 It is a schematic flowchart of the steps of generating a test case corresponding to a business test according to the smart contract provided in an embodiment of the present application;

[0024] Figure 4 This is a flow chart of a transaction test based on a distributed network system provided by an embodiment of the present application;

[0025] Figure 5 It is a schematic flow chart of the steps of another distributed network-based service testing method provided by an embodiment of the present application;

[0026] Figure 6 is a schematic block diagram of a service testing device provided in an embodiment of the present application;

[0027] Figure 7 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0029] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0030] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0031] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0032] For business development, business data sharing has become an important trend. For example, in the financial field, open banking allows third-party developers to access bank data and services through API interfaces. The relevant technology provides a test environment that enables banks, developers, third-party service providers, etc. to test APIs and simulate transactions. However, the test environment is single and cannot guarantee the accuracy and reliability of the test results.

[0033] In order to solve the above problems, the embodiments of the present application provide a distributed network-based service testing method, apparatus, device and storage medium for improving the reliability of service testing.

[0034] See also Figure 1 , Figure 1 This is a flow chart of a distributed network-based service testing method provided by an embodiment of the present application. The method can be applied to computer devices, and the application scenario of the method is not limited in the present application.

[0035] like Figure 1 As shown, the distributed network-based service testing method specifically includes steps S101 to S104.

[0036] S101: Receive a service test request based on an application programming interface (API).

[0037] First, build a distributed network system and deploy multiple network nodes, such as relevant departments, units, institutions, etc. Each node represents a participant connected to the distributed network. For example, each node is connected through a blockchain to form a distributed network system. At the same time, smart contracts and consensus mechanisms are deployed on each node, and each node exchanges and collaborates data through smart contracts and consensus mechanisms. Third-party developers establish connections with each node based on the API gateway to achieve interactive communication with the node.

[0038] For example, taking a banking department or institution as an example, each node in the distributed network system represents a banking department or institution, e.g. Figure 2 As shown in the figure, the distributed network system includes bank node A, bank node B, and bank node C. These bank nodes are interconnected through the blockchain network and exchange data and collaborate through smart contracts and consensus mechanisms. Third-party developers establish connections with bank node A, bank node B, bank node C and other related bank nodes based on the API gateway to access the data and services of bank node A, bank node B, bank node C and other related bank nodes.

[0039] The deployment of each bank node is divided into the following key steps:

[0040] a) Configure and start bank nodes: Each bank node can be deployed on an independent server and can be managed and run through containerization technology. Each bank node usually includes peer nodes, sorting nodes, certificate authorities, etc. For example, taking the deployment of bank node A as an example, configure the peer nodes of bank node A, deploy the sorting nodes of bank node A to process transaction consensus, and configure the certificate authority of bank node A to generate and manage the digital certificates and identity authentication of bank node A to ensure the identity authentication and communication security between bank nodes. The configuration of bank node B and bank node C is similar to that of bank node A to enable interaction with other bank nodes.

[0041] b) Establish channels: used to transfer data between different parties. Each bank node can join one or more channels to decide which nodes it shares data with. For example, suppose bank node A focuses on payment services, bank node B focuses on providing loan services, and bank node C focuses on managing savings accounts. Bank nodes A and B want to share data on payment transactions, while bank node C only wants to share data related to savings accounts with other nodes. The following channels are constructed:

[0042] Payment transaction channel: Bank node A and bank node B join the channel to share payment transaction data.

[0043] Account Management Channel: Bank Node A, Bank Node B, and Bank Node C all join the channel to share data related to savings accounts.

[0044] By configuring channels, each bank node can choose to share or isolate data as needed to achieve data security and flexibility.

[0045] Moreover, in a distributed network system, each node communicates through a blockchain network. At the same time, a fault-tolerant mechanism is adopted to ensure consensus among different nodes. Even if some nodes fail, the stability and data consistency of the entire network can be guaranteed. For example, bank node A initiates a payment transaction, and bank node B needs to verify the validity of the transaction. The sorting node in the network will sort the transaction and broadcast it to all relevant nodes. Then, the peer nodes of bank node A and bank node B will reach an agreement through a consensus mechanism to verify and record the transaction.

[0046] After the bank nodes and channels are configured, smart contracts can be deployed and executed in the network, and inter-bank business logic such as payment processing, loan approval, account management, etc. can be automatically executed based on smart contracts. Smart contracts include:

[0047] Payment chain code: Deployed in the payment transaction channel, peer nodes of bank node A and bank node B can call the smart contract to process cross-bank payment transactions.

[0048] Account management chaincode: Deployed in the account management channel, bank node A, bank node B, and bank node C can all call this smart contract to handle savings account related affairs.

[0049] Regarding the consensus mechanism, in a distributed network system, each node can independently decide on the sharing and isolation of data according to the rules set by the smart contract. By configuring different channels and smart contracts, nodes can selectively share certain data while keeping other data isolated. For example, data sharing between bank node A and bank node B: bank node A shares part of the payment transaction data with bank node B through the payment chain code and payment channel. In order to protect privacy, sensitive information in transaction records (such as account holder information) can be encrypted or anonymized to ensure the privacy of the data. Another example is the data isolation of bank node C: bank node C only participates in the account management channel to ensure that its savings account data is completely isolated from the transaction data in the payment channel. The peer nodes of bank node C can only access data related to account management, and cannot see the payment transaction data of other bank nodes.

[0050] In addition, with the dynamic joining and exit of bank nodes, if new bank nodes wish to join the network in the future, they can quickly configure new nodes through the dynamic joining mechanism of the blockchain, and participate in data sharing and business processing by updating channel configurations and smart contracts, thereby enhancing the scalability of the distributed network system.

[0051] In general, the process of building a distributed network system includes:

[0052] 1. Deploy peer nodes, sorting nodes, certificate authorities, etc. of each bank node.

[0053] 2. Configure channels to achieve data sharing and isolation.

[0054] 3. Deploy smart contracts to realize automated business processing.

[0055] 4. Deploy a consensus mechanism to ensure the security and consistency of transactions.

[0056] 5. Realize the dynamic joining and exit of bank nodes to enhance the scalability of distributed network systems.

[0057] In this way, different bank nodes can collaborate and share data securely and flexibly to form an efficient and decentralized open banking sandbox network.

[0058] In some embodiments, the method further comprises:

[0059] An open unified standardized API specification is configured so that each of the distributed network nodes can perform data interaction based on the API specification.

[0060] The API specification in a distributed network system is the basis for interaction between nodes. To achieve consistency, a set of open and standardized API specifications is first defined to ensure that each node in the distributed network system develops and provides services according to the same interface protocol.

[0061] For example, taking the account information query API as an example, all nodes need to implement the customer's balance query function through a consistent API interface. The standardized account information query API is defined as follows:

[0062]

[0063] Each node in the distributed network system follows the same interface standard, and must be consistent in data format and path parameters. By formulating and strictly enforcing API specifications, it is ensured that each node follows consistent standards when providing interfaces, and is consistent in data format and path parameters, and responds in the same format and protocol, thereby avoiding compatibility issues and enabling third-party developers to perform consistent development and testing on different nodes.

[0064] For bank nodes, each bank business department can customize the open API interface according to its business needs and strategies to better adapt to different business scenarios, thereby improving product flexibility and competitiveness.

[0065] To ensure consistency during distributed network system upgrades, whenever the protocol or interface is updated, the new version of the interface remains compatible with the old version, ensuring that third-party developers can continue to interact with the old interface without modifying existing code.

[0066] For example, an upgrade added information about account types:

[0067] The old version of the API returns:

[0068]

[0069] The new version of the API returns:

[0070]

[0071] When adding fields, the new version retains all the field formats and return structures of the old version, ensuring that developers who have adapted to the old version interface can still use the system normally. This version control mechanism can effectively avoid incompatibility issues caused by system upgrades.

[0072] In addition, the interface standards and security protocols that each node must follow are specified through smart contracts. Smart contracts will serve as a regulatory mechanism in the distributed network system to ensure that nodes meet pre-defined standards when providing API interfaces. If the implementation of a node does not meet the standards, the smart contract can automatically reject the service provided by the node or require it to be corrected. For example, when a third-party developer calls the API interface of bank node A through a smart contract, it will check whether the API interface provided by bank node A meets the standards. If it does not meet the standards, the smart contract will return an error and prevent the developer from continuing to test the API interface. In this way, the system can automatically manage protocol consistency.

[0073] In addition, to ensure that third-party developers can perform consistent development and testing on different nodes, a set of testing and certification mechanisms can be established, requiring all nodes to pass consistent testing standards before they can access the distributed network system. Each node must pass a series of standardized test cases before going online. For example, taking the account query test as an example, the distributed network system will verify whether the API interface of the node returns a standard account data structure. In this way, the distributed network system can ensure that each node meets the interface standards and reduce compatibility issues.

[0074] In some embodiments, the method further comprises:

[0075] Data management is performed based on the smart contract, the data includes real data and simulated data, and the data management includes at least one of data isolation and data sharing.

[0076] As an automated rule executor, smart contracts can manage data sharing, access rights, data protection policies, etc. between nodes according to pre-set rules and logic. Smart contracts can dynamically manage data sharing and isolation based on the roles, permissions, and business needs of each node, while defining data access rights, sharing scope, and how to handle sensitive data. All of these rules are written into smart contracts, and the execution of smart contracts is automatic and cannot be tampered with, thus ensuring the security and flexibility of data sharing in distributed network systems.

[0077] The data sharing agreement specifies how each node exchanges data and ensures compliance with security and privacy protection standards. The agreement includes the following:

[0078] Data type classification: clarify different types of data, such as customer identity information (user's personal information, account information), transaction records (payment success / failure information), etc.

[0079] Data sharing permissions: specify which nodes can access which types of data.

[0080] Privacy protection measures: Anonymization or encryption of sensitive data.

[0081] Data retention policy: specifies the storage and usage period of shared data. For example, shared data is retained in the system for 90 days and then automatically deleted.

[0082] The following uses specific examples to illustrate how to manage data sharing and data isolation based on smart contracts. Still taking bank node A, bank node B, and bank node C as examples, payment transactions and account information tests are performed. Bank node A, bank node B, and bank node C each have different requirements: bank node A wants to share transaction history data with bank node B, but does not want to share sensitive account information of customers. Bank node B is willing to share relevant data on failed payment transactions for testing by other banks, but hopes to anonymize the user identity information therein. Bank node C only wants to obtain simulated data and does not want to share its real data. In this scenario, smart contracts can manage the shared data and isolation strategies of each bank node. Specific implementation logic:

[0083] Data sharing between bank node A and bank node B: Bank node A is set through a smart contract and only wants to share transaction history data, not customer account information. When the smart contract's transaction history data sharing function is called, bank node B can access bank node A's transaction history data, and bank node A's data isolation logic ensures that bank node B cannot access account information.

[0084] Anonymization of bank node B: Bank node B wants to share payment transaction failure data with other banks. In order to protect user privacy, when it calls the anonymous data method in the smart contract, it anonymizes the user identity information in the transaction failure. When bank node C calls the method to obtain anonymous transaction failure data, it will obtain the anonymized data instead of the user's real information.

[0085] Data access restrictions of bank node C: Bank node C only wants to obtain simulated data, but does not provide real data. In the smart contract, bank node C can only call the preset simulated data interface and not participate in real data sharing. Smart contracts can ensure that bank node C cannot access the real data of other bank nodes through permission control.

[0086] Dynamic data sharing: For example, during a certain test cycle, bank node A temporarily authorizes bank node C to access its payment transaction failure data, but requires the data to be encrypted. Bank node A dynamically adjusts permissions by calling the authorization function of the smart contract and provides the data to bank node C through an encryption function. In this way, even if bank node C obtains the data, it cannot read the sensitive information in it.

[0087] The data management method based on smart contracts not only improves the sharing flexibility of distributed network systems, but also improves data privacy protection and system trust.

[0088] In some embodiments, the method further comprises:

[0089] Obtaining node data corresponding to the distributed network node;

[0090] According to the node data, a data simulation algorithm is used to generate corresponding simulation data.

[0091] In a distributed network system, nodes generate simulated data through data simulation algorithms to simulate different scenarios, such as transfer, payment, balance inquiry and other transaction scenarios.

[0092] Simulated data is usually generated based on real node data, but in order to ensure data privacy and security, the data will be processed and anonymized. The following introduces the process of obtaining node data and using data simulation algorithms to generate simulated data.

[0093] There are usually two ways to obtain node data:

[0094] a1. Directly use local real data: For example, each bank node can directly use its internal real historical transaction data, but it is necessary to ensure that this data has undergone necessary anonymization or encryption to prevent the leakage of sensitive information.

[0095] a2. Obtain node data from other nodes through data sharing protocols: In a distributed network system, nodes can selectively share some data according to the data sharing protocol. The shared data can be processed transaction records to enhance the authenticity of the test.

[0096] The main function of the data simulation algorithm is to generate simulated data to simulate various possible transaction scenarios, including but not limited to payment, transfer, balance inquiry, etc. The simulated data is similar to the real data but not exactly the same to ensure the authenticity of the test while protecting privacy.

[0097] Exemplarily, the method of generating corresponding simulation data by the data simulation algorithm specifically includes:

[0098] b1. Based on historical transaction data, simulated data is generated by modifying fields such as transaction time, amount, and counterparty.

[0099] b2. Use random number algorithms to generate various types of transaction data and ensure that these data comply with certain business rules.

[0100] b3. Combine real data and randomly generated data to simulate more complex trading scenarios.

[0101] For example, suppose bank node A needs to simulate payment and transfer scenarios and use historical data combined with random data to generate payment and transfer simulation data. The specific steps include:

[0102] Step 1: Simulate based on historical transaction data. Bank node A has a historical transaction record: User 1 has an account balance of 10,000 yuan and recently made a payment of 500 yuan. Generate a new payment transaction through the data simulation algorithm, but in order to avoid using real data directly, modify the transaction parameters. For example, randomly adjust the transaction amount to 480 yuan and set the transaction time to a certain point in the future. The final simulated transaction data generated is: User 1 pays 480 yuan, and the transaction time is **** year ** month ** day.

[0103] Step 2: Generate random data for simulation: Use a random number generator to generate a transaction amount and randomly select a target account for simulation. The generated simulated transfer data is: User 1 transfers 900 yuan to the target account with account ID "123456", and the transaction time is **** year ** month ** day.

[0104] Once a node has generated simulated data, it can selectively share the data as needed. Through smart contracts or data sharing protocols, nodes can define which data can be shared with other nodes and which data needs to be retained. For example, bank node A may only want to share simulated payment data, but not transfer data. Data sharing protocols or smart contracts ensure that the rules for such data sharing are automatically enforced.

[0105] In general, the process of obtaining node data and using data simulation algorithms to generate simulated data includes several steps:

[0106] 1. Obtain node data: obtain data from other nodes from the local real data of the node or through the data sharing protocol.

[0107] 2. Generate simulated data using data simulation algorithms: Create simulated data for testing by modifying real data or generating random data.

[0108] 3. Ensure data privacy and security: Use encryption or anonymization technology to protect sensitive information.

[0109] 4. Selectively share simulation data: Define which data can be shared through smart contracts or data sharing agreements to ensure data security and compliance.

[0110] In this way, the distributed network system can provide a realistic and flexible testing environment, support the participation of multiple institutions, make the testing environment more realistic and diverse, and simulate actual scenarios more accurately, thereby improving the effectiveness and reliability of the test.

[0111] Moreover, through the simulation test environment, the business department can discover and solve problems earlier, reduce the costs caused by production environment problems, and reduce market risks. At the same time, due to the more accurate test environment and more efficient development process, the business department can bring new financial products and services to the market more quickly and seize market opportunities.

[0112] In some embodiments, when the data of a node is updated, other nodes can obtain the latest data in a timely manner. This data synchronization mechanism ensures that when data is updated, the nodes can synchronize data changes in a timely manner to maintain the consistency of shared data. At the same time, an encrypted communication protocol is used between nodes to ensure the confidentiality and integrity of data transmission. The following is an introduction to the data synchronization mechanism:

[0113] Node data update and automatic synchronization: When the data of a node is updated, the system needs to synchronize the update to other nodes in a timely manner to ensure that the data shared between nodes remains consistent. The whole process is divided into the following steps:

[0114] Step 1: Detect data updates: Each node has a local monitoring mechanism. When its internal data is updated, the monitoring system will trigger a synchronization request.

[0115] Step 2: Publish data update events: When a node detects a data update, it broadcasts a "data update event" to the network to notify other nodes that the data has changed. This event is usually published through a message queue service.

[0116] Step 3: Other nodes receive update notifications: Other nodes in the network listen to data update events. When they detect update events, they request the node with updated data to synchronize specific data.

[0117] Step 4: Request and synchronize updated data: After receiving the update event, other nodes send a data synchronization request to the node where the data is updated. The node where the data is updated will decide which data can be shared based on the data sharing agreement and permission settings, and transmit the qualified data to other nodes. If some data is not allowed to be shared, the node where the data is updated can reject the synchronization request or synchronize only part of the data. If sharing is allowed, the node where the data is updated will transmit the encrypted updated data to other nodes.

[0118] Step 5: Data verification and merging: After receiving the updated data, other nodes will verify it to ensure the integrity and correctness of the data. Subsequently, other nodes will merge the new data with their own existing data to keep the local data up to date.

[0119] For example, taking the data synchronization between bank node A and bank node B as an example, suppose bank node A generates a new payment record, a transaction record of a user paying 100 yuan, and the monitoring system of bank node A detects this new record and publishes a "payment data update" event to the network. After receiving the event, bank node B sends a synchronization request to bank node A, requesting the latest payment record. Bank node A determines that the payment record can be shared according to the sharing agreement, and sends the encrypted data to bank node B. After receiving the data, bank node B decrypts and verifies it, and after confirming that the data is complete and correct, it stores it in the local system to complete data synchronization.

[0120] Design of encrypted communication protocol: In the process of data synchronization, the confidentiality and integrity of data transmission mainly rely on encrypted communication protocol. The solution mainly involves TLS (Transport Layer Security) protocol, and combines digital certificates to ensure the identity authentication of both parties and the confidentiality of data. For example, taking the data synchronization encrypted transmission between bank node A and bank node B as an example, bank node A detects data update: generates a new transaction record, user 1 pays 200 yuan, and bank node A publishes an update event: uses the message queue to publish a "payment data update" notification. Bank node B sends a synchronization request: bank node B initiates a data synchronization request to bank node A. After receiving the request, bank node A determines that the transaction record can be shared. Bank node A encrypts data transmission: bank node A sends this payment record to bank node B through the TLS encrypted channel to ensure that the data will not be eavesdropped or tampered with by a third party during transmission. Bank node B receives and decrypts the data: bank node B uses the same encryption protocol to decrypt the received data, performs data verification, and merges it into the local database.

[0121] When a third-party developer wants to perform a business test, the third-party developer sends a business test request based on the API interface. The API gateway parses the request and forwards the request to the corresponding node in the distributed network system. The corresponding node in the distributed network system receives the request.

[0122] S102. According to the business test request, call the smart contract corresponding to the distributed network node, where the smart contract includes various test case templates.

[0123] After receiving the request, the node in the distributed network system calls the smart contract deployed on the node, which is responsible for interpreting and executing programmable test cases. The smart contract includes various types of test case templates for flexible calling during testing. These test case templates predefine some common transaction scenarios, including but not limited to various possible transaction scenarios such as transfer, balance query, and transaction failure.

[0124] S103: Generate test cases corresponding to business tests according to the smart contract.

[0125] Based on various types of test case templates, select the appropriate test case template according to the test requirements and generate test cases corresponding to the business test.

[0126] In some embodiments, Figure 3 As shown, step S103 may include step S1031 and step S1032.

[0127] S1031. Selecting a target test case template corresponding to the business test from the smart contract;

[0128] S1032: Perform parameter configuration based on the target test case template to generate the test case.

[0129] According to the test requirements, an appropriate test case template is selected from various types of test case templates as the target test case template, and a specific test case is generated by configuring different parameters.

[0130] S104: Execute the test case to obtain the corresponding business test result.

[0131] The test steps based on smart contracts involve executing different test case operations in a distributed network system and automatically recording the execution results of each test case, including success, failure, etc., to obtain the corresponding business test results. For example, the execution results of each test case are recorded through event logs or on-chain storage.

[0132] For example, suppose a test case is to simulate a transfer transaction of bank node A to test the transfer function of its system. The following are the processing steps based on smart contracts:

[0133] 1. Initialize the smart contract and test environment, write the smart contract script, define the logic of the transfer operation, test case template and feedback mechanism. In the test environment, bank node A deploys these smart contracts and opens relevant APIs for third-party developers to call.

[0134] 2. Third-party developers call smart contracts: In the test environment, third-party developers use the specified API or interface to call the smart contract on bank node A. Third-party developers write test scripts, call the test case template in the smart contract (such as transfer operations), pass the corresponding parameters, and generate test cases.

[0135] 3. Smart contract executes transaction operations: When a third-party developer calls the transfer operation of a smart contract, the smart contract will perform logical judgment:

[0136] Check whether the sender's balance is sufficient;

[0137] Deduct the sender's balance and increase the receiver's balance;

[0138] Returns the execution result (success or failure).

[0139] like Figure 4 As shown in the figure, the process of third-party developers conducting transaction tests based on the distributed network system is as follows: the third-party developer sends a request based on the API interface, the API gateway receives the request, parses the request, forwards it to the node in the distributed network system, calls the smart contract deployed on the node, executes related operations, conducts transaction tests, and returns the test results to the third-party developer through the API interface.

[0140] In some embodiments, the method further comprises:

[0141] According to the node information of each of the distributed network nodes and the business testing requirements, the algorithm / strategy is adjusted, and the algorithm / strategy includes at least one of a node load balancing strategy, a test case adjustment strategy, a data sharing strategy, and a data simulation algorithm adjustment strategy.

[0142] The distributed network system is configured with an adaptive adjustment mechanism. The system can dynamically adjust algorithms / strategies based on the node information of each node (such as network load, node participation, resource conditions, etc.) and business test requirements to ensure that the distributed network system remains flexible and efficient in a changing environment. Among them, algorithms / strategies include but are not limited to node load balancing strategies, test case adjustment strategies, data sharing strategies, transaction frequency adaptive adjustment strategies, data simulation algorithm adjustment strategies, adaptive security strategies, etc. Among them:

[0143] Node load balancing strategy: By real-time monitoring of each node's processing power, network bandwidth, computing resources and other indicators, the distributed network system can dynamically adjust data traffic and processing tasks. For example, if a node has a high load, the distributed network system can automatically reduce the number of requests to that node, or distribute some requests to other nodes with lighter loads.

[0144] For example, when bank node A is performing multiple tests, the distributed network system monitors that its CPU (Central Processing Unit) and memory resources are close to the upper limit. At this time, the distributed network system will automatically reduce requests to bank node A, such as reducing synchronization requests for transaction data or delaying certain non-critical tasks. At the same time, the distributed network system will allocate more requests to other nodes with lower loads (such as bank node B) to ensure the efficient operation of the overall system.

[0145] Test case adjustment strategy: Distributed network systems can adjust the amount, complexity, and frequency of simulated data according to the type and goal of the test case. For example, a simple payment transaction test only requires a small amount of data and a lightweight transaction process, while a complex risk assessment test may require more historical data and multi-dimensional transaction simulation data. When the distributed network system executes a simple payment test case, it will reduce the data size, for example, only generating 10 transaction records to simulate the distributed network system response time. When the distributed network system performs a complex risk assessment test, the distributed network system will automatically expand the data set, which may generate tens of thousands of simulated transaction records to ensure that the complexity of the test case can truly reflect the risks in the actual business.

[0146] Data sharing strategy: Through smart contracts, nodes can dynamically choose which data can be shared and which needs to be kept confidential based on their own business needs. The distributed network system will automatically adjust the scope of data sharing based on the node's security policy, compliance requirements and current business needs. In low-risk scenarios, more data sharing can be allowed, while in high-risk scenarios, the content of sharing may be strictly restricted. For example, when bank node A participates in an ordinary test case, it can choose to share partially anonymized user data, such as transfer records. But when bank node A participates in more sensitive tests, such as test cases involving a large amount of customer sensitive information, the distributed network system will automatically adjust the sharing strategy to ensure that such sensitive data is not shared, and may even only share the summary or encrypted information of the data.

[0147] Adaptive transaction frequency adjustment strategy: When the network condition is poor or the node performance is poor, the distributed network system can automatically reduce the frequency of transaction simulation, and vice versa. For example, when the network bandwidth of bank node A decreases, the distributed network system detects that the data transmission delay has increased, and automatically reduces the number of simulated transactions generated from 100 transactions per minute to 50 transactions per minute to ensure that there will be no network congestion. Conversely, when bank node A returns to normal, the distributed network system will gradually increase the number of simulated transactions and return to the original 100 transactions per minute.

[0148] Data simulation algorithm adjustment strategy: Under different test cases, the distributed network system can dynamically adjust the dimensions of data simulation. For example, in a backtest test case, the distributed network system requires the use of transaction data from the past three months for testing. Therefore, the distributed network system will automatically adjust the data simulation algorithm to generate transaction records that meet the time range. In another real-time test case, the distributed network system needs to simulate a large number of real-time transaction operations. The distributed network system will adjust and generate recent data accordingly, and frequently refresh the transaction data to ensure that the test can reflect the situation in the real trading environment.

[0149] Adaptive security strategy: When the distributed network system detects certain potential security threats (such as abnormal traffic, attack behavior, etc.), the distributed network system can automatically increase the security level. For example, when the distributed network system detects suspicious traffic from a certain node, the distributed network system will automatically increase the strength of data encryption from ordinary symmetric encryption to stronger asymmetric encryption, and require nodes to add additional two-factor authentication when synchronizing data. Once the threat is eliminated, the distributed network system can automatically revert to the original encryption strategy to maintain the flexibility of the distributed network system.

[0150] The adaptive adjustment mechanism ensures that the distributed network system can flexibly respond to various business needs in a dynamic environment. By monitoring the status of nodes and the operation of the distributed network system, the distributed network system can automatically adjust various algorithms / strategies to improve the efficiency and security of the test and the scalability of the distributed network system.

[0151] In some embodiments, Figure 5 As shown, step S105 may be included after step S104.

[0152] S105. Generate a test report according to the business test result, so as to adjust the smart contract based on the test report.

[0153] Generate a corresponding test report based on the business test results, and output the test report for relevant personnel or institutions (such as third-party developers or banks) to understand the execution status of the test cases.

[0154] For example, after the test is completed, the results of all transaction operations are automatically analyzed, including the success rate, execution time, and failure reasons of each transaction, and a test report is generated to help banks and third-party developers understand the performance of the distributed network system under the test case and identify potential problems. For example, if multiple transfer transactions fail, the distributed network system can analyze the reasons for the failure (such as insufficient balance, network delay, etc.) and provide solutions.

[0155] For example, suppose 10 transfer test cases are executed, 8 of which succeed and 2 fail. The distributed network system generates the following test report:

[0156] Total test cases executed: 10

[0157] Successful use cases: 8

[0158] Failed use cases: 2

[0159] Failure reasons: 1 insufficient balance, 1 account does not exist.

[0160] Based on the test report, third-party developers and banks can further adjust the distributed network system, optimize the logic of test cases, and fix potential problems. For example, if the test results show that there is a problem with the insufficient balance processing logic in the transfer operation, the third-party developer can modify the smart contract code and retest. Smart contracts can adjust parameters or logic at any time based on test results to better adapt to different testing needs.

[0161] Through this mechanism, the distributed network system can provide a highly automated, flexible and secure testing environment to help banks and third-party developers verify the functions and performance of the distributed network system in a real testing environment.

[0162] In the above embodiment, by receiving a service test request based on an API, the smart contract corresponding to the distributed network node is called according to the service test request. The smart contract includes various test case templates. According to the smart contract, the test case corresponding to the service test is generated, the test case is executed, and the corresponding service test result is obtained. The test environment is more realistic and diversified, thereby improving the reliability of the test. Through more accurate testing, enterprises can provide more stable and higher-quality financial services, thereby improving user satisfaction and experience.

[0163] See also Figure 6 , Figure 6 It is a schematic block diagram of a service testing device provided in an embodiment of the present application. The service testing device can be configured in a computer device to execute the aforementioned distributed network-based service testing method.

[0164] like Figure 6 As shown, the service testing device 1000 includes: an acquisition module 1001 , a processing module 1002 , a generation module 1003 , and an execution module 1004 .

[0165] The acquisition module 1001 is used to receive a service test request based on an application programming interface API;

[0166] The processing module 1002 is used to call the smart contract corresponding to the distributed network node according to the business test request, and the smart contract includes various test case templates;

[0167] A generating module 1003 is used to generate a test case corresponding to the business test according to the smart contract;

[0168] The execution module 1004 is used to execute the test case and obtain the corresponding business test result.

[0169] In one embodiment, the generating module 1003 is further used for:

[0170] Selecting a target test case template corresponding to the business test from the smart contract;

[0171] Parameter configuration is performed based on the target test case template to generate the test case.

[0172] In one embodiment, the service testing device 1000 further includes a configuration module, which is used to:

[0173] An open unified standardized API specification is configured so that each of the distributed network nodes can perform data interaction based on the API specification.

[0174] In one embodiment, the processing module 1002 is further configured to:

[0175] Data management is performed based on the smart contract, the data includes real data and simulated data, and the data management includes at least one of data isolation and data sharing.

[0176] In one embodiment, the processing module 1002 is further configured to:

[0177] Obtaining node data corresponding to the distributed network node;

[0178] According to the node data, a data simulation algorithm is used to generate corresponding simulation data.

[0179] In one embodiment, the service testing device 1000 further includes an adjustment module, which is used to:

[0180] According to the node information of each of the distributed network nodes and the business testing requirements, the algorithm / strategy is adjusted, and the algorithm / strategy includes at least one of a node load balancing strategy, a test case adjustment strategy, a data sharing strategy, and a data simulation algorithm adjustment strategy.

[0181] In one embodiment, the generating module 1003 is further used for:

[0182] A test report is generated according to the business test result, so as to adjust the smart contract based on the test report.

[0183] Among them, each module in the above-mentioned service testing device 1000 corresponds to each step in the above-mentioned embodiment of the service testing method based on the distributed network, and its functions and implementation processes are no longer described one by one here.

[0184] The service testing device 1000 can execute the service testing method based on a distributed network provided in the embodiment of the present application. Therefore, the beneficial effects that can be achieved by the service testing method based on a distributed network provided in the embodiment of the present application can be achieved. Please refer to the previous embodiment for details and will not be repeated here.

[0185] The method and apparatus of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0186] Exemplarily, the above method and apparatus may be implemented in the form of a computer program. The computer program may be implemented in the form of a computer program. Figure 7 Runs on the computer device shown.

[0187] See also Figure 7 , Figure 7 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application.

[0188] See also Figure 7 The computer device includes a processor and a memory connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0189] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0190] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any service testing method based on the distributed network.

[0191] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0192] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0193] Receive business test requests based on the application programming interface API;

[0194] According to the business test request, calling the smart contract corresponding to the distributed network node, the smart contract includes various test case templates;

[0195] Generate test cases corresponding to business tests according to the smart contract;

[0196] Execute the test case to obtain the corresponding business test result.

[0197] In one embodiment, when the processor generates a test case corresponding to the business test according to the smart contract, it is used to implement:

[0198] Selecting a target test case template corresponding to the business test from the smart contract;

[0199] Parameter configuration is performed based on the target test case template to generate the test case.

[0200] In one embodiment, the processor is further configured to implement:

[0201] An open unified standardized API specification is configured so that each of the distributed network nodes can perform data interaction based on the API specification.

[0202] In one embodiment, the processor is further configured to implement:

[0203] Data management is performed based on the smart contract, the data includes real data and simulated data, and the data management includes at least one of data isolation and data sharing.

[0204] In one embodiment, the processor is further configured to implement:

[0205] Obtaining node data corresponding to the distributed network node;

[0206] According to the node data, a data simulation algorithm is used to generate corresponding simulation data.

[0207] In one embodiment, the processor is further configured to implement:

[0208] According to the node information of each of the distributed network nodes and the business testing requirements, the algorithm / strategy is adjusted, and the algorithm / strategy includes at least one of a node load balancing strategy, a test case adjustment strategy, a data sharing strategy, and a data simulation algorithm adjustment strategy.

[0209] In one embodiment, after executing the test case and obtaining the corresponding service test result, the processor is used to implement:

[0210] A test report is generated according to the business test result, so as to adjust the smart contract based on the test report.

[0211] The computer device can execute the distributed network-based business testing method provided in the embodiment of the present application. Therefore, it can achieve the beneficial effects that can be achieved by the distributed network-based business testing method provided in the embodiment of the present application. Please refer to the previous embodiment for details and will not be repeated here.

[0212] An embodiment of the present application also provides a computer-readable storage medium.

[0213] The computer-readable storage medium of the present application stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned distributed network-based service testing method are implemented.

[0214] The computer-readable storage medium may be an internal storage unit of the service test device or computer device described in the foregoing embodiments, such as a hard disk or memory of the service test device or computer device. The computer-readable storage medium may also be an external storage device of the service test device or computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital card (Secure Digital Card, SD Card), a flash card (Flash Card), etc., equipped on the service test device or computer device.

[0215] Since the computer program stored in the computer-readable storage medium can execute any of the distributed network-based business testing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the distributed network-based business testing methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0216] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0217] The blockchain referred to in this application 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.

[0218] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0219] The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and these modifications or substitutions should be included in the protection scope of the present application.

Claims

1. A distributed network-based service testing method, characterized in that: The distributed network-based service testing method comprises: Receive business test requests based on the application programming interface API; According to the business test request, calling the smart contract corresponding to the distributed network node, the smart contract includes various test case templates; Generate test cases corresponding to business tests according to the smart contract; Execute the test case to obtain the corresponding business test result.

2. The distributed network-based service testing method according to claim 1, characterized in that: The step of generating a test case corresponding to the business test according to the smart contract includes: Selecting a target test case template corresponding to the business test from the smart contract; Parameter configuration is performed based on the target test case template to generate the test case.

3. The distributed network-based service testing method according to claim 2, characterized in that: The method further comprises: An open unified standardized API specification is configured so that each of the distributed network nodes can perform data interaction based on the API specification.

4. The distributed network-based service testing method according to claim 1, characterized in that: The method further comprises: Data management is performed based on the smart contract, the data includes real data and simulated data, and the data management includes at least one of data isolation and data sharing.

5. The distributed network-based service testing method according to claim 4, characterized in that: The method further comprises: Obtaining node data corresponding to the distributed network node; According to the node data, a data simulation algorithm is used to generate corresponding simulation data.

6. The distributed network-based service testing method according to claim 1, characterized in that: The method further comprises: According to the node information of each of the distributed network nodes and the business testing requirements, the algorithm / strategy is adjusted, and the algorithm / strategy includes at least one of a node load balancing strategy, a test case adjustment strategy, a data sharing strategy, and a data simulation algorithm adjustment strategy.

7. The distributed network-based service testing method according to any one of claims 1 to 6, characterized in that: After executing the test case and obtaining the corresponding business test result, the method includes: A test report is generated according to the business test result, so as to adjust the smart contract based on the test report.

8. A service testing device, characterized in that: The service testing device comprises: An acquisition module, used for receiving a business test request based on an application programming interface API; A processing module, configured to call a smart contract corresponding to a distributed network node according to the service test request, wherein the smart contract includes various test case templates; A generation module, used to generate test cases corresponding to business tests according to the smart contract; The execution module is used to execute the test case and obtain the corresponding business test result.

9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the distributed network-based service testing method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the distributed network-based service testing method according to any one of claims 1 to 7 are implemented.