CN110162470B - Block chain testing method and device - Google Patents

Block chain testing method and device Download PDF

Info

Publication number
CN110162470B
CN110162470B CN201910348191.3A CN201910348191A CN110162470B CN 110162470 B CN110162470 B CN 110162470B CN 201910348191 A CN201910348191 A CN 201910348191A CN 110162470 B CN110162470 B CN 110162470B
Authority
CN
China
Prior art keywords
transaction
blockchain
tested
test
account
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910348191.3A
Other languages
Chinese (zh)
Other versions
CN110162470A (en
Inventor
马玉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Advanced New Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Advanced New Technologies Co Ltd filed Critical Advanced New Technologies Co Ltd
Priority to CN201910348191.3A priority Critical patent/CN110162470B/en
Publication of CN110162470A publication Critical patent/CN110162470A/en
Application granted granted Critical
Publication of CN110162470B publication Critical patent/CN110162470B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

One or more embodiments of the present specification provide a blockchain testing method, apparatus, computer device, and computer-readable storage medium, applied to change testing of existing code corresponding to an existing blockchain network; the method comprises the following steps: the testing equipment responds to a preset testing trigger event to obtain an object code to be tested; constructing node equipment of a blockchain network to be tested based on the object code to be tested and the existing code of the existing blockchain; transmitting a test case transaction to the blockchain to be tested; and acquiring an execution result of the test case transaction in the blockchain to be tested.

Description

Block chain testing method and device
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method and apparatus for testing a blockchain.
Background
Blockchain technology, also known as distributed ledger technology, is an emerging technology that is commonly engaged in "accounting" by several computing devices, together maintaining a complete distributed database. The blockchain technology has the characteristics of decentralization, disclosure transparency, capability of participating in database recording by each computing device and capability of rapidly performing data synchronization among the computing devices, so that the blockchain technology is widely applied in a plurality of fields.
Disclosure of Invention
In view of this, one or more embodiments of the present description provide a blockchain testing method, apparatus, computer device, and computer-readable storage medium.
In order to achieve the above object, one or more embodiments of the present disclosure provide a blockchain testing method, which is applied to change testing of existing codes corresponding to an existing blockchain network; the method comprises the following steps:
the testing equipment responds to a preset testing trigger event to obtain an object code to be tested;
constructing node equipment of a blockchain network to be tested based on the object code to be tested and the existing code of the existing blockchain;
transmitting a test case transaction to the blockchain to be tested;
and acquiring an execution result of the test case transaction in the blockchain to be tested.
In a further illustrated embodiment, the method further comprises:
the node equipment of the block chain to be tested sends a data preparation standby case transaction to the block chain to be tested;
and acquiring an execution result of the data preparation case transaction in the blockchain to be tested, and sending a test case transaction to the blockchain to be tested when the execution result of the data preparation case transaction is successful.
In yet another illustrated embodiment, the data preparation instance transaction includes: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
In yet another illustrated embodiment, the test case transaction includes: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
In a further illustrated embodiment, the method further comprises:
and acquiring a private key corresponding to the administrator account of the blockchain to be detected.
In yet another illustrated embodiment, the creation block of the blockchain under test includes preparation data required to perform the test case transaction.
In a further illustrated embodiment, the provisioning data includes: and one or more of a private key corresponding to an administrator account of the blockchain to be tested, a test user account, or a preset intelligent contract code.
In yet another illustrated embodiment, the preset test trigger event includes: triggering every preset time period or triggering by preset calling events.
Correspondingly, the specification also provides a testing device of the blockchain, which is applied to change testing of the existing codes corresponding to the existing blockchain network; the device is applied to test equipment and comprises:
the acquisition unit is used for responding to a preset test trigger event and acquiring an object code to be tested;
the construction unit is used for constructing node equipment of the blockchain network to be tested based on the target code to be tested and the existing code of the existing blockchain;
the sending unit is used for sending the test case transaction to the block chain to be tested;
the obtaining unit is further configured to obtain an execution result of the test case transaction in the blockchain to be tested.
In a further illustrated embodiment, the apparatus:
the sending unit is further used for sending data preparation case transaction to the blockchain to be tested;
the acquisition unit is further used for acquiring an execution result of the data preparation case transaction in the blockchain to be tested;
the device also comprises a judging unit for judging whether the execution result of the data preparation standby example transaction is successful or not.
In yet another illustrated embodiment, the data preparation instance transaction includes: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
In yet another illustrated embodiment, the test case transaction includes: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
In a further illustrated embodiment, the acquisition unit is further configured to:
and acquiring a private key corresponding to the administrator account of the blockchain to be detected.
In yet another illustrated embodiment, the creation block of the blockchain under test includes preparation data required to perform the test case transaction.
In a further illustrated embodiment, the provisioning data includes: and one or more of a private key corresponding to an administrator account of the blockchain to be tested, a test user account, or a preset intelligent contract code.
In yet another illustrated embodiment, the preset test trigger event includes: triggering every preset time period or triggering by preset calling events.
Accordingly, the present specification also provides a computer apparatus comprising: a memory and a processor; the memory has stored thereon a computer program executable by the processor; and when the processor runs the computer program, executing the block chain testing method executed by the testing equipment.
Accordingly, the present specification also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of testing a blockchain executed by the testing device described above.
According to the technical scheme, the method, the device, the computer equipment and the computer readable storage medium for testing the blockchain are provided, the blockchain to be tested is constructed based on the target code to be tested and the original code of the existing blockchain, execution (such as release and recording) of the test case transaction is actually executed on the blockchain to be tested, and the test result of the target code is obtained based on the execution result of the test case transaction on the blockchain to be tested.
Drawings
FIG. 1 is a flow chart of a block chain testing method according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a block chain testing apparatus for testing equipment according to an embodiment of the present disclosure;
FIG. 3 is a hardware architecture diagram of an embodiment of a testing device for running a blockchain as provided herein.
Description of the embodiments
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with aspects of one or more embodiments of the present description as detailed in the accompanying claims.
It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than described in this specification. Furthermore, individual steps described in this specification, in other embodiments, may be described as being split into multiple steps; while various steps described in this specification may be combined into a single step in other embodiments.
In the development process of the project, as the functions of the system are continuously increased, the code quantity is more and more huge, whether the influence of the daily code change on the original functions is more and more difficult to evaluate, and the quality of the system is determined by total functional regression after each code change is combined; the continuous test of the traditional system can finish the preparation, modification and elimination of test data through the operation of the script on the database, the data is injected into the database before the test, and the data generated by the test of the round is eliminated from the database after the test, so that the test data of each round are mutually independent, and therefore, the operation can be repeated indefinitely. The code modification of the blockchain platform must be verified through the deployment node, and the blockchain is characterized by a distributed ledger which is not tamperable and counterfeit, and the traditional continuous test mode by changing data does not support the scene of the blockchain.
To solve the above-mentioned problems, one or more embodiments of the present disclosure provide a blockchain testing method applied to change testing of existing codes corresponding to an existing blockchain network. The existing code corresponding to the existing blockchain network includes code for constructing the existing blockchain network or various items running on the existing blockchain network; the change test of the existing code includes a test of changing an existing code such as adding or deleting or changing (e.g., version upgrade).
The blockchain network in one or more embodiments of the present disclosure may specifically refer to a P2P network system with a distributed data storage structure achieved by each node device through a common mechanism, where data in the blockchain is distributed in blocks (blocks) that are temporally connected, and the later blocks include data digests of the previous blocks, and complete data backup of all or part of the nodes is achieved according to the specific common mechanism (such as POW, POS, DPOS or PBFT). Those skilled in the art are familiar with that, since the blockchain network system operates under the corresponding consensus mechanism, the data recorded in the blockchain database is difficult to be tampered by any node, for example, the blockchain adopting Pow consensus, and at least the attack of 51% computing power of the whole network is needed to tamper with the existing data, so that the blockchain system has the characteristics of ensuring the security and preventing the attack and tampering of the data which are incomparable with other centralized database systems. Therefore, the data recorded in the distributed database of the blockchain cannot be attacked or tampered, so that the true reliability of the data information stored in the distributed database of the blockchain is ensured.
Example types of blockchain networks may include public blockchain networks, private blockchain networks, and federated blockchain networks. The common blockchain network is open to use the P2P network and all entities participating in the consensus process. The private blockchain network provides for specific entities that centrally control read and write rights. The federated blockchain network provides to a selected group of entities (the selected group of entities controlling the consensus process) and includes an access control layer. Embodiments of the present description may be implemented in any suitable type of blockchain network.
As shown in fig. 1, a method for testing a blockchain provided in one or more embodiments of the present disclosure includes:
step 102, the test equipment responds to a preset test trigger event to obtain the target code to be tested.
The present disclosure is not limited to the type of scenario in which the above-described test method is applied, and the test method provided in the above-described embodiments of the present disclosure may be performed in a continuous integrated test scenario, for example. Those skilled in the art should appreciate that code modification of a blockchain network or platform must be verified by deploying nodes, and the deployment of the nodes and the overall regression of the functions are massive and repetitive tasks, so that development efficiency needs to be improved by a continuous integration mode, repeated labor is liberated, testing can be entered earlier, integrated problems can be found as soon as possible, cost for solving the problems is reduced, and quality is continuously evaluated.
Thus, in one or more embodiments provided herein, the predetermined test trigger event may include triggering every predetermined period of time, or triggering by a predetermined call event (e.g., an event such as pushing a new code branch in test software), as a trigger for an automated test. In continuous integration testing, feedback of code quality through automated testing is an important ring in evaluating system quality in continuous integration. Of course, the preset test triggering event may also include a non-automatic triggering instruction input by a person or by another program, which is not limited in this specification.
In one or more embodiments provided herein, the blockchain testing methods described in the various embodiments can be configured using common continuous integration tools, such as TeamCity, jenkins, etc.
The object code to be tested comprises newly added code loaded on a blockchain platform, or updated code of the existing code, and the like, which are edited by a developer of the blockchain network.
Step 104, constructing a blockchain network to be tested based on the target code to be tested and the existing code of the existing blockchain, wherein the testing equipment is node equipment of the blockchain network to be tested.
The test equipment compiles and deploys source codes by executing a construction script based on the target codes and the existing codes, and generates an executable file; and running the executable file to enable the test equipment to become node equipment of the block chain network to be tested. The blockchain under test is generated by performing the above-described process (i.e., deploying as nodes of the blockchain under test) on a plurality of device terminals, including the testing devices described in the above embodiments. Those skilled in the art generally refer to node devices having a full backup of data of a blockchain distributed database as full nodes, node devices having a partial backup of data of a blockchain distributed database (e.g., data having only a block header) as light nodes, and the like. In one or more embodiments of the present disclosure, a test device for executing a test action is used as a node device of a blockchain to be tested, and is not limited to a node type to which the test device belongs, and a tester may construct a node type for deploying the test node device according to specific test requirements.
Step 112, sending a test case transaction to the blockchain to be tested.
Transactions (transactions) described in one or more embodiments herein refer to a piece of data created by a node device of a blockchain and that needs to be eventually published into a distributed database of the blockchain. Among the transactions in the blockchain are narrow transactions and broad transactions. A narrow transaction refers to a transfer of value issued by a user to a blockchain; for example, in a conventional blockchain network, the transaction may be a transfer initiated by the user in the blockchain. And a generalized transaction refers to a piece of business data with business intent that a user entity publishes to a blockchain through a node.
The test case transaction in this embodiment is service data for testing whether an existing function of an existing blockchain can be normally implemented in a blockchain to be tested or whether a new function related to a target code can be normally implemented in the blockchain to be tested, and the like, and may include direct test data for testing whether the function can be normally implemented, and also may include basic preparation data for testing whether the function can be normally implemented; the specific expression forms of the method can comprise one or more of account creation transaction, account freezing transaction, account transfer transaction, deposit transaction, intelligent contract deployment transaction, or intelligent contract calling transaction of the blockchain to be tested.
To further provide context for embodiments of the present specification, in a blockchain network, applications may be developed, tested, and deployed for execution within the blockchain network. Example applications may include, but are not limited to, smart contracts. An intelligent contract may be described as a digital representation of a legal contract having the real world affecting contract terms of parties. The smart contracts are implemented, stored, updated (as needed), and executed within the blockchain network. Contractors (e.g., buyers and sellers) associated with the smart contract are represented as nodes in a blockchain network.
In some examples, the smart contract may store data that may be used to record information, facts, associations, balances, and any other information needed to implement the contract execution logic. A smart contract may be described as a computer-executable program that consists of functions that may be created as instances (instances) of the smart contract, invoking functions to execute the logic of the smart contract.
In a technical aspect, a smart contract may be implemented based on objects and object-oriented classes. For example, the terms and components of a smart contract may be represented as objects that are processed by an application implementing the smart contract. A smart contract (or an object in a smart contract) may invoke another smart contract (or an object in the same smart contract) like other object-oriented objects. For example, a call made by an object may be a call to create, update, delete, propagate, or communicate with an object of another class. Calls between objects may be implemented by functions, methods, application programming interfaces (application programming interface, APIs), or other calling mechanisms. For example, a first object may call a function to create a second object.
It can be seen that the account creation transaction, the account freezing transaction, the account transferring transaction, the account freezing transaction, the intelligent contract deployment transaction, the intelligent contract calling transaction, the account creation transaction, the account freezing transaction, the evidence-preserving transaction, which are used for realizing the evidence function, are all included in the content category of the test case transaction.
In yet another embodiment, when execution of the test case transaction (the execution of the test case transaction may include the common identification verification of the test case transaction by (a node device of) a blockchain under test, or the execution of a predetermined logic by an intelligent contract called by the test case transaction, etc.) requires some preparation data to be completed, the blockchain test method provided in this embodiment further includes:
step 108, the node equipment of the blockchain to be tested sends a data preparation case transaction to the blockchain to be tested;
step 110, obtaining an execution result of the data preparation case transaction in the blockchain to be tested, so as to send a test case transaction to the blockchain to be tested when the execution result of the data preparation case transaction is successful.
For example, when the test case transaction is a transfer transaction, in order to complete the consensus verification of the transfer transaction, the sender and the receiver user accounts involved in the transfer transaction need to be set in advance in the blockchain to be tested, and virtual resources enough to complete the transfer transaction need to be obtained in the sender account, so that the creation transaction of the sender and the receiver user accounts, the transfer transaction enough to pay for the transfer transaction, or the transaction enough to complete the virtual resources of the transfer transaction can be obtained in other ways based on the consensus rule of the blockchain to be tested, and the like belong to the data preparation case transaction needed by the execution of the transfer transaction.
For example, when the test case transaction is a call transaction of an intelligent contract, in order to complete the call of the intelligent contract and the execution of the corresponding logic declared by the intelligent contract, the intelligent contract needs to be deployed in advance on the blockchain to be tested, and the corresponding logic (or function) needs to be declared in the intelligent contract, so that the deployment transaction of the intelligent contract containing the corresponding logic (or function) should belong to the data preparation case transaction required by the execution of the intelligent contract call transaction.
Optionally, the data preparation case transaction may further include other transaction types such as a call transaction of an intelligent contract to prepare data or logic for execution of the test case transaction. The present description is not limited with respect to the type or content of the data preparation case transaction described above, which may include, for example: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction. Based on the actual service scene requirement, a person skilled in the art can set various different types and kinds of data preparation case transactions for the execution of the test case transactions, so that the data required by the execution of the test case transactions are prepared in the blockchain to be tested based on the common identification verification of each node device of the blockchain to be tested.
Similarly, the execution of the data preparation transaction according to the above embodiment may include the common verification of the data preparation transaction by (the node device of) the blockchain to be tested, or the execution of a predetermined logic by the smart contract called by the data preparation transaction, etc.; accordingly, the execution result of the data preparation transaction is that the data preparation transaction is successfully included in the distributed database of the blockchain to be tested, or the intelligent contract called by the data preparation transaction is successfully executed with preset logic, and the like. If the execution result of the data preparation case transaction is unsuccessful, such as that the data preparation case transaction is not recorded in the distributed database of the blockchain to be tested, or that the intelligent contract called by the data preparation case transaction fails to execute preset logic, the test case transaction cannot be executed successfully, and at this time, the test can be stopped directly; and when the execution result of the data preparation case transaction is successful, sending a test case transaction to the blockchain.
In this embodiment, the execution of a test is divided into two phases, a preparation phase and an execution phase, according to the characteristic that the blockchain data is not tamperable; the preparation stage is used for feeding the needed test data into the chain in advance by sending a data preparation standby case transaction, so that preparation is made for the execution stage of all subsequent test scenes; the data preparation method through the actual transaction achieves the aim of data preparation, and avoids the problem that the data prepared through the database method in the past has deviation with the data generated by the actual business; and the data preparation is separated from the test execution, the test result can reflect the execution condition of each stage exactly, and the problem positioning is more direct.
Notably, blockchains have a small portion of transactions that require administrator account transmission, such as some user account creation transactions, or user account freeze transactions, or call transactions of smart contracts that require authentication, etc.; to execute the portion of the transaction (including the test case transaction or the data preparation case transaction), the testing device needs to obtain the private key corresponding to the administrator account of the blockchain to be tested, so in still another illustrated embodiment, as shown in fig. 1, the testing method of the blockchain may further include:
step 106, obtaining the private key corresponding to the administrator account of the blockchain to be detected.
In embodiments including steps 108-110 or steps 106-110, data preparation is performed for execution of the test case transaction by sending a data preparation case transaction; in yet another illustrated embodiment, the process of data preparation may also be set in the content of the created block of the blockchain under test. Those skilled in the art will appreciate that the blockchain generation may be preceded by an creation configuration generation. Json by locating the data contained in the desired creation block within this file, which is written directly into the blockchain distributed database at the time of blockchain generation. Therefore, in the blockchain testing method provided in this embodiment, the generated block of the blockchain to be tested may include preparation data required for executing the above-mentioned test case transaction, such as one or more of a private key corresponding to an administrator account of the blockchain to be tested, an account for testing, or an intelligent contract.
Compared with the data preparation of the test case transaction in the generation block of the blockchain to be tested, the data preparation is realized based on the implementation mode comprising the steps 108-110 or the steps 106-110, the generated blockchain to be tested is lighter and purer, and the data preparation case transaction can be gradually configured according to the development practice of the blockchain, so that the method has better test flexibility.
Step 114, obtaining an execution result of the test case transaction in the blockchain to be tested.
As described above, the execution of the test case transaction may include the test case transaction being identified by (node devices of) the blockchain under test, or the smart contract called by the test case transaction executing a preset logic, etc.; accordingly, the execution result of the test case transaction in the blockchain to be tested may include whether the test case transaction is commonly verified by (node equipment of) the blockchain to be tested and recorded in a distributed database of the blockchain, whether an intelligent contract called by the test case transaction completes a preset logic execution, and the like. Based on the execution result of the test case transaction, a development tester can obtain the test result of the target code.
Corresponding to the above-described flow implementation, the embodiment of the present disclosure further provides a blockchain testing device 20. The apparatus 20 may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions into a memory through a CPU (Central Process Unit, central processing unit) of the device. In terms of hardware, in addition to the CPU, the memory, and the storage shown in fig. 3, the device in which the test apparatus is located generally includes other hardware such as a chip for performing wireless signal transmission and reception, and/or other hardware such as a board card for implementing a network communication function.
As shown in fig. 2, the present disclosure further provides a blockchain testing device 20, which is applied to change testing on an existing code corresponding to an existing blockchain network; the device is applied to test equipment and comprises:
an obtaining unit 202, configured to obtain an object code to be tested in response to a preset test trigger event;
a construction unit 204, configured to construct a node device of the blockchain network to be tested based on the object code to be tested and the existing code of the existing blockchain;
a sending unit 206, configured to send a test case transaction to the blockchain to be tested;
the obtaining unit 202 is further configured to obtain a test result of the object code based on an execution result of the test case transaction in the blockchain under test.
In yet another illustrated embodiment, the sending unit 206 is further configured to send a data preparation case transaction to the blockchain under test;
the acquiring unit 202 is further configured to acquire an execution result of the data preparation case transaction in the blockchain to be tested;
the apparatus 20 further comprises a determining unit 208 for determining whether the execution result of the data preparation use case transaction is successful.
In yet another illustrated embodiment, the data preparation instance transaction includes: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
In yet another illustrated embodiment, the test case transaction includes: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
In a further illustrated embodiment, the acquisition unit 202 is further configured to:
and acquiring a private key corresponding to the administrator account of the blockchain to be detected.
In yet another illustrated embodiment, the creation block of the blockchain under test includes preparation data required to perform the test case transaction.
In a further illustrated embodiment, the provisioning data includes: and one or more of a private key corresponding to an administrator account of the blockchain to be tested, a test user account, or an intelligent contract code.
In yet another illustrated embodiment, the preset test trigger event includes: triggering every preset time period or triggering by preset calling events.
The implementation process of the functions and roles of each unit in the apparatus 20 is specifically shown in the implementation process of the corresponding steps in the blockchain testing method executed by the testing device, and the relevant points only need to be referred to in the part of the description of the method embodiment, and are not repeated here.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the units or modules may be selected according to actual needs to achieve the purposes of the present description. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The apparatus, units, modules illustrated in the above embodiments may be implemented in particular by a computer chip or entity or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
Corresponding to the above method embodiments, embodiments of the present disclosure also provide a computer device, as shown in fig. 3, which includes a memory and a processor. Wherein the memory has stored thereon a computer program executable by the processor; the processor, when executing the stored computer program, performs the steps of the blockchain testing method performed by the testing device in the embodiments of the present disclosure. For a detailed description of the steps of the blockchain testing method performed by the testing device, please refer to the foregoing, and the description will not be repeated.
Corresponding to the above method embodiments, embodiments of the present description also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the blockchain testing method performed by the testing device in the embodiments of the present description. For a detailed description of the steps of the blockchain testing method performed by the testing device, please refer to the foregoing, and the description will not be repeated.
The foregoing description of the preferred embodiments is provided for the purpose of illustration only, and is not intended to limit the scope of the disclosure, since any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the disclosure are intended to be included within the scope of the disclosure.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data.
Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, embodiments of the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, embodiments of the present description may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

Claims (18)

1. A testing method of block chain is applied to change testing of existing codes corresponding to the existing block chain network; the method comprises the following steps:
the testing equipment responds to a preset testing trigger event to obtain an object code to be tested;
generating an executable file based on the target code to be tested and the existing code of the existing blockchain, and running the executable file to enable the test equipment to be node equipment of the blockchain network to be tested; transmitting a test case transaction to the blockchain to be tested;
and acquiring an execution result of the test case transaction in the blockchain to be tested.
2. The method of claim 1, further comprising:
the node equipment of the block chain to be tested sends a data preparation standby case transaction to the block chain to be tested;
and acquiring an execution result of the data preparation case transaction in the blockchain to be tested, and sending a test case transaction to the blockchain to be tested when the execution result of the data preparation case transaction is successful.
3. The method of claim 2, the data preparation case transaction comprising: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
4. The method of claim 1 or 2, the test case transaction comprising: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
5. The method of claim 1 or 2, further comprising:
and acquiring a private key corresponding to the administrator account of the blockchain to be detected.
6. The method of claim 1, wherein the creation block of the blockchain under test includes preparation data required to perform the test case transaction.
7. The method of claim 6, the preparing data comprising: and one or more of a private key corresponding to an administrator account of the blockchain to be tested, a test user account, or an intelligent contract code.
8. The method of claim 1 or 2 or 6, the preset test trigger event comprising: triggering every preset time period or triggering by preset calling events.
9. A testing device of a block chain is applied to change testing of an existing code corresponding to an existing block chain network; the device is applied to test equipment and comprises:
the acquisition unit is used for responding to a preset test trigger event and acquiring an object code to be tested;
the construction unit is used for generating an executable file based on the target code to be tested and the existing code of the existing blockchain and running the executable file so that the test equipment becomes node equipment of the blockchain network to be tested;
the sending unit is used for sending the test case transaction to the block chain to be tested;
the obtaining unit is further configured to obtain an execution result of the test case transaction in the blockchain to be tested.
10. The apparatus of claim 9:
the sending unit is further used for sending data preparation case transaction to the blockchain to be tested;
the acquisition unit is further used for acquiring an execution result of the data preparation case transaction in the blockchain to be tested;
the device also comprises a judging unit for judging whether the execution result of the data preparation standby example transaction is successful or not.
11. The apparatus of claim 10, the data preparation case transaction comprising: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
12. The apparatus of claim 9 or 10, the test case transaction comprising: one or more of an account creation transaction, or an account freeze transaction, or a transfer transaction, or a credit transaction, or a smart contract deployment transaction, or a smart contract invocation transaction.
13. The apparatus according to claim 9 or 10, the acquisition unit further being configured to:
and acquiring a private key corresponding to the administrator account of the blockchain to be detected.
14. The apparatus of claim 9, the creation block of the blockchain under test including preparation data required to perform the test case transaction.
15. The apparatus of claim 14, the provisioning data comprising: and one or more of a private key corresponding to an administrator account of the blockchain to be tested, a test user account, or an intelligent contract code.
16. The apparatus of claim 9 or 10 or 14, the preset test triggering event comprising: triggering every preset time period or triggering by preset calling events.
17. A computer device, comprising: a memory and a processor; the memory has stored thereon a computer program executable by the processor; the processor, when running the computer program, performs the method of any one of claims 1 to 8.
18. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of claims 1 to 8.
CN201910348191.3A 2019-04-28 2019-04-28 Block chain testing method and device Active CN110162470B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910348191.3A CN110162470B (en) 2019-04-28 2019-04-28 Block chain testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910348191.3A CN110162470B (en) 2019-04-28 2019-04-28 Block chain testing method and device

Publications (2)

Publication Number Publication Date
CN110162470A CN110162470A (en) 2019-08-23
CN110162470B true CN110162470B (en) 2023-08-18

Family

ID=67640233

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910348191.3A Active CN110162470B (en) 2019-04-28 2019-04-28 Block chain testing method and device

Country Status (1)

Country Link
CN (1) CN110162470B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110598446A (en) * 2019-09-16 2019-12-20 腾讯科技(深圳)有限公司 Block chain based test method and device, storage medium and computer equipment
CN111782502A (en) * 2019-12-13 2020-10-16 北京沃东天骏信息技术有限公司 Automatic testing method and device
CN111369359B (en) * 2020-02-10 2022-02-22 中科驭数(北京)科技有限公司 Method and device for testing security transaction risk control hardware
CN111444090A (en) * 2020-03-24 2020-07-24 腾讯科技(深圳)有限公司 Contract testing method and device in block chain, electronic equipment and storage medium
CN111447112B (en) * 2020-03-25 2021-11-26 中国银行股份有限公司 Block chain network monitoring system, device and method
CN111638998A (en) * 2020-05-29 2020-09-08 宝鸡文理学院 Block chain evaluation system
CN111475501B (en) * 2020-06-24 2020-10-30 支付宝(杭州)信息技术有限公司 Data cleaning method and device for block chain network
CN111917729B (en) * 2020-07-09 2023-04-07 财付通支付科技有限公司 Dynamic injection test method and device and related equipment
CN111949531B (en) * 2020-08-10 2022-02-25 腾讯科技(深圳)有限公司 Block chain network testing method, device, medium and electronic equipment
CN112069067B (en) * 2020-09-03 2021-09-28 腾讯科技(深圳)有限公司 Data testing method and device based on block chain and computer readable storage medium
CN112884475A (en) * 2021-01-22 2021-06-01 支付宝(杭州)信息技术有限公司 Test method and system of intelligent contract resource loss monitoring system

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933735A (en) * 2015-12-30 2017-07-07 优信拍(北京)信息科技有限公司 Test case update method and device
CN107104850A (en) * 2017-03-24 2017-08-29 钱德君 A kind of Quantum Chain method of testing
CN107329888A (en) * 2017-05-31 2017-11-07 深圳前海微众银行股份有限公司 Intelligent contract command code coverage rate computational methods and system
US9934138B1 (en) * 2016-12-07 2018-04-03 International Business Machines Corporation Application testing on a blockchain
CN108011741A (en) * 2016-10-28 2018-05-08 富士通株式会社 For simulating the method and system with the block chain of test distributed network
CN108170590A (en) * 2017-12-12 2018-06-15 北京大学深圳研究生院 A kind of test system and method for block catenary system
EP3388994A1 (en) * 2017-04-12 2018-10-17 Siemens Aktiengesellschaft Method and apparatus for computer-assisted testing of a blockchain
CN108876603A (en) * 2018-01-03 2018-11-23 上海指旺信息科技有限公司 Share exchange platform based on block chain
CN108900380A (en) * 2018-07-14 2018-11-27 上海分布信息科技有限公司 A kind of node administration method and its realize system
CN109117179A (en) * 2018-08-31 2019-01-01 北京八分量信息科技有限公司 A kind of implementation method and platform of software
CN109218079A (en) * 2018-08-16 2019-01-15 北京京东尚科信息技术有限公司 A kind of block chain network, dispositions method and storage medium
GB201820008D0 (en) * 2018-12-07 2019-01-23 Dragon Infosec Ltd A node testing method and apparatus for a blockchain system
CN109408304A (en) * 2018-09-27 2019-03-01 深圳壹账通智能科技有限公司 Block chain introduces test method, device, equipment and readable storage medium storing program for executing
CN109446089A (en) * 2018-10-30 2019-03-08 赛汇检测(广州)有限公司 A kind of software test platform based on block chain technology
CN109542781A (en) * 2018-11-14 2019-03-29 联动优势科技有限公司 Block chain common recognition test of heuristics method, apparatus, computing device and storage medium
CN109542767A (en) * 2018-10-25 2019-03-29 平安科技(深圳)有限公司 Automated testing method, device, computer equipment and storage medium based on block chain
CN109615383A (en) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 Data based on block chain deposit card, acquisition methods and device

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106933735A (en) * 2015-12-30 2017-07-07 优信拍(北京)信息科技有限公司 Test case update method and device
CN108011741A (en) * 2016-10-28 2018-05-08 富士通株式会社 For simulating the method and system with the block chain of test distributed network
US9934138B1 (en) * 2016-12-07 2018-04-03 International Business Machines Corporation Application testing on a blockchain
CN107104850A (en) * 2017-03-24 2017-08-29 钱德君 A kind of Quantum Chain method of testing
EP3388994A1 (en) * 2017-04-12 2018-10-17 Siemens Aktiengesellschaft Method and apparatus for computer-assisted testing of a blockchain
CN107329888A (en) * 2017-05-31 2017-11-07 深圳前海微众银行股份有限公司 Intelligent contract command code coverage rate computational methods and system
CN108170590A (en) * 2017-12-12 2018-06-15 北京大学深圳研究生院 A kind of test system and method for block catenary system
CN108876603A (en) * 2018-01-03 2018-11-23 上海指旺信息科技有限公司 Share exchange platform based on block chain
CN108900380A (en) * 2018-07-14 2018-11-27 上海分布信息科技有限公司 A kind of node administration method and its realize system
CN109218079A (en) * 2018-08-16 2019-01-15 北京京东尚科信息技术有限公司 A kind of block chain network, dispositions method and storage medium
CN109117179A (en) * 2018-08-31 2019-01-01 北京八分量信息科技有限公司 A kind of implementation method and platform of software
CN109408304A (en) * 2018-09-27 2019-03-01 深圳壹账通智能科技有限公司 Block chain introduces test method, device, equipment and readable storage medium storing program for executing
CN109542767A (en) * 2018-10-25 2019-03-29 平安科技(深圳)有限公司 Automated testing method, device, computer equipment and storage medium based on block chain
CN109615383A (en) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 Data based on block chain deposit card, acquisition methods and device
CN109446089A (en) * 2018-10-30 2019-03-08 赛汇检测(广州)有限公司 A kind of software test platform based on block chain technology
CN109542781A (en) * 2018-11-14 2019-03-29 联动优势科技有限公司 Block chain common recognition test of heuristics method, apparatus, computing device and storage medium
GB201820008D0 (en) * 2018-12-07 2019-01-23 Dragon Infosec Ltd A node testing method and apparatus for a blockchain system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链如何测试;rmticocean;《https://www.cnblogs.com/rmticocean/articles/8534101.html》;发文 *

Also Published As

Publication number Publication date
CN110162470A (en) 2019-08-23

Similar Documents

Publication Publication Date Title
CN110162470B (en) Block chain testing method and device
CN111159307B (en) Cross-link data subscription method and device
US10929198B2 (en) Blockchain-based resource allocation method and apparatus
CN108876380B (en) Transaction method and system based on centralized settlement and block chain deposit certificate
CN110471984B (en) Service processing method and device based on block chain and electronic equipment
CN109242453B (en) Transaction method and system based on centralized settlement and block chain deposit certificate
CN110706114B (en) Block chain-based default asset processing method and device and electronic equipment
CN109377216B (en) Transaction method and system based on centralized settlement and block chain deposit certificate
CN110032599B (en) Data structure reading and updating method and device, and electronic equipment
US11423473B2 (en) Blockchain-based leasing
CN110310203B (en) Block chain transaction method and device
CN110298755B (en) Block chain transaction method and device
CN110032598B (en) Method and device for updating field and electronic equipment
CN110597916B (en) Data processing method and device based on block chain, storage medium and terminal
EP4102768A1 (en) Blockchain-based transaction methods
CN112101938A (en) Block chain-based digital seal using method and device and electronic equipment
CN110032568B (en) Data structure reading and updating method and device, and electronic equipment
CN111639125A (en) Resource circulation method and device based on block chain
CN112560114A (en) Method and device for calling intelligent contract
CN112100588A (en) Block chain-based digital seal application method and device and electronic equipment
CN112291321B (en) Service processing method, device and system
CN110458541B (en) Object replacement method and device based on block chain
CN113095825A (en) Asset management method and device based on block chain and electronic equipment
CN111723102A (en) Intelligent contract updating method and device
CN113327169B (en) Claims settlement method and device based on block chain and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20200924

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200924

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant