A method and apparatus for testing a digital currency system

By receiving account test requests, querying the balance of the account to be tested, and generating transaction test data for simulated trading, the problem of relying on manual verification of the results in existing technologies has been solved, realizing automated testing of digital currency systems and improving testing efficiency and accuracy.

CN116185806BActive Publication Date: 2026-05-12THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST +1
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
Filing Date
2021-11-26
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing automated testing methods for digital currency systems mainly rely on manual database queries to verify test results, resulting in low automation, low efficiency, and low accuracy.

Method used

By receiving account test requests, querying the balance of the account to be tested, generating transaction test data for simulated transactions, and automatically verifying the account balance and accounting entries after the simulated transactions are completed, the system can achieve automated testing of the digital currency system.

Benefits of technology

It improved the automation and efficiency of digital currency system testing, increased testing accuracy, expanded the testing scope, and ensured the system's universality, compatibility, and ease of use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116185806B_ABST
    Figure CN116185806B_ABST
Patent Text Reader

Abstract

The application discloses a kind of test method and device of digital currency system, it is related to computer technical field.The specific embodiment of the method includes: receiving account test request, according to account information indicated by account test request, query the first account balance corresponding to the account to be tested;According to the test environment and transaction test scene indicated by account test request, generate transaction test data, to carry out simulated transaction according to transaction test data using digital currency system;After simulated transaction is completed, according to account information, query the second account balance corresponding to the account to be tested;According to the second account balance, the first account balance and transaction test data, the account to be tested is checked, to realize the test of digital currency system.The embodiment improves the degree of automation of digital currency system test, improves test efficiency and test accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a testing method and apparatus for a digital currency system. Background Technology

[0002] In the development and testing of digital currency systems, the increasing number of system versions and application scenarios places higher demands on compressing testing cycles and improving testing quality. Current automated testing of digital currency systems primarily focuses on transaction messages, using the feedback results of these messages to reflect transaction status and outcomes. In other words, existing automated testing methods for digital currency systems mainly consider whether the system can function normally, and then manually verify the test results by querying the database after the transaction messages are received.

[0003] The existing technology has at least the following problems:

[0004] Existing automated testing methods mainly target the operation of digital currency systems in different testing environments and scenarios. However, the testing of the results is primarily done manually by querying the database. Because the testing of the results is not included in the scope of automated testing, the automation level of digital currency system testing is low, resulting in low testing efficiency and low testing accuracy. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a testing method and apparatus for a digital currency system, which can incorporate the testing of the running results into the automated testing process, thereby improving the automation level, testing efficiency and testing accuracy of the digital currency system testing.

[0006] To achieve the above objectives, according to a first aspect of the present invention, a testing method for a digital currency system is provided, comprising:

[0007] Receive an account test request, and query the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request;

[0008] Based on the test environment and transaction test scenario indicated in the account test request, transaction test data is generated to simulate transactions using the digital currency system. The test environment includes multiple test versions and corresponds to one or more transaction test scenarios. The transaction test data includes the accounts of both parties, the transaction amount, and the transaction direction.

[0009] After the simulated trading is completed, check the balance of the second account corresponding to the test account based on the account information;

[0010] Based on the balance of the second account, the balance of the first account, and the transaction test data, the test account is verified in order to test the digital currency system.

[0011] Furthermore, based on the balance of the second account, the balance of the first account, and the transaction test data, the account to be tested is verified, including:

[0012] Based on the balance of the first account and the transaction amount, transaction direction, and accounts of both parties indicated in the transaction test data, determine the expected balance corresponding to the account to be tested;

[0013] By verifying whether the expected balance and the balance of the second account are consistent, the test account can be used for testing.

[0014] Furthermore, the transaction test data also indicates the transaction type and the correspondence between the transaction type and the number of accounting entries generated; if the account test request also indicates accounting entry test information; the method also includes:

[0015] Based on the transaction types indicated by the transaction test data, and the correspondence between transaction types and the number of accounting entries generated, determine the expected value of the number of accounting entries corresponding to the account to be tested;

[0016] After the simulated transaction is completed, query the actual number of accounting entries corresponding to the account to be tested;

[0017] By verifying whether the actual number of accounting entries matches the expected number of accounting entries, the number of accounting entries for the account to be tested can be tested.

[0018] Furthermore, the accounting entry includes multiple accounting entries, and if the account testing request also indicates accounting entry testing information; the method also includes:

[0019] Based on the accounting subject and account information indicated by the accounting subject test information, after the simulated transaction is successful, query the target accounting subject information corresponding to the account to be tested, so as to verify the target accounting subject information based on the transaction data.

[0020] Furthermore, before the steps of receiving an account test request and querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request, the method further includes:

[0021] Set script variables based on the test environment, transaction test scenario, account information, and transaction test data so that users can initiate account test requests based on the script variables.

[0022] Furthermore, it also includes:

[0023] Receive one or more update messages from among test environment update messages, transaction test scenario update messages, and business attribute update messages;

[0024] Update the script variables based on the update information.

[0025] Furthermore, if the simulated trading fails, the method also includes:

[0026] The simulated trading session was terminated, and a trading failure message was displayed.

[0027] According to a second aspect of the present invention, a testing apparatus for a digital currency system is provided, comprising:

[0028] The test request receiving module is used to receive account test requests and query the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request.

[0029] The transaction test data generation module generates transaction test data based on the test environment and transaction test scenario indicated by the account test request, so as to conduct simulated transactions using the digital currency system based on the transaction test data; wherein, the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of the two parties to the transaction, the transaction amount, and the transaction direction;

[0030] The query module is used to query the balance of the second account corresponding to the test account based on the account information after the simulated transaction is completed;

[0031] The testing module is used to verify the accounts to be tested based on the balance of the second account, the balance of the first account, and transaction test data, so as to test the digital currency system.

[0032] According to a third aspect of the present invention, an electronic device is provided, comprising:

[0033] One or more processors;

[0034] Storage device for storing one or more programs.

[0035] When one or more programs are executed by one or more processors, the one or more processors implement the testing methods for any of the digital currency systems described above.

[0036] According to a fourth aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements a testing method for any of the digital currency systems described above.

[0037] One embodiment of the above invention has the following advantages or beneficial effects: By receiving an account test request, querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request; generating transaction test data based on the test environment and transaction test scenario indicated in the account test request, and then using the digital currency system to conduct simulated transactions based on the transaction test data; wherein the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction; after the simulated transaction is completed, querying the balance of the second account corresponding to the account to be tested based on the account information; and verifying the account to be tested based on the second account balance, the first account balance, and the transaction test data, the technical means of testing the digital currency system are achieved. Therefore, this overcomes the technical problems of low automation, low efficiency, and low accuracy in existing automated testing methods, which mainly target the operation of the digital currency system under different test environments and scenarios, while the testing of the operation results is mainly verified by manually querying the database. This achieves the technical effect of incorporating the testing of the operation results into the automated testing process, thereby improving the automation level, testing efficiency, and testing accuracy of the digital currency system testing.

[0038] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0039] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0040] Figure 1 This is a schematic diagram of the main flow of the testing method for the digital currency system provided in the first embodiment of the present invention;

[0041] Figure 2 This is a schematic diagram of the main flow of the testing method for a digital currency system provided according to the second embodiment of the present invention;

[0042] Figure 3 This is a schematic diagram of the main modules of a testing device for a digital currency system provided according to an embodiment of the present invention;

[0043] Figure 4 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0044] Figure 5 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0045] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0046] Existing automated testing methods primarily target the operation of digital currency systems under different testing environments and scenarios. However, the testing results are mainly verified manually by querying the database. Manually verifying account balances and accounting entries leads to low testing efficiency. Furthermore, manual verification relies heavily on the tester's individual skills, requiring familiarity with the test transaction scenarios, accounting entry methods, and the corresponding accounting subjects and accounting directions for different test transaction scenarios. This can easily result in omissions in the verification of test items or errors in the verification process due to insufficient skills, leading to low testing efficiency.

[0047] To address the aforementioned technical problems, the present invention provides the following technical solution:

[0048] A schematic diagram of the main flow of the testing method for the digital currency system provided in the first embodiment of the present invention; as shown below. Figure 1 As shown, the testing method for the digital currency system provided in this embodiment of the invention mainly includes:

[0049] Step S101: Receive an account test request and query the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request.

[0050] Upon receiving an account test request, the database interface is called to query the balance of the first account corresponding to the account to be tested. This helps to verify the transaction results (account balance) after the subsequent simulated transactions are completed, thereby achieving automated testing of the transaction results and improving the automation level of digital currency system testing.

[0051] Specifically, according to an embodiment of the present invention, before the step of receiving an account test request and querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request, the method further includes:

[0052] Set script variables based on the test environment, transaction test scenario, account information, and transaction test data so that users can initiate account test requests based on the script variables.

[0053] The test environment mainly refers to the deployed test version. Different test environments can include one or more transaction test scenarios. Transaction test scenarios include specific business scenarios in the digital currency system, such as deposit transaction scenarios, transfer transaction scenarios, and reversal transaction scenarios. Transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction.

