Automatic testing method and device and storage medium
By calling the entry function to execute configuration files and test scripts in POS machine testing, and using the verification file for security verification, the problem that testing in the existing technology cannot achieve full automation is solved, and the testing efficiency and quality are improved.
Patent Information
- Application Number
- CN202411704643.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, the testing process of the POS machine requires manual operation and cannot realize full-process automated testing, resulting in difficulty in improving the testing efficiency and quality.
By calling the entry function, executing configuration files and test scripts, testing the test equipment to be tested, and using the verification file to perform security verification during the test process, outputting test data and verification results.
The full automatic testing of the POS machine is realized, reducing manual verification steps and improving testing efficiency and quality.
Smart Images

Figure CN119883879A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a method, device and storage medium for automated testing. Background Art
[0002] POS (Point of Sale) machine, also known as sales terminal, is a multifunctional terminal installed in authorized merchants and acceptance outlets of credit cards and connected to a computer network. It can realize automatic electronic fund transfer and has functions such as consumption, pre-authorization, balance inquiry and transfer. It is safe, fast and reliable to use. As an electronic device, the testing steps in the production process of POS machine are necessary and crucial. At the same time, in order to ensure the safety of POS machine, the testing process must include a series of strict verification and special verification steps. These steps are designed to identify and repair possible safety hazards, so as to ensure the stable operation of POS machine in actual application. However, the verification and special verification in the prior art still require manual operation, and it is impossible to achieve full automated testing. Summary of the invention
[0003] In order to solve the above technical problems, the present application provides a method, device and storage medium for automated testing to improve the testing efficiency of equipment.
[0004] The technical solution provided in this application is described below:
[0005] The first aspect of the present application provides a method for automated testing, comprising:
[0006] Calling an entry function according to a target test item of the device to be tested, wherein the entry function is a function for executing a configuration file and a test script, wherein the configuration file is used to configure parameters, setting items, initialization data, and verification files used during the test, and the test script is used to implement the execution of the test;
[0007] Testing the device to be tested according to the configuration file and the test script to obtain test data, and if a security check is required during the test, checking is performed according to the check file to obtain a check result;
[0008] The test data and the verification result are output.
[0009] Optionally, before calling the entry function according to the target test item of the device to be tested, the method further includes:
[0010] Integrating a plurality of verification certificates and verification tools into the verification file;
[0011] The verification file is encrypted according to the RAS encryption algorithm, and the encrypted verification file is stored.
[0012] Optionally, the verifying according to the verification file includes:
[0013] Decrypt the verification file according to the RAS decryption algorithm to obtain a decryption result;
[0014] The verification certificate and verification tool corresponding to the decryption result are obtained according to the model of the device to be tested for verification.
[0015] Optionally, the outputting the test data and the verification result includes:
[0016] Generate a log file according to the test data and the verification result;
[0017] The log file is sent to the client.
[0018] Optionally, the test data includes information of the target test item and a test result of executing the target test item, and generating a log file according to the test data and the verification result includes:
[0019] When the test data shows that the target test item is abnormal, the test result is analyzed and a corresponding processing strategy is generated;
[0020] The test data, the verification results and the processing strategy are organized into a table, and the table is stored in a log file.
[0021] Optionally, the target test items include at least one of the following:
[0022] Perform hardware interface testing, software function testing, security testing and communication testing on the device to be tested.
[0023] Optionally, the test script is a test script that is pre-written in Python code and encrypted using a public key algorithm.
[0024] A second aspect of the present application provides an automated testing device, comprising:
[0025] A calling unit, used to call an entry function according to a target test item of the device to be tested, wherein the entry function is a function for executing a configuration file and a test script, wherein the configuration file is used to configure parameters, setting items, initialization data and verification files used during the test, and the test script is used to implement the execution of the test;
[0026] A testing and verification unit, configured to test the device to be tested according to the configuration file and the test script to obtain test data, and to perform a verification according to the verification file if a safety verification is required during the test to obtain a verification result;
[0027] An output unit is used to output the test data and the verification result.
[0028] A third aspect of the present application provides an automated testing device, the device comprising:
[0029] Processor, memory, input-output unit, and bus;
[0030] The processor is connected to the memory, the input and output unit, and the bus;
[0031] The memory stores a program, and the processor calls the program to execute the first aspect and the optional automated testing method of any one of the first aspect.
[0032] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and any optional automated testing method in the first aspect.
[0033] It can be seen from the above technical solutions that this application has the following advantages:
[0034] The present application provides a method for automated testing. First, the entry function is called according to the target test item of the device to be tested. The entry function is a function that executes the configuration file and the test script. The configuration file is used to configure the parameters, setting items, initialization data and verification files used in the test. The test script is used to implement the test execution; secondly, the device to be tested is tested according to the configuration file and the test script to obtain the test data. If a security check is required during the test, the check is performed according to the verification file to obtain the verification result; finally, the test data and the verification result are output. The present application calls the verification file through the entry function. On the basis of realizing the target project in the test script, the verification file is used to complete the verification and special verification, thereby reducing the steps of manual verification, realizing full-process automated testing, and improving the test efficiency and quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1 A schematic diagram of an embodiment of the automated testing method provided in this application;
[0037] Figure 2 A flowchart of another embodiment of the automated testing method provided by the present application;
[0038] Figure 3 A flowchart of another embodiment of the automated testing method provided by the present application;
[0039] Figure 4 A flowchart of another embodiment of the automated testing method provided by the present application;
[0040] Figure 5 A schematic diagram of the structure of an embodiment of the automated testing device provided in this application;
[0041] Figure 6 A schematic diagram of the structure of another embodiment of the automated testing device provided in the present application. DETAILED DESCRIPTION
[0042] The present application provides a method, device and storage medium for automated testing, which are used to improve the efficiency of testing POS terminals.
[0043] It should be noted that the automated testing method provided in the present application can be applied to a terminal, a system, or a server. For example, the terminal can be a computer, a tablet computer, a portable computer terminal, or a fixed terminal such as a desktop computer.
[0044] It should also be noted that the terms "first", "second", etc. in the specification and drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order, sequence or importance.
[0045] See also Figure 1 , Figure 1 An embodiment of the automated testing method provided by the present application includes:
[0046] Step S101, calling an entry function according to a target test item of the device to be tested, the entry function being a function for executing a configuration file and a test script, the configuration file being used to configure parameters, setting items, initialization data and verification files used during the test, and the test script being used to implement the execution of the test;
[0047] Step S102, testing the device to be tested according to the configuration file and the test script to obtain test data, and if security verification is required during the test, verifying it according to the verification file to obtain the verification result;
[0048] Step S103, output the test data and verification results.
[0049] The method of automated testing of the present invention first calls an entry function according to the target test item of the device to be tested, the entry function is a function for executing configuration files and test scripts, the configuration files are used to configure the parameters, setting items, initialization data and verification files used in the test, and the test scripts are used to implement the execution of the test; secondly, the device to be tested is tested according to the configuration files and the test scripts to obtain test data, and if a safety verification is required during the test, the verification is performed according to the verification file to obtain the verification result; finally, the test data and the verification result are output. The present application calls the verification file through the entry function, and on the basis of the test script realizing the target project, the verification file is used to complete the verification and special verification, thereby reducing the steps of manual verification, realizing full-process automated testing, and improving the test efficiency and quality.
[0050] In step S101 of some embodiments, the entry function is called according to the target test item of the device to be tested, and the entry function is a function for executing the configuration file and the test script. The configuration file is used to configure the parameters, setting items, initialization data and verification files used in the test, and the test script is used to implement the execution of the test. The target test items of the device to be tested may specifically include, but are not limited to, the following: hardware interface test, software function test, security test and / or communication test of the device to be tested. According to the target test items of the device to be tested, an entry function is selected and called. The entry function is responsible for loading and executing two core files: the configuration file and the test script. The configuration file contains various parameters (such as test duration, number of repetitions, etc.) needed for the test, setting items (such as whether to enable certain specific functions), initialization data (such as the initial state that needs to be set before the test) and the verification file (for subsequent safety verification). The test script is the code that actually executes the test logic, which defines how to test the device to be tested, including the specific steps of the test, the data points that need to be detected, etc. And the test script is a test script that is pre-written in python code and encrypted by a public key algorithm.
[0051] Reference Figure 2 According to some embodiments of the present invention, in order to meet the requirements of different models of equipment and different target test items, as well as the requirements of test safety, a verification file should be pre-set before calling the entry function, which may include, but is not limited to, the following:
[0052] Step S201, integrating multiple verification certificates and verification tools into a verification file;
[0053] Step S202, encrypt the verification file according to the RAS encryption algorithm, and store the encrypted verification file.
[0054] In steps S201 to S202 of some embodiments, multiple verification certificates and verification tools are first integrated into a verification file; then the verification file is encrypted according to the RAS encryption algorithm, and the encrypted verification file is stored. In order to be able to automatically retrieve and use all necessary verification certificates (such as digital signature certificates, hash value certificates, etc.) and verification tools (such as hash value calculation tools, digital signature verification tools, etc.) at one time throughout the entire process of automated testing, multiple verification certificates for verifying the integrity or authenticity of the file and the corresponding verification tools should be integrated into a verification file. Further, in order to ensure the integrity and security of the verification file, the verification file should be encrypted, wherein the encryption algorithm used is not limited, and in this embodiment, the RAS encryption algorithm is mainly used for encryption. RSA is a widely used asymmetric encryption algorithm that uses a pair of keys (public key and private key) for encryption and decryption operations. The public key will be used to encrypt the verification file, while the private key is used to decrypt and verify the authenticity of the file. The encrypted verification file is stored in a specified location, for example, the verification file is stored in a subfile in the file where the entry function is located, so that the verification file can be called in the subfile when the entry function is called.
[0055] In step S102 of some embodiments, the device to be tested is tested according to the configuration file and the test script to obtain test data, and if a security check is required during the test, the check is performed according to the check file to obtain the check result. The test script defines the specific steps of the test, the data points to be detected, and the expected results. When executing the test script, the device to be tested is operated according to the parameters and settings defined in the configuration file, which may include starting a specific application, performing a specific task, simulating user behavior, etc. The writing of the test script should fully consider the test objectives, the test environment, and the characteristics of the device to be tested to ensure the accuracy and effectiveness of the test. Specifically, the target test items at different levels may also include: the startup speed of the detection device, resource occupancy, system stability, application response time, user interface interaction, data processing capability, data transmission speed or connection stability, etc. The above test is intended to comprehensively evaluate the performance and stability of the device to be tested. In addition, if a security check is required during the test, the check is performed according to the check file to obtain the check result. The security verification involved in the test process may usually include: data encryption and decryption verification, key management verification, transaction integrity verification, identity authentication verification, log audit verification, security update verification, physical security verification and / or emergency response verification. The above verification may require the cooperation of verification files. If the test requirements clearly require security verification, in this step, the system will perform verification according to the verification file specified in the configuration file. The verification file can contain a series of rules or conditions to check whether the test environment, test data or test process meets the security standards. Based on the execution of the verification, a verification result is generated to indicate whether the test environment is safe, whether it meets the test requirements, and whether the verification is passed.
[0056] Reference Figure 3 According to some embodiments of the present invention, based on steps S201 to S202, the verification according to the verification file in step S102 may specifically include, but is not limited to, the following:
[0057] Step S301, decrypt the verification file according to the RAS decryption algorithm to obtain a decryption result;
[0058] Step S302, obtaining the verification certificate and verification tool corresponding to the decryption result according to the model of the device to be tested, so as to perform verification.
[0059] In steps S301 to S302 of some embodiments, the verification file is first decrypted according to the RAS decryption algorithm to obtain the decryption result; then the corresponding verification certificate and verification tool in the decryption result are obtained according to the model of the device to be tested for verification. After the encryption processing of the verification file in step S202, when the encrypted verification file is called in this embodiment, the verification file should be decrypted to obtain the verification certificate and verification tool in the verification file. The decryption algorithm used in step S301 should correspond to the encryption algorithm used in step S202. For example, when the RAS encryption algorithm is used in step S202, the RAS decryption algorithm is used in step S301. First, ensure that the private key for decryption has been obtained; then, the encrypted verification file is decrypted using the private key; during the decryption process, the mathematical properties of the RSA algorithm will be used to restore the original plaintext data through the private key and encryption algorithm; after the decryption is completed, the decryption result, that is, the original verification file content, is obtained. Afterwards, the extracted verification certificate and verification tool are used to verify the device to be tested. The verification process may include verifying the identity of the device under test, checking the configuration and status of the device under test, and ensuring that the device under test meets specific security standards and requirements. Through verification, the legitimacy and integrity of the device under test can be ensured, so that the automated test can be executed normally.
[0060] In step S103 of some embodiments, test data and verification results are output. Test data may include all relevant data generated during the test process, such as response time, error log, performance indicators, etc. The collected data is properly processed and stored for subsequent analysis and evaluation, as well as to understand the performance of the equipment to be tested, discover potential problems, and provide strong support for subsequent optimization and improvement. Test data and verification results can be organized into a format that is easy to understand and analyze, which may include reports, charts or logs, etc. The report usually contains key information such as the purpose of the test, the test environment, the test method, and the test results; the chart is an intuitive way to present the trend, distribution and comparison of the test data; the log records detailed information during the test process, including test steps, execution time, error information, etc. In addition, the above-mentioned reports, charts or logs can be output in the form of emails, test management systems, online collaboration platforms, etc.
[0061] Reference Figure 4 According to some embodiments of the present invention, the output test data and verification results in step S104 may specifically include, but are not limited to, the following:
[0062] Step S401, generating a log file according to the test data and the verification result;
[0063] Step S402: sending the log file to the client.
[0064] In steps S401 to S402 of some embodiments, a log file is first generated according to the test data and the verification result; and then the log file is sent to the client. Test data is various information generated during the test execution process, including but not limited to information of the target test item (such as the test item name, test item description, expected result, etc.), and the test result of executing the target test item (such as the actual result, test time, test environment, etc.). The verification result refers to the conclusion drawn after using the verification certificate and the verification tool, that is, whether the verification is passed. When the test data shows that the target test item is abnormal (that is, the actual result does not match the expected result), the test result is analyzed in depth to determine the cause of the abnormality. Based on the analysis of the test results, a corresponding processing strategy is generated to solve the problem or improve the test item. The processing strategy may include repairing the code, adjusting the test environment, updating the test data, etc. Then the test data, verification results and processing strategy are organized into a table form that is easy to read and understand. The table should contain all key information for subsequent analysis and tracking. The organized table is then stored in a log file (including additional information such as timestamp, tester information, and test environment description to better track and locate the problem), which is usually used for problem tracking and performance analysis. After the log file is generated and stored, it is finally sent to the client.
[0065] The above embodiment describes the method for automated testing provided by the present application. The following describes the device and storage medium for automated testing provided by the present application:
[0066] See also Figure 5 , Figure 5 An embodiment of the automated testing device provided in the present application includes:
[0067] The calling unit 501 is used to call the entry function according to the target test item of the device to be tested. The entry function is a function for executing the configuration file and the test script. The configuration file is used to configure the parameters, setting items, initialization data and verification files used in the test, and the test script is used to implement the execution of the test;
[0068] The testing and verification unit 502 is used to test the device to be tested according to the configuration file and the test script to obtain the test data, and if a safety verification is required during the test, to verify according to the verification file to obtain the verification result;
[0069] The output unit 503 is used to output the test data and the verification result.
[0070] Optionally, before calling unit 501, the method further includes:
[0071] An integration unit 504, used to integrate multiple verification certificates and verification tools into a verification file;
[0072] The encryption unit 505 encrypts the verification file according to the RAS encryption algorithm and stores the verification file.
[0073] Optionally, the testing and verification unit 502 is specifically used for:
[0074] Decrypt the verification file according to the RAS decryption algorithm to obtain the decryption result;
[0075] The verification file is encrypted according to the RAS encryption algorithm, and the encrypted verification file is stored.
[0076] Optionally, the output unit 503 is specifically used for:
[0077] Generate log files based on test data and verification results;
[0078] Send log files to the client.
[0079] Optionally, the test data includes information of the target test item and a test result of executing the target test item, and the output unit 503 is specifically used to:
[0080] When the test data shows that the target test item is abnormal, the test results are analyzed and the corresponding processing strategy is generated;
[0081] Organize the test data, verification results, and processing strategies into tables and store the tables in log files.
[0082] Optionally, target test items include:
[0083] Hardware interface testing, software functional testing, security testing and / or communication testing of the device under test.
[0084] Optionally, the test script is a test script that is pre-written in Python code and encrypted using a public key algorithm.
[0085] This application also provides an automated testing device, see Figure 6 , the device comprises:
[0086] Processor 601, memory 602, input and output unit 603, bus 604;
[0087] The processor 601 is connected to the memory 602, the input and output unit 603 and the bus 604;
[0088] The memory 602 stores a program, and the processor 601 calls the program to execute the following steps: Figures 1 to 4 The automated testing method shown in any one of the embodiments.
[0089] The present application also relates to a computer-readable storage medium, on which a program is stored, and when the program is run on a computer, the computer executes the following Figures 1 to 4 The automated testing method shown in any one of the embodiments.
[0090] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0091] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0092] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0093] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0094] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A method for automated testing, characterized in that: The method comprises: Calling an entry function according to a target test item of the device to be tested, wherein the entry function is a function for executing a configuration file and a test script, wherein the configuration file is used to configure parameters, setting items, initialization data, and verification files used during the test, and the test script is used to implement the execution of the test; Testing the device to be tested according to the configuration file and the test script to obtain test data, and if a security check is required during the test, checking is performed according to the check file to obtain a check result; The test data and the verification result are output.
2. The method according to claim 1, characterized in that Before calling the entry function according to the target test item of the device to be tested, the method further includes: Integrating a plurality of verification certificates and verification tools into the verification file; The verification file is encrypted according to the RAS encryption algorithm, and the encrypted verification file is stored.
3. The method according to claim 2, characterized in that The verification according to the verification file comprises: Decrypt the verification file according to the RAS decryption algorithm to obtain a decryption result; The verification certificate and verification tool corresponding to the decryption result are obtained according to the model of the device to be tested for verification.
4. The method according to claim 1, characterized in that The outputting of the test data and the verification result comprises: Generate a log file according to the test data and the verification result; The log file is sent to the client.
5. The method according to claim 4, characterized in that The test data includes information of the target test item and a test result of executing the target test item, and generating a log file according to the test data and the verification result includes: When the test data shows that the target test item is abnormal, the test result is analyzed and a corresponding processing strategy is generated; The test data, the verification results and the processing strategy are organized into a table, and the table is stored in a log file.
6. The method according to any one of claims 1 to 5, characterized in that The target test items include at least one of the following: a hardware interface test, a software function test, a security test, and a communication test of the device to be tested.
7. The method according to any one of claims 1 to 5, characterized in that The test script is pre-written in Python code and encrypted using a public key algorithm.
8. An automated testing device, characterized in that: The device comprises: A calling unit, used to call an entry function according to a target test item of the device to be tested, wherein the entry function is a function for executing a configuration file and a test script, wherein the configuration file is used to configure parameters, setting items, initialization data and verification files used during the test, and the test script is used to implement the execution of the test; A testing and verification unit, configured to test the device to be tested according to the configuration file and the test script to obtain test data, and to perform a verification according to the verification file if a safety verification is required during the test to obtain a verification result; An output unit is used to output the test data and the verification result.
9. An automated testing device, characterized in that: The device comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the automated testing method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a program stored thereon, wherein the program, when executed on a computer, performs the automated testing method according to any one of claims 1 to 7.