An automated testing method and system for the functionality of power blockchain interfaces
Through automated testing methods and systems for power blockchain, and using preset keywords and script template libraries, test scripts are automatically generated and executed, the problems of block link port testing in the existing technology are solved, efficient and accurate testing is achieved, and the rapid development and application of blockchain technology in the power industry is supported.
Patent Information
- Application Number
- CN202110714337.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-25
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2041-06-25
AI Technical Summary
The lack of complete testing standards and systems in the existing technology has led to a large and laborious workload of block link port testing, and it relies on manual judgment, lack of automation and efficiency, which has affected the progress and application of blockchain technology in the power industry.
It provides an automated testing method and system for the functionality of power block link ports. Through preset keywords and script template libraries, test scripts are automatically generated and executed, reducing manual writing and comparison work, and improving testing efficiency and accuracy.
The power block link port testing has been automated, which reduces the workload and manual judgment errors of testers, improves the testing efficiency and accuracy, and supports the rapid development and application of blockchain technology in the power industry.
Smart Images

Figure CN113268433B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to interface testing of electric power blockchain, and specifically to an automated testing method and system for the functionality of electric power blockchain interfaces. Background Art
[0002] Similar to the operating system providing the application layer with a system call interface for accessing the kernel, the blockchain also has many interfaces for external calls, which can call contracts according to actual needs, read or write data on the chain, or directly call interfaces via the http protocol. The test focus of the interface is on stable input and correct output, paying more attention to the boundaries, and ensuring that external access to the node can be continuous and uninterrupted.
[0003] At present, the development of blockchain technology involves hot issues that are of key concern to the market. The general testing standards and systems are imperfect, and the interface testing methods in international and domestic standards are mostly based on functional point testing, which is labor-intensive and laborious.
[0004] The testing methods for blockchain interface testing in the power industry are also incomplete. Before the standard method is implemented, there are a thousand different blockchain testing methods in the eyes of a thousand people. Different understandings of blockchain interface testing have hindered technological progress and application development, and no consensus has been reached or credibility has been formed. Therefore, the research on blockchain interface testing methods has become a necessary topic for the development of blockchain in the energy and power field.
[0005] In related testing technologies, the interface testing of blockchain products is usually done by testers who refer to interface testing requirements and design specifications, manually write test cases and interface testing scripts, and then perform interface testing on blockchain products item by item based on the written test cases and test scripts, record and locate test defects, and issue test reports. This type of interface testing requires the use of programming languages to write interface testing scripts, which requires high technical capabilities of testers, is difficult, requires high labor costs, and has a long testing cycle, which affects the efficiency of interface testing work; the management of test cases is scattered, and the readability and reusability of test cases are poor, and they cannot be shared in real time; interface testing relies more on manual comparison and subjective judgment of testers, and lacks historical data traces to restrict analysis. The entire project cycle requires testers to continuously reproduce and verify defects. Summary of the invention
[0006] In view of the problems existing in the prior art, the present invention provides an automated testing method and system for the functionality of the power blockchain interface, which has a reasonable design and is easy to use, reduces the workload of testers, and reduces the deviation caused by manual judgment errors.
[0007] The present invention is achieved through the following technical solutions:
[0008] An automated testing method for the functionality of a power blockchain interface, comprising:
[0009] According to the electric energy blockchain field and its application type, select the corresponding preset field keywords;
[0010] Call the corresponding power blockchain interface test script template according to the preset domain keywords;
[0011] Receive variables and parameters corresponding to the power blockchain interface test script template, and maintain the power blockchain interface test script template;
[0012] Call and execute the maintained power blockchain interface test script template to obtain the automated test results for the power blockchain interface functionality.
[0013] Preferably, the preset domain keywords correspond one-to-one to the application types under all the fields to which the electric power energy blockchain belongs; the preset domain keywords are associated one-to-one with the electric power blockchain interface test script templates in the preset script template library.
[0014] Preferably, the receiving of variables and parameters corresponding to the power blockchain interface test script template and the maintenance of the power blockchain interface test script template specifically include:
[0015] Receive the input variable values required when the power blockchain interface test script template is executed, and use them to select the corresponding interface test items when the interface test script template is executed;
[0016] Receive assertions for the execution of the power blockchain interface test script template, which are used to set the expected results when the interface test script template is executed;
[0017] Receive the monitoring configuration of the power blockchain interface test script template execution, which is used for monitoring when the interface test script template is executed.
[0018] Preferably, the receiving device receives variables and parameters corresponding to the power blockchain interface test script template, and maintains the power blockchain interface test script template; and also includes setting the interface test script template to test multiple interface functions.
[0019] Furthermore, the setting of the interface test script template to test multiple interface functions includes setting at least one of the script start time and running time, setting the execution order of each interface test script template, and setting operations on input interface parameters.
[0020] Preferably, the calling and executing of the maintained power blockchain interface test script template obtains an automated test result for the functionality of the power blockchain interface; and further includes,
[0021] If the execution result of the power blockchain interface test script template is a failure, the defect corresponding to the failure is identified according to the preset conditions during execution, and the result is sent.
[0022] Furthermore, after obtaining the automated test results, a defect report and / or test report is generated through an interface test script template, and the automated test results are uploaded to the blockchain.
[0023] An automated testing system for the functionality of a power blockchain interface, comprising:
[0024] The keyword selection module is used to select the corresponding preset field keywords according to the electric energy blockchain field and its application type;
[0025] The template calling module is used to call the corresponding power blockchain interface test script template according to the preset domain keywords;
[0026] A template maintenance module, used to receive variables and parameters corresponding to the power blockchain interface test script template, and maintain the power blockchain interface test script template;
[0027] The template execution module is used to call and execute the maintained power blockchain interface test script template to obtain the automated test results for the functionality of the power blockchain interface.
[0028] A computer device comprising:
[0029] Memory for storing computer programs;
[0030] A processor is used to implement the automated testing method for the functionality of the power blockchain interface as described in any of the above items when executing the computer program.
[0031] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements an automated testing method for the functionality of a power blockchain interface as described in any one of the above items.
[0032] Compared with the prior art, the present invention has the following beneficial technical effects:
[0033] The present invention calls a preset script template through preset keywords, maintains the script through fixed required variables and parameters, and thus generates a test script according to the script template for execution and automated testing; thus, the generation of an interface test script can be completed through only simple keywords or variables, with strong flexibility and low requirements on the development capabilities of testers.
[0034] Furthermore, a more diverse script template library corresponding to the application type can be formed, so that the scripts are solidified and can be maintained and called by testers at any time, thereby improving the readability and reusability of the use cases.
[0035] Furthermore, by using assertions to automatically execute tests and generate result reports, a lot of manual comparison and verification work is saved. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 The flowchart of the automatic testing method described in the example of the present invention.
[0037] Figure 2 This is a flow chart of the actual test performed by the test platform described in the example of the present invention.
[0038] Figure 3 It is a structural block diagram of the automatic testing system described in the example of the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0041] The present invention may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0042] In the present invention, "module", "device", "system" and the like refer to related entities applied to computers, such as hardware, a combination of hardware and software, software or software in execution, etc. In detail, for example, an element can be, but is not limited to, a process, a processor, an object, an executable element, an execution thread, a program and / or a computer running on a processor. In addition, an application or script program running on a server, a server can all be an element. One or more elements can be in an execution process and / or thread, and an element can be localized on a computer and / or distributed between two or more computers, and can be operated by various computer-readable media. An element can also communicate through local and / or remote processes according to a signal with one or more data packets, for example, a signal from a data that interacts with another element in a local system, a distributed system, and / or a network on the Internet through a signal to interact with other systems.
[0043] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include" and "comprise" include not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such processes, methods, articles or equipment. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or equipment that includes the elements.
[0044] The present invention provides an automated testing method and system for the functionality of a power blockchain interface. Aiming at the technical characteristics of power blockchain products, on the basis of existing blockchain testing technology, by learning and understanding the content of requirement documents, combined with interface testing methods, it is possible to achieve in the field of energy and power that the interface type can be identified simply by inputting keywords and variables, and the test can be completed after the interface test script is improved, thereby reducing the workload of testers and reducing the deviation caused by human judgment errors to a certain extent, ensuring that special testing of blockchain product interfaces is carried out in a scientific, orderly, standardized and efficient manner, and further meeting the requirements of agile testing.
[0045] Before further describing the present invention in conjunction with the accompanying drawings and examples, the relevant terms involved are explained and illustrated as follows.
[0046] Blockchain: A model for implementing and managing transaction processing by building an unforgeable, tamper-proof and traceable block chain data structure through transparent and trusted rules in a peer-to-peer network environment.
[0047] Automated Testing: Generally refers to the automation of software testing. Software testing is to run the system or application under preset conditions and evaluate the running results. The preset conditions should include normal conditions and abnormal conditions.
[0048] Automated testing technology: Use automated testing tools to analyze test requirements, design automated test cases, build an automated testing framework, design and write automated scripts, and verify the correctness of test scripts.
[0049] Interface testing: A test that tests the interfaces between system components. Interface testing is mainly used to detect the interaction points between external systems and internal subsystems. The focus of the test is to check the data exchange, transmission and control management process, as well as the mutual logical dependencies between systems.
[0050] Interface testing technology: used to test the interface between the system and other external systems, as well as the interface between the various sub-modules within the system, to check the correctness of interface parameter transmission, the correctness of interface function implementation, the correctness of output results, and the integrity and rationality of fault-tolerant processing of various abnormal situations. In the prior art, tools such as POSTMAN are used to perform interface functional testing, and the numerical value returned after executing the script is manually compared with the expected result.
[0051] Application programming interface (API): A set of predefined functions that are intended to provide applications and developers with the ability to access a set of routines based on a piece of software or hardware without having to access the source code or understand the details of the internal workings. In addition to the meaning of "application programming interface", API also specifically refers to the API's documentation, also known as help documentation.
[0052] The present invention provides an automated testing method for the functionality of a power blockchain interface, such as Figure 1 As shown, it includes,
[0053] According to the electric energy blockchain field and its application type, select the corresponding preset field keywords;
[0054] Call the corresponding power blockchain interface test script template according to the preset domain keywords;
[0055] Receive variables and parameters corresponding to the power blockchain interface test script template, and maintain the power blockchain interface test script template;
[0056] Call and execute the maintained power blockchain interface test script template to obtain the automated test results for the power blockchain interface functionality.
[0057] Specifically, script developers can create interface testing tasks in the test platform, select the corresponding power blockchain interface test script template (hereinafter referred to as template) through blockchain field keywords, maintain variables in the template, save the script after maintenance is completed, set the script start time and running time, set the execution order of each interface script, or set the operation of a certain interface parameter. The test platform system can automatically call the API for automated interface testing, and automatically generate a result analysis report after execution.
[0058] Among them, the preset domain keywords correspond one-to-one with the application types in all the fields of the electric energy blockchain; the preset domain keywords are associated one-to-one with the electric power blockchain interface test script templates in the preset script template library. See Table 1 below for specific setting of domain keywords:
[0059] Table 1 Keywords in the field of electric energy blockchain
[0060]
[0061] When the automated testing method of the present invention is executed on an actual testing platform, Figure 2 As shown, the specific steps include the following:
[0062] (1) Analyze the test requirements on the test side, generate test plans accordingly, and display the stored test script templates;
[0063] (2) Maintaining the interface test script on the test end, including the input variable values required for the tested end to execute the script, assertions (i.e., the expected results of the script execution, which can be multiple) and the monitoring configuration for the test system to monitor; wherein, the input variable values are used to select the corresponding interface test items when the interface test script template is executed; the assertions are used to set the expected results when the interface test script template is executed; and the monitoring configuration is used to monitor when the interface test script template is executed.
[0064] After the script is maintained, it will be reviewed. If it passes the review, it will be used as a test script and uploaded to the blockchain. If it fails, it will be returned to continue script maintenance until it passes the review.
[0065] (3) receiving a test script execution request from the test end;
[0066] (4) parsing the information required by the tested end to execute the test script from the test script execution request, and sending it to the tested end for calling and execution;
[0067] (5) After the test script is called and executed by the tested end, the execution result is received from the tested end;
[0068] (6) The test platform automatically records the test script and its execution results to form a process record, which can then be called by the test end;
[0069] (7) If the test script execution result is a failure, after confirmation, the defect corresponding to the situation is identified according to the preset conditions, and this result is formed into a defect report, and the defect is sent to the defect library; if it is confirmed to be non-defective, the defect is rejected and recorded in the test results;
[0070] (8) Generate test results based on the test script execution results and upload them to the chain to complete the test; automatically generate a test report while generating the test results.
[0071] Among them, the power blockchain interface test script template is maintained; it also includes setting the interface test script template to test multiple interface functions; including setting the script start time and running time, setting the execution order of each interface test script template and setting at least one of the operations on the input interface parameters. In this preferred embodiment, the content that can be tested on the blockchain interface includes parameter format, mandatory parameters, response code, database, parameter default value, non-mandatory parameters, return value and business logic, etc., and the operation on the input interface parameters is addition and subtraction.
[0072] In the above steps, if the execution result of the power blockchain interface test script template is a failure, the defect corresponding to the failure is identified according to the preset conditions during execution, and the result is sent. Specifically, on the one hand, a test report and a defect generation report are generated according to the test results and defect confirmation results, respectively, and on the other hand, the generated automated test results are uploaded to the blockchain for storage.
[0073] In actual execution, the interface template executed is excerpted as follows:
[0074] (1) The system presets the keyword of the power energy blockchain as BloCha. By entering or selecting the field code, the corresponding interface test script template can be automatically displayed:
[0075]
[0076] (2) Maintain variables in the script template based on the test interface that the business focuses on:
[0077]
[0078] (3) Fill in the URL address
[0079]
[0080]
[0081] (4) Add assertions:
[0082]
[0083] The present invention corresponds to the above method and also provides an automated testing system for the functionality of the power blockchain interface, such as Figure 3 As shown, including,
[0084] The keyword selection module is used to select the corresponding preset field keywords according to the electric energy blockchain field and its application type;
[0085] The template calling module is used to call the corresponding power blockchain interface test script template according to the preset domain keywords;
[0086] A template maintenance module, used to receive variables and parameters corresponding to the power blockchain interface test script template, and maintain the power blockchain interface test script template;
[0087] The template execution module is used to call and execute the maintained power blockchain interface test script template to obtain the automated test results for the functionality of the power blockchain interface.
[0088] The method described in the present invention utilizes preset keywords and templates to quickly learn data and effectively apply it in the field of energy and power blockchain to reduce the workload of testing, while improving the professionalism and reliability of the testing method, so that the interface automation testing method can be quickly promoted and developed.
[0089] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0090] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0091] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. An automated testing method for the functionality of a power blockchain interface, characterized in that: include, According to the electric energy blockchain field and its application type, select the corresponding preset field keywords; Call the corresponding power blockchain interface test script template according to the preset domain keywords; Receive variables and parameters corresponding to the power blockchain interface test script template, and maintain the power blockchain interface test script template; Call and execute the maintained power blockchain interface test script template to obtain the automated test results for the power blockchain interface functionality; The receiving of variables and parameters corresponding to the power blockchain interface test script template and maintaining the power blockchain interface test script template specifically includes: Receive the input variable values required when the power blockchain interface test script template is executed, and use them to select the corresponding interface test items when the interface test script template is executed; Receive assertions for the execution of the power blockchain interface test script template, which are used to set the expected results when the interface test script template is executed; Receive the monitoring configuration of the power blockchain interface test script template execution, which is used for monitoring when the interface test script template is executed; The receiving variables and parameters corresponding to the power blockchain interface test script template and maintaining the power blockchain interface test script template; It also includes setting up interface test script templates to test multiple interface functions; The calling and executing of the maintained power blockchain interface test script template obtains an automated test result for the functionality of the power blockchain interface; It also includes, if the execution result of the power blockchain interface test script template is a failure, identifying the defects corresponding to the failure situation according to the preset conditions during execution, and sending this result.
2. According to claim 1, an automated testing method for the functionality of a power blockchain interface is characterized in that: The preset domain keywords correspond one-to-one to the application types in all the fields to which the electric power energy blockchain belongs; the preset domain keywords are associated one-to-one with the electric power blockchain interface test script templates in the preset script template library.
3. According to claim 1, an automated testing method for the functionality of a power blockchain interface is characterized in that: The interface test script template is set to test multiple interface functions, including setting the script start time and running time, setting the execution order of each interface test script template, and setting at least one of the operations on input interface parameters.
4. According to claim 1, an automated testing method for the functionality of a power blockchain interface is characterized in that: It also includes, after obtaining the automated test results, generating a defect report and / or test report through an interface test script template, and uploading the automated test results to the blockchain.
5. An automated testing system for the functionality of a power blockchain interface, characterized in that: include, The keyword selection module is used to select the corresponding preset field keywords according to the electric energy blockchain field and its application type; The template calling module is used to call the corresponding power blockchain interface test script template according to the preset domain keywords; A template maintenance module, used to receive variables and parameters corresponding to the power blockchain interface test script template, and maintain the power blockchain interface test script template; The template execution module is used to call and execute the maintained power blockchain interface test script template to obtain the automated test results for the functionality of the power blockchain interface; The receiving of variables and parameters corresponding to the power blockchain interface test script template and maintaining the power blockchain interface test script template specifically includes: Receive the input variable values required when the power blockchain interface test script template is executed, and use them to select the corresponding interface test items when the interface test script template is executed; Receive assertions for the execution of the power blockchain interface test script template, which are used to set the expected results when the interface test script template is executed; Receive the monitoring configuration of the power blockchain interface test script template execution, which is used for monitoring when the interface test script template is executed; The receiving variables and parameters corresponding to the power blockchain interface test script template and maintaining the power blockchain interface test script template; It also includes setting up interface test script templates to test multiple interface functions; The calling and executing of the maintained power blockchain interface test script template obtains an automated test result for the functionality of the power blockchain interface; It also includes, if the execution result of the power blockchain interface test script template is a failure, identifying the defects corresponding to the failure situation according to the preset conditions during execution, and sending this result.
6. A computer device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement an automated testing method for the functionality of a power blockchain interface as described in any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements an automated testing method for the functionality of a power blockchain interface as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Automatic test script generation method and device, and computer equipment
CN108874649A
Business data testing method and device based on block chain and computer equipment
CN110737584A