[0054] By setting up the script variables according to the test environment, transaction test scenario, account information, and transaction test data, the corresponding tests can be carried out in different test environments and different transaction test scenarios, ensuring the universality, compatibility, and ease of use of the digital currency system test.

[0055] Furthermore, according to embodiments of the present invention, it further includes:

[0056] Receive one or more update messages from among test environment update messages, transaction test scenario update messages, and business attribute update messages;

[0057] Update the script variables based on the update information.

[0058] By setting up the script variables according to the received update information, the scalability of the digital currency system test can be improved.

[0059] Step S102: Generate transaction test data according to the test environment and transaction test scenario indicated by the account test request, so as to use the digital currency system to conduct simulated transactions based on the transaction test data.

[0060] The testing process involves simulating transactions using transaction test data generated within the digital currency system based on the test environment and transaction test scenario indicated by the account test request. By setting these parameters, it helps to test whether the digital currency system can operate normally under the current test environment and transaction test scenario, i.e., whether it can complete the aforementioned simulated transactions.

[0061] Step S103: After the simulated transaction is completed, query the balance of the second account corresponding to the account to be tested based on the account information.

[0062] During the simulated transaction, the transaction test data indicates that the transaction amounts between the two accounts are transferred according to the transaction direction. When the simulated transaction is completed and successful, the database is called to query the balance of the second account corresponding to the test account, so as to verify the transaction results (account balance) and realize the automated testing of transaction results, thereby improving the automation level of digital currency system testing.

[0063] Furthermore, according to an embodiment of the present invention, if the simulated transaction fails, the method further includes:

[0064] The simulated trading session was terminated, and a trading failure message was displayed.

[0065] Specifically, if the simulated transaction fails, it means that the current simulated transaction cannot run normally in the current test scenario under the current test environment. By providing feedback on failed transactions, developers can help maintain the digital currency system based on the failed transaction information.

[0066] Step S104: Based on the balance of the second account, the balance of the first account, and the transaction test data, the account to be tested is verified in order to test the digital currency system.

[0067] Specifically, according to embodiments of the present invention, the above-mentioned verification of the test account based on the second account balance, the first account balance, and transaction test data includes:

[0068] Based on the balance of the first account and the transaction amount, transaction direction, and accounts of both parties indicated in the transaction test data, determine the expected balance corresponding to the account to be tested;

[0069] By verifying whether the expected balance and the balance of the second account are consistent, the test account can be used for testing.

[0070] The above settings enable the verification of transaction results such as account balances, achieve automated testing of account balances, expand the scope of testing, and improve the automation level of digital currency system testing.

[0071] Furthermore, according to embodiments of the present invention, the aforementioned transaction test data also indicates the transaction type and the correspondence between the transaction type and the number of accounting entries generated; if the account test request also indicates accounting entry test information; the method further includes:

[0072] Based on the transaction types indicated by the transaction test data, and the correspondence between transaction types and the number of accounting entries generated, determine the expected value of the number of accounting entries corresponding to the account to be tested;

[0073] After the simulated transaction is completed, query the actual number of accounting entries corresponding to the account to be tested;

[0074] By verifying whether the actual number of accounting entries matches the expected number of accounting entries, the number of accounting entries for the account to be tested can be tested.

[0075] The above settings enable the verification of transaction results, such as the quantity of accounting entries, and facilitate automated testing of accounting entry quantities. This further expands the scope of testing and enhances the automation level of digital currency system testing.

[0076] Preferably, according to an embodiment of the present invention, the above-mentioned accounting entries include multiple accounting subjects, and if the account testing request also indicates accounting subject testing information; the method further includes:

[0077] Based on the accounting subject and account information indicated by the accounting subject test information, after the simulated transaction is successful, query the target accounting subject information corresponding to the account to be tested, so as to verify the target accounting subject information based on the transaction data.

[0078] The above settings enable the verification of transaction results using accounting subject information (simulated transaction details), achieving automated testing of accounting subject information, expanding the scope of testing, and further improving the automation level of digital currency system testing.

