Search

CN-116185806-B - Digital currency system testing method and device

CN116185806BCN 116185806 BCN116185806 BCN 116185806BCN-116185806-B

Abstract

The invention discloses a method and a device for testing a digital currency system, and relates to the technical field of computers. The method comprises the steps of receiving an account test request, inquiring a first account balance corresponding to an account to be tested according to account information indicated by the account test request, generating transaction test data according to a test environment and a transaction test scene indicated by the account test request so as to utilize a digital currency system to simulate transaction according to the transaction test data, inquiring a second account balance corresponding to the account to be tested according to the account information after the simulation transaction is completed, and checking the account to be tested according to the second account balance, the first account balance and the transaction test data so as to realize the test of the digital currency system. The embodiment improves the automation degree of the digital currency system test and improves the test efficiency and the test accuracy.

Inventors

  • WANG SHUAI

Assignees

  • 中国人民银行数字货币研究所
  • 中国银行股份有限公司

Dates

Publication Date
20260512
Application Date
20211126

Claims (8)

  1. 1. A method of testing a digital money system, comprising: setting script variables according to the test environment, the transaction test scene, account information and transaction test data; Receiving an account test request initiated by a user according to the script variable, and inquiring a first account balance corresponding to an account to be tested according to account information indicated by the account test request; Generating transaction test data according to a test environment and a transaction test scene indicated by the account test request, so as to simulate transaction according to the transaction test data by utilizing the digital currency system, wherein the test environment comprises a plurality of test versions, and the test environment corresponds to one or more transaction test scenes; After the simulated transaction is completed, inquiring a second account balance corresponding to the account to be tested according to the account information; Checking the account to be tested according to the second account balance, the first account balance and the transaction test data so as to realize the test of the digital currency system; the method also comprises the steps of receiving one or more of test environment update information, transaction test scene update information and business attribute update information, and updating the script variable according to the update information; The method further comprises the steps of realizing connection and access of the automated test framework script to the database through keywords of the database plug-in the automated test framework, and realizing automated test of the digital currency system under different test environments and different test transaction scenes by setting test variables and test transaction scenes of the automated test framework script.
  2. 2. The method of claim 1, wherein the checking the account to be tested based on the second account balance, the first account balance, and the transaction test data comprises: Determining the expected balance corresponding to the account to be tested according to the first account balance, the transaction amount indicated in the transaction test data, the transaction direction and the accounts of both transaction parties; And checking whether the expected balance is consistent with the second account balance or not so as to realize the test of the account to be tested.
  3. 3. The method of claim 1, wherein the transaction test data further indicates a transaction type and a correspondence between the transaction type and a number of accounting records generated, wherein if the account test request further indicates accounting record test information, the method further comprises: Determining an expected value of the accounting entry number corresponding to the account to be tested according to the transaction type indicated by the transaction test data and the corresponding relation between the transaction type and the generated accounting entry number; after the simulated transaction is completed, inquiring the actual value of the accounting entry quantity corresponding to the account to be tested; And checking whether the actual value of the accounting entry number is consistent with the expected value of the accounting entry number or not so as to test the accounting entry number of the account to be tested.
  4. 4. The method of claim 3, wherein the accounting entry includes a plurality of accounting subjects, and wherein if the account test request further indicates accounting subject test information, the method further comprises: And inquiring target accounting subject information to be tested corresponding to the account to be tested according to the accounting subject information to be tested indicated by the accounting subject test information and the account information after the simulation transaction is successful, so as to check the target accounting subject information to be tested according to the transaction test data.
  5. 5. The method of claim 1, wherein if the result of the simulated transaction is a failure, the method further comprises: And stopping the simulated transaction and feeding back transaction failure information.
  6. 6. A test device for a digital money system, comprising: The script variable setting module is used for setting script variables according to the test environment, the transaction test scene, account information and transaction test data; the test request receiving module is used for receiving an account test request initiated by a user according to the script variable and inquiring a first account balance corresponding to an account to be tested according to account information indicated by the account test request; The transaction test data generation module is used for generating transaction test data according to a test environment and a transaction test scene indicated by the account test request so as to simulate transaction according to the transaction test data by utilizing the digital currency system, wherein the test environment comprises a plurality of test versions and corresponds to one or more transaction test scenes; the inquiring module is used for inquiring the balance of the second account corresponding to the account to be tested according to the account information after the simulated transaction is completed; the test module is used for checking the account to be tested according to the second account balance, the first account balance and the transaction test data so as to realize the test of the digital currency system; The script variable updating module is used for receiving one or more of test environment updating information, transaction test scene updating information and business attribute updating information; The device is also used for realizing the connection and access of the automatic test framework script to the database through the keywords of the database plug-in the automatic test framework, and realizing the automatic test of the digital currency system under different test environments and different test transaction scenes by setting the test variables and the test transaction scenes of the automatic test framework script.
  7. 7. An electronic device, comprising: one or more processors; storage means for storing one or more programs, When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-5.
  8. 8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.