[0079] According to the technical solution of this invention, by receiving an account test request, querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request, generating transaction test data based on the test environment and transaction test scenario indicated in the account test request, and using the digital currency system to conduct simulated transactions based on the transaction test data; wherein, the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction; after the simulated transaction is completed, querying the balance of the second account corresponding to the account to be tested based on the account information; and verifying the account to be tested based on the second account balance, the first account balance, and the transaction test data, the technical means of testing the digital currency system are achieved. Therefore, this overcomes the technical problems of low automation, low efficiency, and low accuracy in existing automated testing methods, which mainly target the operation of the digital currency system under different test environments and different test scenarios, and the testing of the operation results is mainly verified by manually querying the database. This achieves the technical effect of incorporating the testing of the operation results into the automated testing process, thereby improving the automation level, testing efficiency, and testing accuracy of digital currency system testing.

[0080] Figure 2 This is a schematic diagram of the main flow of the testing method for a digital currency system provided according to the second embodiment of the present invention; as shown below. Figure 2 As shown, the testing method for the digital currency system provided in this embodiment of the invention mainly includes:

[0081] Step S201: Set script variables according to the test environment, transaction test scenario, account information and transaction test data so that users can initiate account test requests based on the script variables.

[0082] This invention improves upon existing automated testing frameworks (such as Robot Framework, or RF for short, an automated testing framework that supports keyword-driven testing and can simultaneously test multiple types of clients or interfaces). It enhances the database plugin within the automated testing framework by enabling database connections and developing test scripts to perform functions such as verifying account balances and accounting entries, making it suitable for automated testing in various transaction scenarios. According to embodiments of this invention, the database plugin within the automated testing framework can be used for database connections and access (e.g., connecting and accessing the database using the keyword "database connection," which encapsulates a method for accessing the database). This keyword enables RF scripts to access the database. Furthermore, by setting test variables and testing transaction scenarios, automated testing of digital currency systems under different testing environments and transaction scenarios can be achieved (executing the complete process of "simulated transaction - account balance verification - accounting entry verification").

[0083] By setting up the script variables according to the test environment, transaction test scenario, account information, and transaction test data, the corresponding tests can be carried out in different test environments and different transaction test scenarios, ensuring the universality, compatibility, and ease of use of the digital currency system test.

[0084] According to a specific implementation of the present invention, for example, regarding the "verify account balance" test function, the input items are designed as "account number" and "account type," and the output item is designed as "account balance." This allows the "verify account balance" test function to be used regardless of specific scenario information such as transaction type or specific transaction code, thereby achieving the universality of digital currency system testing. Furthermore, if the current digital currency system has a single account type, the "account type" input item corresponding to "verify account balance" can be left empty by default. If the system subsequently expands its business functions, resulting in an increase in the number of account types and multiple account tables for different account types, updates can be made through "account type." Then, when verifying account balance, the corresponding data in the account table for the corresponding account type can be queried, ensuring the compatibility and scalability of digital currency system testing. On the other hand, the number of script variables corresponding to the test results is small, and the execution process is relatively simple, ensuring the ease of use of digital currency system testing.

[0085] Furthermore, according to embodiments of the present invention, it further includes:

[0086] Receive one or more update messages from among test environment update messages, transaction test scenario update messages, and business attribute update messages;

[0087] Update the script variables based on the update information.

[0088] By setting up the script variables according to the received update information, the scalability of the digital currency system test can be improved.

[0089] Step S202: Receive an account test request, and query the balance of the first account and the current number of accounting entries corresponding to the account to be tested based on the account information and accounting entry test information indicated in the account test request.

[0090] Upon receiving an account test request, the database interface is called to query the balance of the first account corresponding to the account to be tested. This helps to verify the transaction results (account balance) after the subsequent simulated transactions are completed, thereby achieving automated testing of the transaction results and improving the automation level of digital currency system testing.

[0091] Step S203: Generate transaction test data according to the test environment and transaction test scenario indicated by the account test request, so as to use the digital currency system to conduct simulated transactions based on the transaction test data.

[0092] The testing process involves simulating transactions using transaction test data generated within the cryptocurrency system based on the test environment and transaction test scenarios indicated by the account test request. (The accounting module in the cryptocurrency system acts as a service provider, offering services to the transaction module via an interface. When the services provided by the accounting module are consumed (executed by the transaction module), some internal processing is performed, updating the transaction results in its own database.) By setting these parameters, it helps to test whether the cryptocurrency system can operate normally under the current test environment and transaction test scenarios, i.e., whether it can complete the aforementioned simulated transactions.

[0093] Step S204: After the simulated transaction is completed, query the balance of the second account corresponding to the test account and the actual value of the accounting entries based on the account information;

[0094] During the simulated transaction, the transaction test data indicates that the two accounts involved in the transaction have completed the transfer of transaction amount according to the transaction direction. When the simulated transaction is completed and successful, the balance of the second account corresponding to the account under test is queried by calling the database, so as to verify the transaction results (account balance, accounting entry quantity) and realize the automated testing of transaction results, thereby improving the automation level of digital currency system testing.

[0095] Furthermore, according to an embodiment of the present invention, if the simulated transaction fails, the method further includes:

[0096] The simulated trading session was terminated, and a trading failure message was displayed.

[0097] Specifically, if the simulated transaction fails, it means that the current simulated transaction cannot run normally in the current test scenario under the current test environment. By providing feedback on failed transactions, developers can help maintain the digital currency system based on the failed transaction information.

[0098] Step S205: Based on the balance of the first account and the transaction amount, transaction direction, and accounts of both parties indicated in the transaction test data, determine the expected balance corresponding to the account to be tested. By verifying whether the expected balance is consistent with the balance of the second account, the account to be tested can be tested.

[0099] The above settings enable the verification of transaction results such as account balances, achieve automated testing of account balances, expand the scope of testing, and improve the automation level of digital currency system testing.

[0100] Step S206: Based on the transaction type indicated by the transaction test data and the correspondence between the transaction type and the number of accounting entries generated, determine the expected value of the number of accounting entries corresponding to the account to be tested; by verifying whether the actual value of the number of accounting entries and the expected value of the number of accounting entries are consistent, the number of accounting entries for the account to be tested is tested.

[0101] Each transaction generates corresponding accounting entries, and the number of these entries may vary depending on the specific business transaction. The expected number of accounting entries refers to how many accounting entries are expected to be recorded for this transaction, which is set according to business rules. Specifically, according to business rules, there is a correspondence between the type of transaction and the number of accounting entries that should be recorded. For example, a manual adjustment transaction should record 2 accounting entries. Based on the transaction type indicated by the transaction test data, it can be expected that 2 new accounting entries should be generated in the database for this transaction. During verification, if the database query returns only 1 or 3 accounting entries, it does not meet expectations; if the query returns 2, it meets expectations.

[0102] The above settings enable the verification of transaction results, such as the quantity of accounting entries, and facilitate automated testing of accounting entry quantities. This further expands the scope of testing and enhances the automation level of digital currency system testing.

[0103] Preferably, according to an embodiment of the present invention, the above-mentioned accounting entries include multiple accounting subjects, and if the account testing request also indicates accounting subject testing information; the method further includes:

[0104] Based on the accounting subject and account information indicated by the accounting subject test information, after the simulated transaction is successful, query the target accounting subject information corresponding to the account to be tested, so as to verify the target accounting subject information based on the transaction data.

[0105] Accounting subjects are components of accounting entries and are fundamental objects in accounting processing. They are generally divided into asset accounts, liability accounts, joint asset and liability accounts, owner's equity accounts, and profit and loss accounts. According to the double-entry bookkeeping rule, for every debit, there must be a corresponding credit, and the total debits must equal the total credits. An accounting entry records the changes in the balances of the accounting subjects involved in a transaction (whether the balance of each accounting subject increases or decreases, and by what amount; in accounting entries, the increase or decrease in the balance of an accounting subject is not represented by "increase" or "decrease," but by "debit" and "credit" as the accounting symbols to indicate the direction of the change in the balance of the accounting subject).

[0106] The above settings enable the verification of transaction results using accounting subject information (simulated transaction details), achieving automated testing of accounting subject information, expanding the scope of testing, and further improving the automation level of digital currency system testing.

[0107] According to the technical solution of this invention, by receiving an account test request, querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request, generating transaction test data based on the test environment and transaction test scenario indicated in the account test request, and using the digital currency system to conduct simulated transactions based on the transaction test data; wherein, the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction; after the simulated transaction is completed, querying the balance of the second account corresponding to the account to be tested based on the account information; and verifying the account to be tested based on the second account balance, the first account balance, and the transaction test data, the technical means of testing the digital currency system are achieved. Therefore, this overcomes the technical problems of low automation, low efficiency, and low accuracy in existing automated testing methods, which mainly target the operation of the digital currency system under different test environments and different test scenarios, and the testing of the operation results is mainly verified by manually querying the database. This achieves the technical effect of incorporating the testing of the operation results into the automated testing process, thereby improving the automation level, testing efficiency, and testing accuracy of digital currency system testing.

[0108] Figure 3 This is a schematic diagram of the main modules of a testing apparatus for a digital currency system provided according to an embodiment of the present invention; as shown. Figure 3As shown, the testing device 300 for the digital currency system provided in this embodiment of the invention mainly includes:

[0109] The test request receiving module 301 is used to receive account test requests and query the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request.