Description

Digital currency system testing method and device Technical Field The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for testing a digital currency system. Background In the development and testing process of the digital currency system, with the increase of system version and application scene, higher requirements are put on test period compression and test quality improvement. The automatic test of the current digital currency system mainly aims at transaction messages, and the transaction state and the result are reflected through the feedback result of the transaction messages. Namely, the existing automatic testing method of the digital currency system mainly considers whether the digital currency system can normally operate or not, and then the testing result is checked by manually inquiring a database after the transaction message is fed back. The prior art has at least the following problems: The existing automatic test method mainly aims at the operation conditions of the digital currency system under different test environments and different test scenes, and the test of the operation results is mainly checked by manually inquiring a database, and the automatic test method does not bring the test of the operation results into the automatic test category, so that the technical problems of low automation degree, low test efficiency and low test accuracy of the digital currency system test are solved. Disclosure of Invention In view of the above, the embodiment of the invention provides a testing method and a device for a digital currency system, which can bring the test of an operation result into an automatic testing process, improve the automation degree of the test of the digital currency system, and improve the testing efficiency and the testing accuracy. To achieve the above object, according to a first aspect of the embodiments of the present invention, there is provided a testing method of a digital money system, including: receiving an account test request, and inquiring a first account balance corresponding to an account to be tested according to account information indicated by the account test request; generating transaction test data according to a test environment and a transaction test scene indicated by an account test request, so as to simulate transaction according to the transaction test data by utilizing a digital currency system, wherein the test environment comprises a plurality of test versions, and the test environment corresponds to one or more transaction test scenes; after the simulated transaction is completed, inquiring a second account balance corresponding to the account to be tested according to the account information; And checking the account to be tested according to the second account balance, the first account balance and the transaction test data so as to realize the test of the digital currency system. Further, according to the second account balance, the first account balance and the transaction test data, checking the account to be tested comprises: Determining the expected balance corresponding to the account to be tested according to the first account balance, the transaction amount indicated in the transaction test data, the transaction direction and the accounts of both transaction parties; And checking whether the expected balance is consistent with the balance of the second account so as to realize the test of the account to be tested. Further, the transaction test data further indicates a transaction type and a corresponding relation between the transaction type and the generated accounting entry number, and if the account test request further indicates accounting entry test information, the method further includes: According to the transaction type indicated by the transaction test data and the corresponding relation between the transaction type and the generated accounting entry quantity, determining an accounting entry quantity expected value corresponding to the account to be tested; after the simulation transaction is completed, inquiring the actual value of the accounting entry quantity corresponding to the account to be tested; And checking whether the actual value of the accounting entry number is consistent with the expected value of the accounting entry number or not so as to test the accounting entry number of the account to be tested. Further, the accounting entry includes a plurality of accounting subjects, and if the account test request further indicates the accounting subject test information, the method further includes: According to the accounting subjects to be tested and account information indicated by the accounting subject test information, after the simulation transaction is successful, inquiring target accounting subject information to be tested corresponding to the account to be tested, so as to check the target accounting subject information to be tested accordin