[0110] Upon receiving an account test request, the database interface is called to query the balance of the first account corresponding to the account to be tested. This helps to verify the transaction results (account balance) after the subsequent simulated transactions are completed, thereby achieving automated testing of the transaction results and improving the automation level of digital currency system testing.

[0111] Specifically, according to an embodiment of the present invention, the testing apparatus 300 of the above-described digital currency system further includes a script variable setting module. Before the step of receiving an account test request and querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request, the script variable setting module is used to:

[0112] Set script variables based on the test environment, transaction test scenario, account information, and transaction test data so that users can initiate account test requests based on the script variables.

[0113] The test environment mainly refers to the deployed test version. Different test environments can include one or more transaction test scenarios. Transaction test scenarios include specific business scenarios in the digital currency system, such as deposit transaction scenarios, transfer transaction scenarios, and reversal transaction scenarios. Transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction.

[0114] By setting up the script variables according to the test environment, transaction test scenario, account information, and transaction test data, the corresponding tests can be carried out in different test environments and different transaction test scenarios, ensuring the universality, compatibility, and ease of use of the digital currency system test.

[0115] Furthermore, according to an embodiment of the present invention, the testing apparatus 300 for the above-described digital currency system further includes a script variable update module, used for:

[0116] Receive one or more update messages from among test environment update messages, transaction test scenario update messages, and business attribute update messages;

[0117] Update the script variables based on the update information.

[0118] By setting up the script variables according to the received update information, the scalability of the digital currency system test can be improved.

[0119] The transaction test data generation module 302 generates transaction test data based on the test environment and transaction test scenario indicated by the account test request, so as to conduct simulated transactions using the digital currency system based on the transaction test data; wherein, the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of the two parties to the transaction, the transaction amount, and the transaction direction.

[0120] The testing process involves simulating transactions using transaction test data generated within the digital currency system based on the test environment and transaction test scenario indicated by the account test request. By setting these parameters, it helps to test whether the digital currency system can operate normally under the current test environment and transaction test scenario, i.e., whether it can complete the aforementioned simulated transactions.

[0121] The query module 303 is used to query the balance of the second account corresponding to the test account based on the account information after the simulated transaction is completed.

[0122] During the simulated transaction, the transaction test data indicates that the transaction amounts between the two accounts are transferred according to the transaction direction. When the simulated transaction is completed and successful, the database is called to query the balance of the second account corresponding to the test account, so as to verify the transaction results (account balance) and realize the automated testing of transaction results, thereby improving the automation level of digital currency system testing.

[0123] Furthermore, according to an embodiment of the present invention, the testing device 300 of the above-described digital currency system further includes a feedback module, which, if the simulated transaction fails, is used to:

[0124] The simulated trading session was terminated, and a trading failure message was displayed.

[0125] Specifically, if the simulated transaction fails, it means that the current simulated transaction cannot run normally in the current test scenario under the current test environment. By providing feedback on failed transactions, developers can help maintain the digital currency system based on the failed transaction information.

[0126] Test module 304 is used to verify the account to be tested based on the balance of the second account, the balance of the first account, and the transaction test data, so as to test the digital currency system.

[0127] Specifically, according to an embodiment of the present invention, the test module 304 is used for:

[0128] Based on the balance of the first account and the transaction amount, transaction direction, and accounts of both parties indicated in the transaction test data, determine the expected balance corresponding to the account to be tested;

[0129] By verifying whether the expected balance and the balance of the second account are consistent, the test account can be used for testing.

[0130] The above settings enable the verification of transaction results such as account balances, achieve automated testing of account balances, expand the scope of testing, and improve the automation level of digital currency system testing.

[0131] Furthermore, according to embodiments of the present invention, the aforementioned transaction test data also indicates the transaction type and the correspondence between the transaction type and the number of accounting entries generated; the aforementioned testing device 300 for the digital currency system further includes an accounting entry quantity verification module, which, if an account test request is received, also indicates accounting entry test information; the accounting entry quantity verification module is used for:

[0132] Based on the transaction types indicated by the transaction test data, and the correspondence between transaction types and the number of accounting entries generated, determine the expected value of the number of accounting entries corresponding to the account to be tested;

[0133] After the simulated transaction is completed, query the actual number of accounting entries corresponding to the account to be tested;

[0134] By verifying whether the actual number of accounting entries matches the expected number of accounting entries, the number of accounting entries for the account to be tested can be tested.

[0135] The above settings enable the verification of transaction results, such as the quantity of accounting entries, and facilitate automated testing of accounting entry quantities. This further expands the scope of testing and enhances the automation level of digital currency system testing.

[0136] Preferably, according to an embodiment of the present invention, the above-mentioned accounting entries include multiple accounting subjects, and the testing device 300 of the digital currency system further includes an accounting subject information verification module, which, if an account testing request is made, also indicates accounting subject testing information; the accounting subject information verification module is used for:

[0137] Based on the accounting subject and account information indicated by the accounting subject test information, after the simulated transaction is successful, query the target accounting subject information corresponding to the account to be tested, so as to verify the target accounting subject information based on the transaction data.

[0138] The above settings enable the verification of transaction results using accounting subject information (details of simulated transactions), achieving automated testing of accounting subject information, expanding the scope of testing, and further improving the automation level of digital currency system testing.

[0139] According to the technical solution of this invention, by receiving an account test request, querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request, generating transaction test data based on the test environment and transaction test scenario indicated in the account test request, and using the digital currency system to conduct simulated transactions based on the transaction test data; wherein, the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction; after the simulated transaction is completed, querying the balance of the second account corresponding to the account to be tested based on the account information; and verifying the account to be tested based on the second account balance, the first account balance, and the transaction test data, the technical means of testing the digital currency system are achieved. Therefore, this overcomes the technical problems of low automation, low efficiency, and low accuracy in existing automated testing methods, which mainly target the operation of the digital currency system under different test environments and different test scenarios, and the testing of the operation results is mainly verified by manually querying the database. This achieves the technical effect of incorporating the testing of the operation results into the automated testing process, thereby improving the automation level, testing efficiency, and testing accuracy of digital currency system testing.

[0140] Figure 4 An exemplary system architecture 400 is shown, which can be used to test a digital currency system according to embodiments of the present invention or to test a digital currency system.

[0141] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, and 403, network 404, and server 405 (this architecture is merely an example; the components included in a specific architecture may be adjusted according to the specific application). Network 404 serves as the medium for providing a communication link between terminal devices 401, 402, and 403 and server 405. Network 404 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0142] Users can use terminal devices 401, 402, and 403 to interact with server 405 via network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, and 403, such as digital currency testing applications, digital currency payment applications, web browser applications, search applications, instant messaging tools, test clients, etc. (for example only).

[0143] Terminal devices 401, 402, and 403 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0144] Server 405 can be a server that provides various services, such as servers that allow users to perform tests / data processing using terminal devices 401, 402, and 403 (for example only). This server can analyze and process received data such as account test requests, and feed back the processing results (e.g., first account balance, second account balance - for example only) to the terminal device.

[0145] It should be noted that the testing method for the digital currency system provided in this embodiment of the invention is generally executed by server 405, and correspondingly, the testing device for the digital currency system is generally set in server 405.

[0146] It should be understood that Figure 4 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0147] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system 500 suitable for implementing terminal devices or servers of the present invention. Figure 5 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0148] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0149] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.

[0150] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit (CPU) 501, it performs the functions defined above in the system of this invention.

[0151] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0152] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0153] The modules described in the embodiments of the present invention can be implemented in software or hardware. The described modules can also be housed in a processor; for example, a processor can be described as including a test request receiving module, a transaction test data generation module, a query module, and a test module. The names of these modules do not necessarily limit the module itself; for example, the test request receiving module can also be described as "a module for receiving account test requests and querying the balance of a first account corresponding to the account to be tested based on the account information indicated in the account test request."

[0154] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: receiving an account test request; querying the balance of a first account corresponding to the account to be tested based on the account information indicated in the account test request; generating transaction test data based on the test environment and transaction test scenario indicated in the account test request, so as to simulate transactions using a digital currency system based on the transaction test data; wherein the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction; after the simulated transaction is completed, querying the balance of a second account corresponding to the account to be tested based on the account information; and verifying the account to be tested based on the second account balance, the first account balance, and the transaction test data, so as to achieve testing of the digital currency system.

[0155] According to the technical solution of this invention, by receiving an account test request, querying the balance of the first account corresponding to the account to be tested based on the account information indicated in the account test request, generating transaction test data based on the test environment and transaction test scenario indicated in the account test request, and using the digital currency system to conduct simulated transactions based on the transaction test data; wherein, the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test data includes the accounts of both parties to the transaction, the transaction amount, and the transaction direction; after the simulated transaction is completed, querying the balance of the second account corresponding to the account to be tested based on the account information; and verifying the account to be tested based on the second account balance, the first account balance, and the transaction test data, the technical means of testing the digital currency system are achieved. Therefore, this overcomes the technical problems of low automation, low efficiency, and low accuracy in existing automated testing methods, which mainly target the operation of the digital currency system under different test environments and different test scenarios, and the testing of the operation results is mainly verified by manually querying the database. This achieves the technical effect of incorporating the testing of the operation results into the automated testing process, thereby improving the automation level, testing efficiency, and testing accuracy of digital currency system testing.

[0156] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A testing method for a digital currency system, characterized in that, include: Set script variables based on the test environment, transaction test scenario, account information, and transaction test data; Receive an account test request initiated by a user based on the script variable, and query the balance of the first account corresponding to the account to be tested based on the account information indicated by the account test request; Based on the test environment and transaction test scenario indicated by the account test request, transaction test data is generated to simulate transactions using the digital currency system. The test environment includes multiple test versions and corresponds to one or more transaction test scenarios. The transaction test scenarios include: deposit transaction scenarios, transfer transaction scenarios, and reversal transaction scenarios. The transaction test data includes the accounts of both parties, the transaction amount, and the transaction direction. After the simulated transaction is completed, the balance of the second account corresponding to the test account is queried based on the account information; The account to be tested is verified based on the balance of the second account, the balance of the first account, and the transaction test data, so as to test the digital currency system. It also includes: receiving one or more update information from test environment update information, transaction test scenario update information, and business attribute update information; and updating the script variables according to the update information. The method further includes: enabling the automated testing framework script to connect to and access the database through keywords in the database plugin of the automated testing framework, and realizing automated testing of the digital currency system under different testing environments and different testing trading scenarios by setting test variables and test transaction scenarios in the automated testing framework script.

2. The testing method for the digital currency system according to claim 1, characterized in that, The step of verifying the account to be tested based on the balance of the second account, the balance of the first account, and the transaction test data includes: Based on the balance of the first account and the transaction amount, transaction direction, and accounts of both parties indicated in the transaction test data, determine the expected balance corresponding to the account to be tested; The test account is tested by verifying whether the expected balance and the balance of the second account are consistent.

3. The testing method for the digital currency system according to claim 1, characterized in that, The transaction test data also indicates the transaction type and the correspondence between the transaction type and the number of accounting entries generated; If the account test request also indicates accounting entry test information; the method further includes: Based on the transaction type indicated by the transaction test data and the correspondence between the transaction type and the number of accounting entries generated, determine the expected value of the number of accounting entries corresponding to the account to be tested; After the simulated transaction is completed, query the actual number of accounting entries corresponding to the account to be tested. The accounting entry quantity of the account to be tested is tested by verifying whether the actual value of the accounting entry quantity is consistent with the expected value of the accounting entry quantity.

4. The testing method for the digital currency system according to claim 3, characterized in that, The accounting entry includes multiple accounting entries, and if the account test request also indicates accounting entry test information; the method further includes: Based on the accounting subject to be tested indicated by the accounting subject test information and the account information, after the simulated transaction is successful, the target accounting subject information corresponding to the account to be tested is queried to verify the target accounting subject information based on the transaction test data.

5. The testing method for a digital currency system according to claim 1, characterized in that, If the simulated transaction fails, the method further includes: The simulated transaction is terminated, and a transaction failure message is returned.

6. A testing device for a digital currency system, characterized in that, include: The script variable setting module is used to set script variables based on the test environment, transaction test scenario, account information, and transaction test data. The test request receiving module is used to receive the account test request initiated by the user based on the script variable, and query the balance of the first account corresponding to the account to be tested based on the account information indicated by the account test request. The transaction test data generation module generates transaction test data based on the test environment and transaction test scenario indicated by the account test request, so as to conduct simulated transactions using the digital currency system based on the transaction test data; wherein, the test environment includes multiple test versions, and the test environment corresponds to one or more transaction test scenarios; the transaction test scenarios include: deposit transaction scenario, transfer transaction scenario, and reversal transaction scenario; the transaction test data includes the accounts of the two parties to the transaction, the transaction amount, and the transaction direction; The query module is used to query the balance of the second account corresponding to the test account based on the account information after the simulated transaction is completed. The testing module is used to verify the account to be tested based on the balance of the second account, the balance of the first account, and the transaction test data, so as to test the digital currency system. The script variable update module is used to receive one or more update information from test environment update information, transaction test scenario update information, and business attribute update information; and update the script variables according to the update information. The device is also used to enable the automated testing framework script to connect to and access the database through the keywords of the database plugin in the automated testing framework, and to achieve automated testing of the digital currency system under different testing environments and different testing trading scenarios by setting test variables and test transaction scenarios in the automated testing framework script.

7. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.

8. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.